Removing sleeping bag / bed timer?
Discussion in 'Rust Development' started by MachineGUID, Nov 8, 2016.
-
it's easy, see 'onentityspawn', and start timer, before restart set timer data
-
any tip on where to look in assembly?
-
-
[DOUBLEPOST=1479019047][/DOUBLEPOST]Found it nvm -
-
because its an internal variable unfortunately. -
-
-
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; } } }