public static void ProcessCommon(MessageSyncInvisible message) { Logger.Debug("Player Visible Change {0}", message.PlayerId, message.VisibleState); var players = new List<IMyPlayer>(); MyAPIGateway.Players.GetPlayers(players, p => p != null && p.PlayerID == message.PlayerId); IMyPlayer player = players.FirstOrDefault(); if (player != null && player.Controller.ControlledEntity != null) { player.Controller.ControlledEntity.Entity.Visible = message.VisibleState; // display the state back to the original caller. if (!MyAPIGateway.Utilities.IsDedicated && MyAPIGateway.Session.Player != null && MyAPIGateway.Session.Player.PlayerID == message.PlayerId) MyAPIGateway.Utilities.ShowMessage("Invisible", !MyAPIGateway.Session.Player.Controller.ControlledEntity.Entity.Visible ? "On" : "Off"); } }
public static void ProcessCommon(MessageSyncInvisible message) { Logger.Debug("Player Visible Change {0}", message.PlayerId, message.VisibleState); var players = new List <IMyPlayer>(); MyAPIGateway.Players.GetPlayers(players, p => p != null && p.IdentityId == message.PlayerId); IMyPlayer player = players.FirstOrDefault(); if (player != null && player.Controller.ControlledEntity != null) { player.Controller.ControlledEntity.Entity.Visible = message.VisibleState; // display the state back to the original caller. if (!MyAPIGateway.Utilities.IsDedicated && MyAPIGateway.Session.Player != null && MyAPIGateway.Session.Player.IdentityId == message.PlayerId) { MyAPIGateway.Utilities.ShowMessage("Invisible", !MyAPIGateway.Session.Player.Controller.ControlledEntity.Entity.Visible ? "On" : "Off"); } } }