• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

operation40

Private
Mar 18, 2015
14
0
StatisticsManager seems to provide different capacities:
StatisticType.ElectricityCapacity
StatisticType.WaterCapacity
StatisticType.SewageCapacity

But does not have actual consumption..

tried looping thru buildings, but numbers don't appear to align with the game:

BuildingManager buildManager = Singleton<BuildingManager>.instance;
for (int i = 0; i < buildManager.m_buildings.m_buffer.Length; i++)
{
Building build = buildManager.m_buildings.m_buffer;
power += build.Info.m_buildingAI.GetElectricityConsumption(); //build.m_electricityBuffer;
water += build.Info.m_buildingAI.GetWaterConsumption(); // build.m_waterBuffer;
sewage += build.Info.m_buildingAI.GetWaterConsumption(); // build.m_sewageBuffer;
}


For water/sewage, also tried WaterManager:

WaterManager wm = Singleton<WaterManager>.instance;
WaterManager.Node[] waternodes = wm.m_nodeData ;

for (int i = 0; i < waternodes.Length; i++)
{
waterbuffer += waternodes.m_curWaterPressure + waternodes.m_extraWaterPressure;
sewagebuffer += waternodes.m_curSewagePressure + waternodes.
}

nothing there that resembles in-game numbers either :(

any ideas?
 
Hmm, I know a lot of statistics seem to come from the district level.

You can try something like this and see what that gives you.

Code:
DistrictManager mainDistrictManager = Singleton<DistrictManager>.instance;
mainDistrictManager.m_districts.m_buffer[0].GetElectricityCapacity ();
mainDistrictManager.m_districts.m_buffer[0].GetElectricityConsumption();
 
that's working a lot better, thanks!!! :D
I swear I went thru every manager except that one, thinking I didn't want to be dependent on player defining districts -- doh.. seems to be system defined ones in there..

it's exact on a new map.. my bigger one is showing 233MW vs 207MW actual so think I'm missing something still..
player defined districts are maybe in there along-side system generated ones.. too.. or some serious rounding going on

now if I can figure out why I'm crashing (only occasionally) when setting .text on a UILabel..