BCC\BCMM Discord: https://discord.com/invite/AhN8a3KeP9
Whats wrong with GetPowerPercentageWanted()?
# imitates what Bridge Commander does when shields are powered to 0%# increases stored shield values for generators on ships that aren't currently being useddef UpdateStoredGenHealth(pObject, pEvent): if nonActiveGens and shipShieldVals: #print "UpdateStoredGenHealth() ---------" # for each ship in dictionary for shipID in nonActiveGens.keys(): # get the ship, use the ship to get fake generator names, use names to get correct fake generator ship = App.ShipClass_GetObjectByID(App.SetClass_GetNull(), shipID) ship = App.ShipClass_Cast(ship) genNames = GetPrimarySecondaryGenNames(ship) currGenerator = MissionLib.GetSubsystemByName(ship, genNames[0]) generator = 0 if not currGenerator.GetObjID() == nonActiveGens[shipID]: currGenerator = MissionLib.GetSubsystemByName(ship, genNames[1]) generator = 1 # for all stored shield values of that generator noChangeMade = 1 currGenerator = App.ShieldClass_Cast(currGenerator) for shield in range(0, 6): # set shield strength equal to current + perSecond amount, but don't allow it to go over maximum charge charge = 0 if currGenerator.GetShieldChargePerSecond(shield) > 0: charge = currGenerator.GetShieldChargePerSecond(shield) / 100 * ship.GetShields().GetPowerPercentageWanted() * 100 result = shipShieldVals[shipID][generator][shield] + charge max = currGenerator.GetMaxShields(shield) if shipShieldVals[shipID][generator][shield] == max: continue elif max > result: shipShieldVals[shipID][generator][shield] = result noChangeMade = 0 else: shipShieldVals[shipID][generator][shield] = max noChangeMade = 0 if noChangeMade: # if no change was made then values are all at full strength, remove it del nonActiveGens[shipID] # call again and again MissionLib.CreateTimer(Lib.LibEngineering.GetEngineeringNextEventType(), __name__ + ".UpdateStoredGenHealth", App.g_kUtopiaModule.GetGameTime() + 1, 0, 0)