Hookpoints: ChestOpenReceived - SignatureBeef/Terraria-s-Dedicated-Server-Mod GitHub Wiki

Summary

When a chest is opened, this event is triggered.

Object Returned

Data Type Object Description
int X X coordinate of the chest.
int Y Y coordinate of the chest.
short ChestIndex The chest index.

Example

Lua

import ('Terraria') -- for Main class.

function YourPlugin:Initialized()
	export.Hooks = {}
	export.Hooks.ChestOpenReceived=
	{
		Call = export.OnChestOpenReceived,
	}
end

function YourPlugin:OnChestOpenReceived(ctx, args)
	Tools.WriteLine(Main.chest[args.ChestIndex].name)
end