public override void OnCreation() { FabricInitParameters fabricInitParameters = Simulator.GetObjectInitParameters(this.ObjectId) as FabricInitParameters; if (fabricInitParameters != null) { NumScraps = fabricInitParameters.Amount; } base.OnCreation(); }
public static bool CreateAndAddToInventory(GameObject obj, int amount) { if (obj != null && obj.Inventory != null) { for (int i = 0; i < amount; i++) { FabricInitParameters initData = new FabricInitParameters(1); IGameObject Knitted = (IngredientFabric)GlobalFunctions.CreateObjectOutOfWorld(fabricKnittedRK, null, initData); FabricKnitted ingredientKnitted = Knitted as FabricKnitted; IGameObject Cotton = (IngredientFabric)GlobalFunctions.CreateObjectOutOfWorld(fabricCottonRK, null, initData); FabricCotton ingredientCotton = Cotton as FabricCotton; IGameObject leather = (IngredientFabric)GlobalFunctions.CreateObjectOutOfWorld(fabricLeatherRK, null, initData); FabricLeather ingredientLeather = leather as FabricLeather; IGameObject synthetic = (IngredientFabric)GlobalFunctions.CreateObjectOutOfWorld(fabricSyntheticRK, null, initData); FabricSynthetic ingredientSynthetic = synthetic as FabricSynthetic; IGameObject denim = (IngredientFabric)GlobalFunctions.CreateObjectOutOfWorld(fabricDenimRK, null, initData); FabricDenim ingredientDenim = denim as FabricDenim; IGameObject satin = (IngredientFabric)GlobalFunctions.CreateObjectOutOfWorld(fabricSatinRK, null, initData); FabricSatin ingredientSatin = satin as FabricSatin; if (ingredientKnitted != null) { if (!obj.Inventory.TryToAdd(ingredientKnitted)) { SewingTable.print("Lyralei's SewingTable: Couldn't add Fabric Knitted, Destroyed item."); ingredientKnitted.Destroy(); return(false); } } if (ingredientLeather != null) { if (!obj.Inventory.TryToAdd(ingredientLeather)) { SewingTable.print("Lyralei's SewingTable: Couldn't add Fabric Leather, Destroyed item."); ingredientLeather.Destroy(); return(false); } } if (ingredientSynthetic != null) { if (!obj.Inventory.TryToAdd(ingredientSynthetic)) { SewingTable.print("Lyralei's SewingTable: Couldn't add Fabric Synthetic, Destroyed item."); ingredientSynthetic.Destroy(); return(false); } } if (ingredientCotton != null) { if (!obj.Inventory.TryToAdd(ingredientCotton)) { SewingTable.print("Lyralei's SewingTable: Couldn't add Fabric Cotton, Destroyed item."); ingredientCotton.Destroy(); return(false); } } if (ingredientDenim != null) { if (!obj.Inventory.TryToAdd(ingredientDenim)) { SewingTable.print("Lyralei's SewingTable: Couldn't add Fabric Denim, Destroyed item."); ingredientDenim.Destroy(); return(false); } } if (ingredientSatin != null) { if (!obj.Inventory.TryToAdd(ingredientSatin)) { SewingTable.print("Lyralei's SewingTable: Couldn't add Fabric Satin, Destroyed item."); ingredientSatin.Destroy(); return(false); } } } return(true); } return(false); }