static void OnSetPlayerDeadSuccess(ref SetPlayerDeadMsg msg, MyNetworkClient sender) { Sync.Players.SetPlayerDeadInternal(msg.ClientSteamId, msg.PlayerSerialId, msg.IsDead, msg.ResetIdentity); }
private void SetPlayerDead(MyPlayer player, bool deadState, bool resetIdentity) { var msg = new SetPlayerDeadMsg(); msg.ClientSteamId = player.Id.SteamId; msg.PlayerSerialId = player.Id.SerialId; msg.IsDead = deadState; msg.ResetIdentity = resetIdentity; if (Sync.IsServer) { player.Identity.SetDead(resetIdentity); Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); } else Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
static void OnSetPlayerDeadRequest(ref SetPlayerDeadMsg msg, MyNetworkClient sender) { Debug.Assert(msg.ClientSteamId == sender.SteamUserId, "Received invalid SetPlayerDeadMsg!"); if (msg.ClientSteamId != sender.SteamUserId) return; if (Sync.Players.SetPlayerDeadInternal(msg.ClientSteamId, msg.PlayerSerialId, msg.IsDead, msg.ResetIdentity)) { Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); } }
private void SetPlayerDead(MyPlayer player, bool deadState, bool resetIdentity) { var msg = new SetPlayerDeadMsg(); msg.ClientSteamId = player.Id.SteamId; msg.PlayerSerialId = player.Id.SerialId; msg.IsDead = deadState; msg.ResetIdentity = resetIdentity; if (Sync.IsServer) { // CH: This was here before and I think it's wrong! :-) //player.Identity.SetDead(resetIdentity); if (SetPlayerDeadInternal(player.Id.SteamId, player.Id.SerialId, deadState, resetIdentity)) { Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); } } else Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }