OnSleepingBagDestroy
OxideCarbonEntityobject OnSleepingBagDestroy(SleepingBag sleepingBag, ulong userID)Works — the game method in this build is the one the hook was written for.
Parameters
- sleepingBag
- SleepingBag
- userID
- ulong
Return value
objectReturn non-null to stop the game method.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnSleepingBagDestroy(SleepingBag sleepingBag, ulong userID)
{
Puts("OnSleepingBagDestroy");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return false; // non-null cancels the game action
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
bool SleepingBag.DestroyBag(ulong, NetworkableId)
Passes: SleepingBag sleepingBag, ulong userID
WorksReturnBehavior: ExitWhenNonNullAssembly-CSharp.dll
Where it is called (this branch's game code)
// …
sleepingBag2 = item;
break;
}
}
if (sleepingBag2 == null)
{
return false;
}
if (Interface.CallHook("OnSleepingBagDestroy", sleepingBag2, userID) != null)
{
return false;
}
RemoveBagForPlayer(sleepingBag2, sleepingBag2.deployerUserID);
sleepingBag2.deployerUserID = 0uL;
if (sleepingBag2.HasFlag(Flags.Reserved14))
{
sleepingBag2.Kill();
// …Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.