Decay delay time

Need a way to adjust the delay before the start of decaynd. So that deployable items without TC start decaying instantly, and not after some time. Sleeping bags have been lying on the ground for too long, I want to reduce their life span.

try

void OnEntitySpawned(SleepingBag sleepingBag)
{
    (sleepingBag.decay as DeployableDecay).decayDelay = 0;
}
XpBhmpUR6sHBukC.jpg AVOCoder

try

void OnEntitySpawned(SleepingBag sleepingBag)
{
    (sleepingBag.decay as DeployableDecay).decayDelay = 0;
}

It's already better than nothing, but it works in a strange way. The sleeping bag and beach towel begin to rot without delay, but decay does not affect them.tick server and multipliers plugin. They start losing 1hp every minute or so.



Merged post

I was wrong, it doesn't seem to work at all. I unloaded the plugin, but nothing changed, decay continued for 1hp every minute. Now I'm going to reinstall the server, first I'll see what happens without plugins, then with this one plugin.

Merged post

Yes, that's right, with this parameter, the sleeping bag and beach towel start to decay about 2 minutes after deployed. At the same time, decay.tick acts on them. The plugin's multipliers do not work on them either. They just lose 1hp about every 2 minutes.

Merged post

Translation difficulties. decay.tick does not affect the decay of sleeping bags with this parameter.
XpBhmpUR6sHBukC.jpg AVOCoder

try

void OnEntitySpawned(SleepingBag sleepingBag)
{
    (sleepingBag.decay as DeployableDecay).decayDelay = 0;
}

It just dawned on me, this is a topic in the general section, and I thought that this is a theme that I created in support of the No Decay plugin.



Merged post

I made it a separate plugin, the same thing, sleeping bags start to decay about 10 minutes after deployed, but decay.tick does not work on them. Every 2-3 minutes, 1hp is taken away from the sleeping bags.

using System.Linq;
using Oxide.Core;
using Oxide.Game.Rust.Cui;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("SleepingBagDecayPlugin", "YourName", "1.0.0")]
    class SleepingBagDecayPlugin : RustPlugin
    {
        void OnServerInitialized()
        {
            foreach (SleepingBag sleepingBag in BaseNetworkable.serverEntities.OfType<SleepingBag>())
            {
                ModifyDecayDelay(sleepingBag);
            }
        }

        void OnEntitySpawned(SleepingBag sleepingBag)
        {
            ModifyDecayDelay(sleepingBag);
        }

        void ModifyDecayDelay(SleepingBag sleepingBag)
        {
            (sleepingBag.decay as DeployableDecay).decayDelay = 0;
        }
    }
}​