private void MakeComplete(Craft_Structure structure) { try { if (structure._requiredIngredients.Count <= 0) { return; } for (int i = 0; i < structure._requiredIngredients.Count; ++i) { Craft_Structure.BuildIngredients buildIngredients = structure._requiredIngredients[i]; if (structure.GetPresentIngredients().Length <= i) { continue; } ReceipeIngredient receipeIngredient = structure.GetPresentIngredients()[i]; if (receipeIngredient._amount >= buildIngredients._amount) { continue; } for (int j = 0; j < buildIngredients._amount - receipeIngredient._amount; j++) { if (BoltNetwork.isRunning) { AddIngredient ingredient = AddIngredient.Create(GlobalTargets.OnlyServer); ingredient.IngredientNum = i; ingredient.ItemId = buildIngredients._itemID; ingredient.Construction = structure.entity; ingredient.Send(); } else { structure.AddIngrendient_Actual(i, true); } SleepFor(0.300f); } SleepFor(0.300f); } } catch { } }
public static void InstantlyFinishBlueprint(Craft_Structure structure) { try { if (structure._requiredIngredients.Count > 0) { for (var itemNumber = 0; itemNumber < structure._requiredIngredients.Count; itemNumber++) { var requiredItems = structure._requiredIngredients[itemNumber]; if (structure.GetPresentIngredients().Length > itemNumber) { var presentItems = structure.GetPresentIngredients()[itemNumber]; if (presentItems._amount >= requiredItems._amount) { continue; } for (var i = 0; i < requiredItems._amount - presentItems._amount; i++) { if (BoltNetwork.isRunning) { var addIngredient = AddIngredient.Create(GlobalTargets.OnlyServer); addIngredient.IngredientNum = itemNumber; addIngredient.ItemId = requiredItems._itemID; addIngredient.Construction = structure.entity; PacketQueue.Add(addIngredient); } else { structure.AddIngrendient_Actual(itemNumber, true); } } } } } } catch (Exception) { // ignored } }
public static void InstantBuilder(Craft_Structure structure) { try { if (structure._requiredIngredients.Count > 0) { for (int i = 0; i < structure._requiredIngredients.Count; i++) { Craft_Structure.BuildIngredients buildIngredients = structure._requiredIngredients[i]; if (structure.GetPresentIngredients().Length > i) { ReceipeIngredient receipeIngredient = structure.GetPresentIngredients()[i]; if (receipeIngredient._amount < buildIngredients._amount) { for (int j = 0; j < buildIngredients._amount - receipeIngredient._amount; j++) { if (BoltNetwork.isRunning) { AddIngredient ingredient = AddIngredient.Create(GlobalTargets.OnlyServer); ingredient.IngredientNum = i; ingredient.ItemId = buildIngredients._itemID; ingredient.Construction = structure.entity; ingredient.Send(); } else { structure.AddIngrendient_Actual(i, true, null); } } } } } } } catch (System.Exception) { } }