OnGrowableGathered
OxideCarbonResourceCalled when a growable is gathered.
void OnGrowableGathered(GrowableEntity growableEntity, Item local0, BasePlayer player)Works — the game method in this build is the one the hook was written for.
Parameters
- growableEntity
- GrowableEntity
- local0
- Item
- player
- BasePlayer
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnGrowableGathered(GrowableEntity growableEntity, Item local0, BasePlayer player)
{
Puts("OnGrowableGathered");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void GrowableEntity.GiveFruit(BasePlayer, int, bool, bool)
Passes: GrowableEntity growableEntity, Item local0, BasePlayer player
WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l0, a0)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
if (component != null)
{
component.DoAction(item, player);
return;
}
}
if (player != null)
{
Interface.CallHook("OnGrowableGathered", this, item, player);
Analytics.Azure.OnGatherItem(item.info.shortname, item.amount, this, player);
player.GiveItem(item, GiveItemReason.ResourceHarvested, GiveItemOptions.BackpackOverflow);
}
else
{
item.Drop(transform.position + Vector3.up * 0.5f, Vector3.up * 1f);
}
}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.