Hello everyone!
I am relatively new to factorio modding but already tried a few things with the modding api and made a very simple mod to build multiple belts at the same time.
I want to create a mod which adds a new item to the game that should work similar to the Blueprint Book, but rather than blueprints it should handle items like the Spidertron Remote to make grouping/organizing possible.
After looking at the modding tutorial in the wiki my first impression was that it should be possible to copy the BlueprintBook prototype and modify this copy to allow insertion of some specific type of item instead of blueprints.
This is where I am stuck. I think I looked at every relevant piece of documentation but did not find any possibility to change the allowed type of item in a blueprint book.
Alternatively I tried using the ItemWithInventory prototype as the basis for my mod.
While I succeded in adding a item in which any other item can be inserted, all the awesome functionality of the Blueprint Book (scrolling through content, dynamically expanding inventory, the general UI with copy, etc.) is missing. While it would probably(?) be possible to code all of the UI and the other functionality from scratch I don't think that would be the best approach. I also don't think I would have enough free time to attempt the mod with this scale at the moment (yay exams ).
TLDR: Is it possible to modify the behaviour of the Blueprint Book prototype (copy) in such a way as to allow insertion of some other specific item like the Spidertron Remote while still retaining the rest of the functionality of the Blueprint Book?
Thank you for your time!
Blueprint Book for Items (e.g. Spidertron Remotes)
-
- Burner Inserter
- Posts: 7
- Joined: Sun Dec 20, 2020 10:37 pm
- Contact:
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Blueprint Book for Items (e.g. Spidertron Remotes)
My gut feeling is that it isn't, or we would have seen it done by now - the ability to put redprints (deconstruction planners) and greenprints (upgrade planners) into books is often requested. Looking at the vanilla prototype for blueprint books in base\prototypes\item.lua, it doesn't define any of the ItemWithInventory properties it inherits (with the exception of the open and close sounds) that you'd expect to see defined for a generic "blueprints only" container (e.g. item filters, filter mode) so I'm guessing that it's handled as a special case by the game. Did you try overriding the item filters on your BlueprintBook?Tastaturtaste wrote: ↑Thu Jan 14, 2021 1:15 am TLDR: Is it possible to modify the behaviour of the Blueprint Book prototype (copy) in such a way as to allow insertion of some other specific item like the Spidertron Remote while still retaining the rest of the functionality of the Blueprint Book?
One interesting thing in the prototype definition for vanilla blueprint books is that the inventory_size property is set to a string with value "dynamic" - that property is supposed to be of type ItemStackIndex which is essentially an integer, and there's nothing about this in the wiki, so that may be something worth exploring for ItemWithInventory, although if I'm honest I'd expect to find that it's only handled as a special case by type BlueprintBook. But I have never really played with these prototypes so I don't actually know for sure.
-
- Burner Inserter
- Posts: 7
- Joined: Sun Dec 20, 2020 10:37 pm
- Contact:
Re: Blueprint Book for Items (e.g. Spidertron Remotes)
That would explain why I did not find any mod that is already doing this. :/My gut feeling is that it isn't, or we would have seen it done by now - the ability to put redprints (deconstruction planners) and greenprints (upgrade planners) into books is often requested.
Do you know if the devs did already considered making such functionality available for mods? I did not find any feature request in the forum referencing something like that. If that is the case, maybe I should write a Modding interface request...
I believe I tried that while testing. But as you already said these properties are blank in the normal blueprint book prototype.Did you try overriding the item filters on your BlueprintBook?
I already tried setting that on a normal ItemWithInventory prototype, but the result ingame was a inventory size of zero.One interesting thing in the prototype definition for vanilla blueprint books is that the inventory_size property is set to a string with value "dynamic" - that property is supposed to be of type ItemStackIndex which is essentially an integer, and there's nothing about this in the wiki, so that may be something worth exploring for ItemWithInventory, although if I'm honest I'd expect to find that it's only handled as a special case by type BlueprintBook.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Blueprint Book for Items (e.g. Spidertron Remotes)
I don't know. To be honest I think it would be weird for anything that isn't a planner kind of item - the slots in a blueprint book GUI are twice the size of regular icons. For the blueprint base icon it doesn't look so bad at 4K resolution / 200% GUI size because their design is simple enough to stand the upscaling and also, well, they're just squares with a dotted outline, and the planners are all designed to have up to four icon overlays on top of that, catching the eye. A remote icon would look weaker, blown up so large from the standard icon resolution; I guess a mod could supply a non-standard icon resolution for it. Also, spidertron remotes don't seem to support labels, which are an important part of the blueprint book GUI.Tastaturtaste wrote: ↑Thu Jan 14, 2021 5:36 pm Do you know if the devs did already considered making such functionality available for mods? I did not find any feature request in the forum referencing something like that. If that is the case, maybe I should write a Modding interface request...
I think this is just one of several things about blueprints, the books and the library that are a little bit "magical".
But if you don't ask, you don't get.
Re: Blueprint Book for Items (e.g. Spidertron Remotes)
Ah, are you not supposed to be able to put those in blueprint books? Because I have a blueprint book with some upgrade planners in it. Will it blow up at some point or what?Deadlock989 wrote: ↑Thu Jan 14, 2021 4:14 am My gut feeling is that it isn't, or we would have seen it done by now - the ability to put redprints (deconstruction planners) and greenprints (upgrade planners) into books is often requested.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Blueprint Book for Items (e.g. Spidertron Remotes)
Huh. It used to be the case that blueprint books only took blueprints. Looks like they can have the other kind of planners for some time (0.17?) and I never noticed.
-
- Burner Inserter
- Posts: 7
- Joined: Sun Dec 20, 2020 10:37 pm
- Contact:
Re: Blueprint Book for Items (e.g. Spidertron Remotes)
Thanks for your input!
Another thing that would really help with the issue would be if just the GUI part from the Blueprint Book could be reused. It would be possible to control the behaviour with the control.lua and bind new functions to the buttons and GUI events. But I don't think that is possible at the moment.
That is indeed true. Maybe there could be a way to support the functionality with copy, scrolling, etc. for normal ItemWithInventory items...A remote icon would look weaker, blown up so large from the standard icon resolution
Well, I think it would be possible to add labels to items within a mod to circumvent this limitation.Also, spidertron remotes don't seem to support labels, which are an important part of the blueprint book GUI.
Another thing that would really help with the issue would be if just the GUI part from the Blueprint Book could be reused. It would be possible to control the behaviour with the control.lua and bind new functions to the buttons and GUI events. But I don't think that is possible at the moment.
-
- Burner Inserter
- Posts: 7
- Joined: Sun Dec 20, 2020 10:37 pm
- Contact:
Re: Blueprint Book for Items (e.g. Spidertron Remotes)
Well, that does give some hope
Maybe there is some list of items that are allowed in Blueprint Books defined somewhere? And maybe one could add something to that list?
It wouldn't even have to be the remote itself, as long as it would be possible to handle some kind of event if this placeholder type is interacted with.
Then in the control.lua it would maybe be possible to swap the placeholder the player selected with the appropriate remote...
It's certainly not the most elegant way to handle this, but at least a start.