private static bool IsShipLootable(MySmallShip smallShip) { bool isParked = (smallShip is MySmallShipBot && ((MySmallShipBot)smallShip).IsParked()); return smallShip.IsPilotDead() || isParked && smallShip.Enabled; }
public void PilotDie(MySmallShip deadPilotEntity, MyEntity killer) { Debug.Assert(deadPilotEntity.EntityId.HasValue); Log("Pilot died: " + deadPilotEntity.DisplayName); MyEventPilotDie msg = new MyEventPilotDie(); msg.EntityId = deadPilotEntity.EntityId.Value.NumericValue; msg.KillerId = killer != null && killer.EntityId != null ? killer.EntityId.Value.PlayerId : (byte?)null; m_respawnTime = MyMinerGame.TotalGamePlayTimeInMilliseconds + (int)m_multiplayerConfig.RespawnTime.TotalMilliseconds; Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered); if (deadPilotEntity == MySession.PlayerShip) { MyHudWarnings.Remove(deadPilotEntity); OnMeDied(msg.KillerId); } if (!deadPilotEntity.IsPilotDead()) { deadPilotEntity.DisplayName = MyClientServer.LoggedPlayer.GetDisplayName() + " (dead)"; } deadPilotEntity.PilotHealth = 0; // Send inventory on die to allow looting if (deadPilotEntity is IMyInventory) { Inventory_OnInventoryContentChange(((IMyInventory)deadPilotEntity).Inventory, deadPilotEntity); } deadPilotEntity.InventoryChanged += new Action<MyShip>(s => Inventory_OnInventoryContentChange(s.Inventory, s)); }