Making water in WaterBarrel endless

Bonaccorso

Rookie
Mar 1, 2019
78
13
8
32
I found out that decorative barrels with water can't be used to refill water pitchers, and tried adding WaterBarrels instead; but I was surprised to find out that they are added empty, and while they can be filled by adding quantity to their props, they are not endless - at max, 100 uses only (20 full pitcher refills).

I tried to find a way to lock the amount there, and to spawn them full already, but so far I failed - neither in WaterBarrel.cs, nor in BaseWaterContainer.cs or Container.cs I found how can I do it. It seems just changing WaterBarrel(bool filled) is not a solution at all.

Maybe somebody did this?
 

PyrO

Moderator
Jan 27, 2015
1,315
170
63
well it can be done in a lot of ways, either with the normal WaterBarrels or an EndlessWaterBarrel or however you want to call it.

If you want to go with an separat item, go with this.
 

Attachments

  • Like
Reactions: Bonaccorso

GoldDraco13

Squire
Aug 1, 2014
468
285
63
48
Canada
mycy4.com
Donate
Donate money to this user
You can change the max amount, it is set to 100 by default, you can also add a filled water barrel by using [add waterbarrel true

If you want to make it endless, you'll need to go into BaseBeverage and edit the follow
Code:
            else if (targ is BaseWaterContainer)
            {
                BaseWaterContainer bwc = targ as BaseWaterContainer;

                if (Quantity == 0 || (Content == BeverageType.Water && !IsFull))
                {
                    Content = BeverageType.Water;

                    int iNeed = Math.Min((MaxQuantity - Quantity), bwc.Quantity);

                    if (iNeed > 0 && !bwc.IsEmpty && !IsFull)
                    {
                        bwc.Quantity -= iNeed;
                        Quantity += iNeed;

                        from.PlaySound(0x4E);
                    }
                }
            }
do something like
Code:
if (iNeed > 0 && !bwc.IsEmpty && !IsFull)
                    {
                        bwc.Quantity -= iNeed;
                        Quantity += iNeed;

                        from.PlaySound(0x4E);
                    }
if (bwc.IsEmpty)
bwc.Quantity = 100;
 
  • Like
Reactions: Bonaccorso

Bonaccorso

Rookie
Mar 1, 2019
78
13
8
32
well it can be done in a lot of ways, either with the normal WaterBarrels or an EndlessWaterBarrel or however you want to call it.

If you want to go with an separat item, go with this.
Thank you so much! Started to test it :)