Ejemplo n.º 1
0
 protected override void Update()
 {
     this.ToggleIcons(false);
     if (TheForest.Utils.Input.GetButtonAfterDelay("Take", 0.5f, false))
     {
         if (this.CanGather)
         {
             LocalPlayer.Inventory.GatherWater(true);
             LocalPlayer.Sfx.PlayTwinkle();
         }
         else if ((double)this._fullness > 0.01)
         {
             LocalPlayer.Sfx.PlayWhoosh();
             if (this._meats > 0)
             {
             }
             int calories = this._meats * 600 + this._mushrooms * 10 + this._herbs * 5;
             StewCombo.SetIngredients(this._meats, this._mushrooms, this._herbs, this._hydration > 0.01f);
             LocalPlayer.Stats.AteCustom(this._fullness * StewCombo.FullnessRatio, this._health * StewCombo.HealthRatio, this._energy * StewCombo.EnergyRatio, this._isFresh > 0f, this._meats > 0, this.IsLimb, calories);
             if (this._remainsYield > 0)
             {
                 LocalPlayer.Inventory.AddItem(this._remainsItemId, this._remainsYield, true, false, null);
             }
             if (this._hydration > 0.01f)
             {
                 LocalPlayer.Sfx.PlayDrink();
                 LocalPlayer.Stats.Thirst = Mathf.Clamp01(LocalPlayer.Stats.Thirst - this._hydration);
             }
         }
         else if (this._hydration > 0.01f)
         {
             LocalPlayer.Sfx.PlayDrink();
             LocalPlayer.Stats.Thirst = Mathf.Clamp01(LocalPlayer.Stats.Thirst - this._hydration);
         }
         if (BoltNetwork.isRunning && base.entity && base.entity.isAttached)
         {
             if (base.entity.isOwner)
             {
                 BoltNetwork.Destroy(base.entity);
             }
             else
             {
                 RequestDestroy requestDestroy = RequestDestroy.Create(GlobalTargets.Everyone);
                 requestDestroy.Entity = base.entity;
                 requestDestroy.Send();
             }
         }
         else
         {
             UnityEngine.Object.Destroy(base.transform.parent.gameObject);
         }
     }
 }
Ejemplo n.º 2
0
 public static void SetIngredients(int meats, int mushrooms, int herbs, bool water)
 {
     if (meats > 0 && meats == mushrooms && meats == herbs)
     {
         StewCombo.HealthRatio   = 1f;
         StewCombo.EnergyRatio   = 1f + Mathf.Clamp((float)mushrooms * 0.05f, 0.05f, 0.3f);
         StewCombo.FullnessRatio = 1f + Mathf.Clamp((float)mushrooms * 0.05f, 0.05f, 0.3f);
         StewCombo.Log("balanced");
     }
     else if (herbs > 0 && meats == mushrooms && herbs < meats && herbs < mushrooms)
     {
         StewCombo.HealthRatio   = 1f;
         StewCombo.EnergyRatio   = 1f + Mathf.Clamp((float)mushrooms * 0.1f, 0.1f, 0.4f);
         StewCombo.FullnessRatio = 1f + Mathf.Clamp((float)meats * 0.1f, 0.1f, 0.4f);
         StewCombo.Log("realistic");
     }
     else if (herbs > 0 && meats > 0 && water && herbs < mushrooms && meats < mushrooms)
     {
         StewCombo.HealthRatio   = 1f;
         StewCombo.EnergyRatio   = 1f + Mathf.Clamp((float)mushrooms * 0.1f, 0.1f, 0.4f);
         StewCombo.FullnessRatio = 1f + Mathf.Clamp((float)meats * 0.05f, 0.05f, 0.2f);
         StewCombo.Log("mushroom sauce");
     }
     else if (mushrooms == 0 && !water && meats > 0 && meats == herbs)
     {
         StewCombo.HealthRatio   = 0.8f;
         StewCombo.EnergyRatio   = 1f;
         StewCombo.FullnessRatio = 1f + Mathf.Clamp((float)meats * 0.15f, 0.15f, 0.5f);
         StewCombo.Log("BBQ");
     }
     else if (meats == 0 && meats == 0 && mushrooms > 0 && herbs > 0 && water)
     {
         StewCombo.HealthRatio   = 1f + Mathf.Clamp((float)(herbs + herbs) * 0.05f, 0.05f, 0.4f);
         StewCombo.EnergyRatio   = 1f + Mathf.Clamp((float)(herbs + herbs) * 0.05f, 0.05f, 0.4f);
         StewCombo.FullnessRatio = 0.8f;
         StewCombo.Log("ointment");
     }
     else if (meats == 0 && mushrooms == 0 && herbs > 0 && water)
     {
         StewCombo.HealthRatio   = 1f + Mathf.Clamp((float)herbs * 0.2f, 0.2f, 1f);
         StewCombo.EnergyRatio   = 0.8f;
         StewCombo.FullnessRatio = 0.5f;
         StewCombo.Log("tisane");
     }
     else
     {
         StewCombo.HealthRatio   = 1f;
         StewCombo.EnergyRatio   = 1f;
         StewCombo.FullnessRatio = 1f;
     }
 }