Exemple #1
0
        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
            { }
        }
Exemple #2
0
 protected override void AddIngredient(int ingredientNum)
 {
     if (!CheatMenuComponent.InstantBuild)
     {
         base.AddIngredient(ingredientNum);
         return;
     }
     Craft_Structure.BuildIngredients buildIngredients = this._requiredIngredients[ingredientNum];
     LocalPlayer.Sfx.PlayHammer();
     if (BoltNetwork.isRunning)
     {
         AddIngredient addIngredient = global::AddIngredient.Create(GlobalTargets.OnlyServer);
         addIngredient.IngredientNum = ingredientNum;
         addIngredient.ItemId        = buildIngredients._itemID;
         addIngredient.Construction  = base.GetComponentInParent <BoltEntity>();
         addIngredient.Send();
         return;
     }
     base.AddIngrendient_Actual(ingredientNum, true, null);
 }
Exemple #3
0
 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)
     {
     }
 }