1. Is it possible?
     
  2. it's easy, see 'onentityspawn', and start timer, before restart set timer data
     
  3. any tip on where to look in assembly?
     
  4. Telerik JustDecompile will do the work.
     
  5. I did but I'm looking around and don't see any info on any timer :|
    [DOUBLEPOST=1479019047][/DOUBLEPOST]Found it nvm
     
  6. See oxide docs #TIMERS
     
  7. Looked into it and setting the bag timer on first use is impossible....

    because its an internal variable unfortunately.
     
  8. Not impossible, you can use Reflection to obtain and change the value of the field.
     
  9. How? In order for it to work I would need to change reuse time variable before the bag calls onentityspawned because the variable that reflects the actual cooldown is an internal variable and I can't touch it...any help would be awesome I'm new to c# lol
     
  10. This is a simple example on how to use Reflection to obtain the unlockTime field and edit the value. The example will set the unlocktime to 0 when the bag is placed and set the time between uses to 0 as well to allow for constant use of the sleeping bags.

    Code:
    using System.Reflection;
    using UnityEngine;namespace Oxide.Plugins
    {
        [Info("Tests", "Mughisi", 1.0)]
        class Tests : RustPlugin
        {
            private readonly FieldInfo unlockTime = typeof(SleepingBag).GetField("unlockTime", BindingFlags.NonPublic | BindingFlags.Instance);        private void OnEntityBuilt(Planner planner, GameObject go)
            {
                var sleepingBag = go.GetComponent<SleepingBag>();
                if (!sleepingBag) return;
                unlockTime.SetValue(sleepingBag, 0);
                sleepingBag.secondsBetweenReuses = 0;
            }
        }
    }