Skip to content

OnVendingShopOpen

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnVendingShopOpen( InvisibleVendingMachine itemDefinition, BasePlayer player )
{
    Puts( "OnVendingShopOpen works!" );
}
csharp
private void OnVendingShopOpen( NPCVendingMachine vendingMachine, BasePlayer player )
{
    Puts( "OnVendingShopOpen works!" );
}
csharp
private void OnVendingShopOpen( VendingMachine instance, BasePlayer player )
{
    Puts( "OnVendingShopOpen works!" );
}

Location

  • NPCTalking::OnConversationAction(BasePlayer player, string action)
  • TravellingVendor::SV_OpenMenu(BaseEntity/RPCMessage msg)
  • VendingMachine::RPC_OpenShop(BaseEntity/RPCMessage msg)
csharp
//---
	{
		InvisibleVendingMachine vendingMachine = base.GetVendingMachine();
		if (vendingMachine != null && Vector3.Distance(player.transform.position, base.transform.position) < 5f)
		{
			this.ForceEndConversation(player);
			if (Interface.CallHook("OnVendingShopOpen", vendingMachine, player) != null)
			{
				return;
			}
			vendingMachine.PlayerOpenLoot(player, "vendingmachine.customer", false);
			return;
//---
csharp
//---
{
	if (this.vendingMachine == null)
	{
		this.vendingMachine = base.GetComponentInChildren<NPCVendingMachine>();
	}
	if (Interface.CallHook("OnVendingShopOpen", this.vendingMachine, msg.player) != null)
	{
		return;
	}
	this.vendingMachine.OpenShop(msg.player);
}
csharp
//---
{
	if (!base.OccupiedCheck(msg.player))
	{
		return;
	}
	if (Interface.CallHook("OnVendingShopOpen", this, msg.player) != null)
	{
		return;
	}
	this.OpenShop(msg.player);
}

Released under the MIT License.