Infinite chest mod: give me some pointers please!
Posted: Wed Mar 11, 2015 5:17 am
I'm working on my first Factorio mod but I'm having trouble figuring out the not-quite-basics of the modding system. So here's a pile of questions! Note that I'm happy to read existing mods in order to find answers, so if your answer is "Mod X does that" then I can probably untangle it from there.
I'm looking to create a chest that automatically spawns/despawns items inside it for the purpose of testing layouts. I basically want a Requester chest that, at all times, contains exactly the requested items. As near as I can tell it's not possible to add the Request chest UI easily to an existing chest (is that true?), so I was planning to just make another chest with the logistics settings of a Requester chest and let the game code take care of that. (Is that reasonable?)
However, this means I'll either need to track every time an item is removed from one of my chests (is that possible? I don't think so) or update all of my chests every once in a while. The latter seems reasonable to me, but I can't find any way to list all entities of a given type (is there one?)
It seems like the expected way to do this is to store a list of all entities of this type when they're placed, and clean them up when they're removed (is that true?) but I can't figure out how to do that, nor what exactly I should be storing in a list (positions? actual entity handles?). Also, if I do do this, I'll need some way to serialize that list on shutdown, and I'm having trouble untangling how the save/load systems work.
I'm also not 100% sure it's possible for me to retrieve the list of requested items from a chest, but I haven't even gotten that far yet; at least it seems easy to add/remove things from a chest.
So if anyone can point me at a small mod or two that do similar things, or give me the necessary keywords to look for in order to find out more, I'd be eternally grateful!
I'm looking to create a chest that automatically spawns/despawns items inside it for the purpose of testing layouts. I basically want a Requester chest that, at all times, contains exactly the requested items. As near as I can tell it's not possible to add the Request chest UI easily to an existing chest (is that true?), so I was planning to just make another chest with the logistics settings of a Requester chest and let the game code take care of that. (Is that reasonable?)
However, this means I'll either need to track every time an item is removed from one of my chests (is that possible? I don't think so) or update all of my chests every once in a while. The latter seems reasonable to me, but I can't find any way to list all entities of a given type (is there one?)
It seems like the expected way to do this is to store a list of all entities of this type when they're placed, and clean them up when they're removed (is that true?) but I can't figure out how to do that, nor what exactly I should be storing in a list (positions? actual entity handles?). Also, if I do do this, I'll need some way to serialize that list on shutdown, and I'm having trouble untangling how the save/load systems work.
I'm also not 100% sure it's possible for me to retrieve the list of requested items from a chest, but I haven't even gotten that far yet; at least it seems easy to add/remove things from a chest.
So if anyone can point me at a small mod or two that do similar things, or give me the necessary keywords to look for in order to find out more, I'd be eternally grateful!