Replace the vanilla logic of power chargers and simply sync ON/OFF state.
PowerTowerManager now only maintains two pool, one is LocalChargerIds which stores all nodeIds of power chargers charging the local player. When add/remove nodeId from LocalChargerIds, it is broadcast to other players and stored in RemoteChargerHashIds as 64 bits hashIds, which planetId is the upper bits and nodeId is the lower bits.
If the player is in range of the charger, or RemoteChargerHashIds contains the id, then the charger will be set to working state, otherwise, it is set to idle state.
The pools are reset and recalculated whenever a player is disconnected to prevent persistent energy charges.
Fix #448 #470
Replace the vanilla logic of power chargers and simply sync ON/OFF state.
PowerTowerManager now only maintains two pool, one is
LocalChargerIds
which stores all nodeIds of power chargers charging the local player. When add/remove nodeId fromLocalChargerIds
, it is broadcast to other players and stored inRemoteChargerHashIds
as 64 bits hashIds, which planetId is the upper bits and nodeId is the lower bits.If the player is in range of the charger, or
RemoteChargerHashIds
contains the id, then the charger will be set to working state, otherwise, it is set to idle state.The pools are reset and recalculated whenever a player is disconnected to prevent persistent energy charges. Fix #448 #470