RustTip

OnVendingShopOpened

OxideVending
void OnVendingShopOpened(VendingMachine vendingMachine, BasePlayer player)
void OnVendingShopOpened(InvisibleVendingMachine invisibleVendingMachine, BasePlayer player)
void OnVendingShopOpened(NPCVendingMachine vendingMachine, BasePlayer player)
Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.

Parameters

vendingMachine
VendingMachine
player
BasePlayer

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnVendingShopOpened(VendingMachine vendingMachine, BasePlayer player)
{
    Puts("OnVendingShopOpened");
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point 1

Rust.opj (Oxide)
void VendingMachine.RPC_OpenShop(BaseEntity.RPCMessage)

Passes: VendingMachine vendingMachine, BasePlayer player

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, a0.player)Assembly-CSharp.dll

Injection point 2

Rust.opj (Oxide)
void NPCTalking.OnConversationAction(BasePlayer, string)

Passes: InvisibleVendingMachine invisibleVendingMachine, BasePlayer player

Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (l1, a0)Assembly-CSharp.dll

Where it is called (this branch's game code)

// …
	{
		ForceEndConversation(player);
		vendingMachine.PlayerOpenLoot(player, "vendingmachine.customer", doPositionChecks: false);
		return;
	}
}
ItemDefinition itemDefinition = ItemManager.FindItemDefinition("scrap");
NPCConversationResultAction[] array = conversationResultActions;
Interface.CallHook("OnVendingShopOpened", vendingMachine, player);
foreach (NPCConversationResultAction nPCConversationResultAction in array)
{
	if (!(nPCConversationResultAction.action == action))
	{
		continue;
	}
	CleanupConversingPlayers();
	foreach (BasePlayer conversingPlayer in ConversationHost.ConversingPlayers)
// …

Injection point 3

Rust.opj (Oxide)
void TravellingVendor.SV_OpenMenu(BaseEntity.RPCMessage)

Passes: NPCVendingMachine vendingMachine, BasePlayer player

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this.vendingMachine, a0.player)Assembly-CSharp.dll

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.