private static void OnStockipleModeChanged(MySyncAirVent syncObject, ref ChangeDepressurizationModeMsg message, World.MyNetworkClient sender) { syncObject.m_airVent.SetDepressurizing(message.IsDepressurizing); if (Sync.IsServer) { Sync.Layer.SendMessageToAllButOne(ref message, sender.SteamUserId); } }
private static void OnToolbarItemChanged(MySyncAirVent sync, ref ChangeToolbarItemMsg msg, MyNetworkClient sender) { MyToolbarItem item = null; if (msg.Item.EntityID != 0) { if (string.IsNullOrEmpty(msg.Item.GroupName)) { MyTerminalBlock block; if (MyEntities.TryGetEntityById <MyTerminalBlock>(msg.Item.EntityID, out block)) { var builder = MyToolbarItemFactory.TerminalBlockObjectBuilderFromBlock(block); builder.Action = msg.Item.Action; builder.Parameters = msg.Item.Parameters; item = MyToolbarItemFactory.CreateToolbarItem(builder); } } else { MyAirVent parent; if (MyEntities.TryGetEntityById <MyAirVent>(msg.Item.EntityID, out parent)) { var grid = parent.CubeGrid; var groupName = msg.Item.GroupName; var group = grid.GridSystems.TerminalSystem.BlockGroups.Find((x) => x.Name.ToString() == groupName); if (group != null) { var builder = MyToolbarItemFactory.TerminalGroupObjectBuilderFromGroup(group); builder.Action = msg.Item.Action; builder.BlockEntityId = msg.Item.EntityID; builder.Parameters = msg.Item.Parameters; item = MyToolbarItemFactory.CreateToolbarItem(builder); } } } } if (msg.Index == 0) { sync.m_airVent.m_onFullAction = item; } else { sync.m_airVent.m_onEmptyAction = item; } sync.m_airVent.RaisePropertiesChanged(); if (Sync.IsServer) { Sync.Layer.SendMessageToAllButOne(ref msg, sender.SteamUserId); } }
private static void OnStockipleModeChanged(MySyncAirVent syncObject, ref ChangeDepressurizationModeMsg message, World.MyNetworkClient sender) { syncObject.m_airVent.IsDepressurizing = message.IsDepressurizing; }
private static void OnToolbarItemChanged(MySyncAirVent sync, ref ChangeToolbarItemMsg msg, MyNetworkClient sender) { MyToolbarItem item = null; if (msg.Item.EntityID != 0) { if (string.IsNullOrEmpty(msg.Item.GroupName)) { MyTerminalBlock block; if (MyEntities.TryGetEntityById<MyTerminalBlock>(msg.Item.EntityID, out block)) { var builder = MyToolbarItemFactory.TerminalBlockObjectBuilderFromBlock(block); builder.Action = msg.Item.Action; builder.Parameters = msg.Item.Parameters; item = MyToolbarItemFactory.CreateToolbarItem(builder); } } else { MyAirVent parent; if (MyEntities.TryGetEntityById<MyAirVent>(msg.Item.EntityID, out parent)) { var grid = parent.CubeGrid; var groupName = msg.Item.GroupName; var group = grid.GridSystems.TerminalSystem.BlockGroups.Find((x) => x.Name.ToString() == groupName); if (group != null) { var builder = MyToolbarItemFactory.TerminalGroupObjectBuilderFromGroup(group); builder.Action = msg.Item.Action; builder.BlockEntityId = msg.Item.EntityID; builder.Parameters = msg.Item.Parameters; item = MyToolbarItemFactory.CreateToolbarItem(builder); } } } } if (msg.Index == 0) { sync.m_airVent.m_onFullAction = item; } else { sync.m_airVent.m_onEmptyAction = item; } sync.m_airVent.RaisePropertiesChanged(); if (Sync.IsServer) { Sync.Layer.SendMessageToAllButOne(ref msg, sender.SteamUserId); } }