public void GetTerminalValues(long EntityID) { // get terminal values var block = MyAPIGateway.Entities.GetEntityById(EntityID); if (!isServer) { SendToServer(block, PlayerId, BlockAction.GetTerminalValues); } else { // get block settings TurretSetting settings = (block as IMyLargeMissileTurret).RetrieveTerminalValues(); Logger.Instance.LogMessage("Settings For Block: " + block.EntityId + ": " + ((settings != null) ? settings.ToString() : "null")); // send settings to block block.GameLogic.GetAs <TurretSpotlight>().InitTerminalValues(settings); } }
private void DoServerGetTerminalValues(MyEntity blockEntity, ulong steamId) { if (isOnline) { // get block settings TurretSetting settings = (blockEntity as IMyLargeMissileTurret).RetrieveTerminalValues(); Logger.Instance.LogMessage("Settings For Block: " + blockEntity.EntityId + ": " + ((settings != null) ? settings.ToString() : "null")); // if we have settings to share (if this was not called for a block that was placed by a non server client) if (settings != null) { // send enabled state as a fail safe settings.Enabled = (blockEntity as IMyFunctionalBlock).Enabled; // send settings to client SendActionToClient(blockEntity, 0, steamId, BlockAction.GetTerminalValues, settings); } else { // we have no settings wait until server inits block // log block so settings can be sent later if (PreInitBlockSettings.ContainsKey(steamId)) { // check for this Entity Dictionary <string, TurretSetting> entry = PreInitBlockSettings[steamId]; entry.Add(blockEntity.EntityId.ToString(), null); } else { Dictionary <string, TurretSetting> entry = new Dictionary <string, TurretSetting>(); entry.Add(blockEntity.EntityId.ToString(), settings); PreInitBlockSettings.Add(steamId, entry); } } } }