Modifying Rate of Water Consumption by Players / Metabolism

Hello,
I'm referencing this plugin request that had a similar problem: https://umod.org/community/plugin-requests/47949-metabolism-hydration-rate-modifier-increase-or-decrease

My question: can I soley adjust a player's rate of water consumption?

Like this previous problem, I would also like to adjust the rate at which players lose food and water but I specifically want to adjust water more than food. I understand using server.metabolismtick "1" to affect food but I can't find info on whether or not this command affects water as well. If it does indeed affect water, it doesn't affect it enough thus my desire to change water consumption seperately.

I'm trying to make a 2018 style server so I want food and water consumption to be higher. I got metabolismtick to work but I want more water depletion!

Please help, thank you!

I think I get what you need : 

Plugin needs to affect the metabolism rate, but you'd like water to be used at a higher rate than food. Or otherwise put, you'd like the rates to be adjustable and separately adjusted?

Will see what I can do this weekend.



Merged post

https://github.com/Calytic/oxideplugins/blob/master/rust/Metabolism.cs

But it's a tad broken so :

using System;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Metabolism", "Wulf/lukespragg", "2.3.2", ResourceId = 680)]
    [Description("Modifies player metabolism stats and rates")]

    class Metabolism : RustPlugin
    {
        #region Configuration

        const string permAllow = "metabolism.allow";
        bool usePermissions;
        float caloriesLossRate;
        float caloriesSpawnValue;
        float healthGainRate;
        float healthSpawnValue;
        float hydrationLossRate;
        float hydrationSpawnValue;

        protected override void LoadDefaultConfig()
        {
            Config["CaloriesLossRate"] = caloriesLossRate = GetConfig("CaloriesLossRate", 0.03f);
            Config["CaloriesSpawnValue"] = caloriesSpawnValue = GetConfig("CaloriesSpawnValue", 500f);
            Config["HealthGainRate"] = healthGainRate = GetConfig("HealthGainRate", 0.03f);
            Config["HealthSpawnValue"] = healthSpawnValue = GetConfig("HealthSpawnValue", 100f);
            Config["HydrationLossRate"] = hydrationLossRate = GetConfig("HydrationLossRate", 0.03f);
            Config["HydrationSpawnValue"] = hydrationSpawnValue = GetConfig("HydrationSpawnValue", 250f);
            Config["UsePermissions"] = usePermissions = GetConfig("UsePermissions", false);
            SaveConfig();
        }

        void Init()        
		{            
			LoadDefaultConfig();
            permission.RegisterPermission(permAllow, this);        
		}        
		
		#endregion

        #region Modify Metabolism

        void Metabolize(BasePlayer player)
        {
            player.health = healthSpawnValue;
            player.metabolism.calories.value = caloriesSpawnValue;
            player.metabolism.hydration.value = hydrationSpawnValue;
        }

        void OnPlayerRespawned(BasePlayer player) => Metabolize(player);        void OnRunPlayerMetabolism(PlayerMetabolism m, BaseCombatEntity entity)
        {
            var player = entity.ToPlayer();
            if (player == null) return;
            if (usePermissions && !permission.UserHasPermission(player.UserIDString, permAllow))

            player.health = Mathf.Clamp(player.health + healthGainRate, 0f, 100f);
            m.calories.value = Mathf.Clamp(m.calories.value - caloriesLossRate, m.calories.min, m.calories.max);
            m.hydration.value = Mathf.Clamp(m.hydration.value - hydrationLossRate, m.hydration.min, m.hydration.max);
        }

        #endregion

        T GetConfig<T>(string name, T value) => Config[name] == null ? value : (T)Convert.ChangeType(Config[name], typeof(T));
    }
}


Merged post

Just let me know if that works.

@TheFriendlyChap Thank you so much I really appreciate the help! I currently don't have a server of my own but I will stay in touch. Also it's been a while since I've done any coding, what language is this and how do I implement code like this to my server?

Sorry if that's a big question, if you know a useful link or something for implementing code on Rust that would help too. There's so much info out there and it's really hard to sift through to what I'm looking for.



Merged post

Reply from JimDeadlock:
"I don't know the answer but bear in mind that food and water are used in separate actions - food is consumed by running/activity and water is consumed by overheating, so the two are not really linked and will be consumed at different rates depending on what the player is doing. What I mean is make sure the player is in the desert with lots of clothes on to determine the rate of water consumption."

My question:
So could I make running/activity affect water consumption?

Not sure, would have to see if constantly checking players is an option or not. It may cause some major instablility if it checks too much.