public static bool RemoveNodeComponent(PowerSystem __instance, int id) { if (SimulatedWorld.Initialized) { // as the destruct is synced accross players this event is too // and as such we can safely remove power demand for every player PowerNodeComponent pComp = __instance.nodePool[id]; PowerTowerManager.RemExtraDemand(__instance.planet.id, pComp.networkId, id); } return(true); }
public static bool RemoveNodeComponent(PowerSystem __instance, int id) { if (Multiplayer.IsActive) { // as the destruct is synced accross players this event is too // and as such we can safely remove power demand for every player PowerNodeComponent pComp = __instance.nodePool[id]; Multiplayer.Session.PowerTowers.RemExtraDemand(__instance.planet.id, pComp.networkId, id); } return(true); }
public static void UpdateAnimation(int PlanetId, int NetId, int NodeId, int PowerAmount) { float idkValue = 0.016666668f; PlanetFactory factory = GameMain.galaxy.PlanetById(PlanetId)?.factory; if (factory != null && factory.entityAnimPool != null && factory.powerSystem != null) { PowerNodeComponent pComp = factory.powerSystem.nodePool[NodeId]; AnimData[] animPool = factory.entityAnimPool; int entityId = pComp.entityId; if (pComp.coverRadius < 15f) { animPool[entityId].StepPoweredClamped(factory.powerSystem.networkServes[NetId], idkValue, (PowerAmount > 0) ? 2U : 1U); } else { animPool[entityId].StepPoweredClamped2(factory.powerSystem.networkServes[NetId], idkValue, (PowerAmount > 0) ? 2U : 1U); } } }