public void SendProducerEnableChange(bool producerEnabled) { var msg = new ProducerEnabledMsg(); msg.EntityId = m_batteryBlock.EntityId; msg.ProducerEnabled = producerEnabled; Sync.Layer.SendMessageToServer(ref msg); }
static void OnProducerEnableChange(ref ProducerEnabledMsg msg, MyNetworkClient sender) { MyBatteryBlock batteryBlock; if (MyEntities.TryGetEntityById <MyBatteryBlock>(msg.EntityId, out batteryBlock)) { batteryBlock.ProducerEnabled = msg.ProducerEnabled; if (Sync.IsServer) { Sync.Layer.SendMessageToAll(ref msg); } } }
static void OnProducerEnableChange(ref ProducerEnabledMsg msg, MyNetworkClient sender) { MyBatteryBlock batteryBlock; if (MyEntities.TryGetEntityById <MyBatteryBlock>(msg.EntityId, out batteryBlock)) { batteryBlock.SourceComp.SetProductionEnabledByType(MyResourceDistributorComponent.ElectricityId, msg.ProducerEnabled); if (Sync.IsServer) { Sync.Layer.SendMessageToAll(ref msg); } } }
static void OnProducerEnableChange(ref ProducerEnabledMsg msg, MyNetworkClient sender) { MyBatteryBlock batteryBlock; if (MyEntities.TryGetEntityById<MyBatteryBlock>(msg.EntityId, out batteryBlock)) { batteryBlock.ProducerEnabled = msg.ProducerEnabled; if (Sync.IsServer) Sync.Layer.SendMessageToAll(ref msg); } }
static void OnProducerEnableChange(ref ProducerEnabledMsg msg, MyNetworkClient sender) { MyBatteryBlock batteryBlock; if (MyEntities.TryGetEntityById<MyBatteryBlock>(msg.EntityId, out batteryBlock)) { batteryBlock.SourceComp.SetProductionEnabledByType(MyResourceDistributorComponent.ElectricityId, msg.ProducerEnabled); if (Sync.IsServer) Sync.Layer.SendMessageToAll(ref msg); } }