See here, I am using my API left bottom Button -> Inspector Window. Second Tab has a "Get Entities" function, we see a Construction and SIM_BUILDING
You want the whole UG API Madness, let's do it. You have a construction entity.
1. Get the construction component,
2. Use the simBuilding(s) EntityId to get component SIM_BUILDING
3. we have a list Entity Ids of Stocks => stockList
4. use simEntityAtStockSystem to get count.
Dump of UG Console:
>> construction = api.engine.getComponent(14088, api.type.ComponentType.CONSTRUCTION)
>> construction.simBuildings
{
[1] = 78928,
}
>> simBuilding = api.engine.getComponent(78928, api.type.ComponentType.SIM_BUILDING)
>> simBuilding
{
stockList = 14088,
level = 1,
upgradeProgress = 0,
}
>> api.engine.system.simEntityAtStockSystem.getStockCount(14088,1)
367
>> api.engine.system.simEntityAtStockSystem.getStockCount(14088,0)
531
Alles anzeigen
Easy? Yeah... There are tons other apis the api.engine.systems ,so it's likely there is an easier way... but with the good documentation...
There are some industry mods out there, maybe look what apis they use to get to a easier code path...
-edit- More madness while we are at whole thing. Let's say, we have a SIM_BUILDING and want a construction?
api.system.streetConnectorSystem.getConstructionEntityForSimBuilding
https://transportfever2.com/wi…ctionEntityForSimBuilding