Example #1
0
    private void UpdateFueling(bool legacy)
    {
        bool flag = this._leafDelay + this.LeafDelayTime < Time.time && this.HasFuel;

        this.PositionIcon(this.IconAddLeaves);
        if (legacy && this.CookingDisabled)
        {
            int num = this.NextFoodType();
            if (this._currentFoodItemNum != num && (TheForest.Utils.Input.GetButtonDown("Rotate") || !this.HasFuel))
            {
                LocalPlayer.Sfx.PlayWhoosh();
                this._currentFoodItemNum = num;
            }
        }
        if (flag && this._proximity)
        {
            this.Widget.ShowList(this.FuelItemId, this.IconAddLeaves.transform, SideIcons.Craft);
        }
        else
        {
            this.Widget.Shutdown();
        }
        if (flag && TheForest.Utils.Input.GetButtonDown("Craft") && LocalPlayer.Inventory.RemoveItem(this.FuelItemId, 1, false, true))
        {
            LocalPlayer.Sfx.PlayItemCustomSfx(this.FuelItemId, true);
            this._leafDelay = Time.time;
            if (BoltNetwork.isRunning)
            {
                FireAddFuelEvent fireAddFuelEvent = FireAddFuelEvent.Create(GlobalTargets.Everyone);
                fireAddFuelEvent.Target = base.entity;
                fireAddFuelEvent.Send();
            }
            else
            {
                this.Action_AddFuel();
            }
        }
    }