public void Init(MyMwcObjectBuilder_Player playerObjectBuilder) { System.Diagnostics.Debug.Assert(playerObjectBuilder != null); Health = playerObjectBuilder.Health; Money = playerObjectBuilder.Money; TimeWithoutOxygen = playerObjectBuilder.WithoutOxygen; if (playerObjectBuilder.PlayerStatisticsObjectBuilder != null) { Statistics.Init(playerObjectBuilder.PlayerStatisticsObjectBuilder); } if (playerObjectBuilder.ShipObjectBuilder != null) { // because we want generate playership's id after all other entities will be loaded //playerObjectBuilder.ShipObjectBuilder.EntityId = null; Ship = MyEntities.CreateFromObjectBuilderAndAdd(null, playerObjectBuilder.ShipObjectBuilder, playerObjectBuilder.ShipObjectBuilder.PositionAndOrientation.GetMatrix()) as MySmallShip; if (playerObjectBuilder.ShipConfigObjectBuilder != null) { Ship.Config.Init(playerObjectBuilder.ShipConfigObjectBuilder); } } if (MyFakes.ENABLE_REFILL_PLAYER_TO_MAX) { SetToMax(); } }
private static void StoreCoopPlayer(this MyMwcObjectBuilder_Checkpoint checkpoint, MyMwcObjectBuilder_Player playerBuilder) { if (checkpoint != null) { if (checkpoint.InventoryObjectBuilder == null) { checkpoint.InventoryObjectBuilder = (MyMwcObjectBuilder_Inventory)MyMwcObjectBuilder_Base.CreateNewObject(MyMwcObjectBuilderTypeEnum.Inventory, null); } // Remove old and add new checkpoint.InventoryObjectBuilder.InventoryItems.RemoveAll(new Predicate <MyMwcObjectBuilder_InventoryItem>(s => s.ItemObjectBuilder.Name == playerBuilder.Name)); checkpoint.InventoryObjectBuilder.InventoryItems.Add(new MyMwcObjectBuilder_InventoryItem(playerBuilder, 1)); } }
public static void StoreCoopPlayer(this MyMwcObjectBuilder_Checkpoint checkpoint, MyMwcObjectBuilder_Player playerBuilder, string displayName) { playerBuilder.Name = CoopPlayerPrefix + displayName; StoreCoopPlayer(checkpoint, playerBuilder); }