Accessing "ghost" circuit connections
Posted: Sat Jun 01, 2019 7:38 am
Hello!
I'm the developer of the BetterBots mod https://mods.factorio.com/mod/BetterBots
In my mod, I introduce some new technologies to empower roboports with added charge pads and electric energy flow for robots. All these new versions are actually new prototypes of type="roboport" because those values are defined during the prototype stage and can't be changed after that.
Once a new level of the main technology is researched, the mod "swaps" each roboport on the map with the new version automatically. From then on all new roboports placed by the player/robots are instantly swapped with the correct upgraded version. All the properties of the vanilla roboport are passed on to the newly created entity (inventory, health, internal charge, circuit connections etc.). After that, the old roboport entity is instantly destroyed.
Now, the issue I'm trying to work around is this: when I place a blueprint containing a roboport with a circuit connection to another entity, If the roboport is placed BEFORE the entity it is connected to, the connection is lost because (as i mentioned earlier) the roboport that is actually placed gets instantly destroyed in favour of the upgraded version, before the connected entity has a chance to be placed and the connection "physically" established. If the connected entity gets placed first instead, there's no problem because then the placed roboport gets connected before being destroyed and I can copy that connection over to the upgraded roboport.
Where's the information about those "ghost wires" stored? Of course if the entity that's supposed to be connected to the roboport has not yet been placed, there's no actual connection to fetch with the usual LuaEntity methods and properties...
I hope someone can shed some light on this matter...
Thanks
I'm the developer of the BetterBots mod https://mods.factorio.com/mod/BetterBots
In my mod, I introduce some new technologies to empower roboports with added charge pads and electric energy flow for robots. All these new versions are actually new prototypes of type="roboport" because those values are defined during the prototype stage and can't be changed after that.
Once a new level of the main technology is researched, the mod "swaps" each roboport on the map with the new version automatically. From then on all new roboports placed by the player/robots are instantly swapped with the correct upgraded version. All the properties of the vanilla roboport are passed on to the newly created entity (inventory, health, internal charge, circuit connections etc.). After that, the old roboport entity is instantly destroyed.
Now, the issue I'm trying to work around is this: when I place a blueprint containing a roboport with a circuit connection to another entity, If the roboport is placed BEFORE the entity it is connected to, the connection is lost because (as i mentioned earlier) the roboport that is actually placed gets instantly destroyed in favour of the upgraded version, before the connected entity has a chance to be placed and the connection "physically" established. If the connected entity gets placed first instead, there's no problem because then the placed roboport gets connected before being destroyed and I can copy that connection over to the upgraded roboport.
Where's the information about those "ghost wires" stored? Of course if the entity that's supposed to be connected to the roboport has not yet been placed, there's no actual connection to fetch with the usual LuaEntity methods and properties...
I hope someone can shed some light on this matter...
Thanks