public void SpawnAsNewPlayer(MyPlayer player, Vector3 currentPosition, string respawnShipId, bool resetIdentity) { Debug.Assert(Sync.IsServer, "Calling SpawnAsNewPlayer on client!"); Debug.Assert(player.Identity != null, "Spawning with empty identity!"); if (!Sync.IsServer || player.Identity == null) { return; } if (player.Identity != null && resetIdentity) { if (!player.Identity.IsDead) { Sync.Players.KillPlayer(player); } if (MySession.Static.Settings.PermanentDeath.Value) { var faction = MySession.Static.Factions.TryGetPlayerFaction(player.Identity.IdentityId); if (faction != null) { MySession.Static.Factions.KickMember(faction.FactionId, player.Identity.IdentityId); } //Clear chat history if (MySession.Static.ChatSystem != null) { MySession.Static.ChatSystem.ClearChatHistoryForPlayer(player.Identity); } var identity = Sync.Players.CreateNewIdentity(player.DisplayName); player.ChangeIdentity(identity); } } if (MySession.Static.Settings.EnableOxygen) { player.Identity.ChangeToOxygenSafeSuit(); } if (respawnShipId != null) { SpawnAtShip(player, respawnShipId); } else { SpawnInSuit(player); } }