Blueprint Book for Items (e.g. Spidertron Remotes)

Place to get help with not working mods / modding interface.
Post Reply
Tastaturtaste
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Dec 20, 2020 10:37 pm
Contact:

Blueprint Book for Items (e.g. Spidertron Remotes)

Post by Tastaturtaste »

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!

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Blueprint Book for Items (e.g. Spidertron Remotes)

Post by Deadlock989 »

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?
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?

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.
Image

Tastaturtaste
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Dec 20, 2020 10:37 pm
Contact:

Re: Blueprint Book for Items (e.g. Spidertron Remotes)

Post by Tastaturtaste »

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.
That would explain why I did not find any mod that is already doing this. :/
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...
Did you try overriding the item filters on your BlueprintBook?
I believe I tried that while testing. But as you already said these properties are blank in the normal blueprint book prototype.
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.
I already tried setting that on a normal ItemWithInventory prototype, but the result ingame was a inventory size of zero.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Blueprint Book for Items (e.g. Spidertron Remotes)

Post by Deadlock989 »

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 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.

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.
Image

Trific
Fast Inserter
Fast Inserter
Posts: 147
Joined: Thu Dec 31, 2020 7:57 pm
Contact:

Re: Blueprint Book for Items (e.g. Spidertron Remotes)

Post by Trific »

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.
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?

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Blueprint Book for Items (e.g. Spidertron Remotes)

Post by Deadlock989 »

Trific wrote:
Thu Jan 14, 2021 9:23 pm
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?
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.
Image

Tastaturtaste
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Dec 20, 2020 10:37 pm
Contact:

Re: Blueprint Book for Items (e.g. Spidertron Remotes)

Post by Tastaturtaste »

Thanks for your input!
A remote icon would look weaker, blown up so large from the standard icon resolution
That is indeed true. Maybe there could be a way to support the functionality with copy, scrolling, etc. for normal ItemWithInventory items...
Also, spidertron remotes don't seem to support labels, which are an important part of the blueprint book GUI.
Well, I think it would be possible to add labels to items within a mod to circumvent this limitation.

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.

Tastaturtaste
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Dec 20, 2020 10:37 pm
Contact:

Re: Blueprint Book for Items (e.g. Spidertron Remotes)

Post by Tastaturtaste »

Trific wrote:
Thu Jan 14, 2021 9:23 pm
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?
Well, that does give some hope :D
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.

Post Reply

Return to “Modding help”