Currently trains with wagons that have equipment grids are given the wait condition "Robots inactive". I'm creating some spidertron wait conditions and I'd like to be able to use whatever is behind this, but I can't find it exposed anywhere. I don't know if it should be in LuaPlayer, LuaControl, LuaEntity, LuaEquipment, or LuaEquipmentGrid... I guess that depends on how it is implemented internally.
For my purposes, a boolean would be sufficient, but an int would be more useful for others.
Thanks!
Expose active bot count
Expose active bot count
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Re: Expose active bot count
Entities have a 'logistic_network' property that returns a LuaLogisticNetwork for whatever network they're in. For player characters and spidertrons (and probably other vehicles with an equipment grid with roboports, though I only verified player characters and spidertrons) that's their personal network. LuaLogisticNetwork has two properties 'all_construction_robots' and 'available_construction_robots' - if the first isn't == to the later, it's got some bots active. Number of active bots is available - all.
Re: Expose active bot count
Oh brilliant, thank you very much!Silari wrote: ↑Thu Apr 22, 2021 8:13 amEntities have a 'logistic_network' property that returns a LuaLogisticNetwork for whatever network they're in. For player characters and spidertrons (and probably other vehicles with an equipment grid with roboports, though I only verified player characters and spidertrons) that's their personal network. LuaLogisticNetwork has two properties 'all_construction_robots' and 'available_construction_robots' - if the first isn't == to the later, it's got some bots active. Number of active bots is available - all.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Re: Expose active bot count
For some reason doing `logistic_network.all_construction_robots == logistic_network.available_construction_robots` wouldn't quite work. It would usually trigger just before all the robots were back inside the spidertron, leaving some behind. Doing `not next(logistic_network.construction_robots)` works perfectly though.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings