File tree Expand file tree Collapse file tree
config/fxdata/lua/triggers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22-- Entry points for engine-triggered events (e.g. OnPowerCast, OnGameTick).
33-- These functions are called by the C engine and dispatch event data to the Lua trigger system.
44
5- --- @alias event_type " PowerCast" | " Death" | " SpecialActivated" | " GameTick" | " ChatMsg" | " DungeonDestroyed" | " TrapPlaced" | " ApplyDamage" | " LevelUp" | " Rebirth" | " SlabKindChange" | " SlabOwnerChange" | " RoomOwnerChange" | " ShotHitThing"
5+ --- @alias event_type " PowerCast" | " Death" | " SpecialActivated" | " GameTick" | " ChatMsg" | " DungeonDestroyed" | " TrapPlaced" | " ApplyDamage" | " LevelUp" | " Rebirth" | " SlabKindChange" | " SlabOwnerChange" | " RoomOwnerChange" | " ShotHitThing" | " Destroyed "
66
77--- Called when a spell is cast on a unit
88--- @param pwkind power_kind
@@ -31,10 +31,10 @@ function OnCreatureDeath(unit)
3131end
3232
3333--- Called when an object is destroyed
34- --- @param unit Object The unit that dies
35- function OnObjectDestroyed (unit )
34+ --- @param object Object The object that is destroyed
35+ function OnObjectDestroyed (object )
3636 local eventData = {}
37- eventData .unit = unit
37+ eventData .object = object
3838 ProcessEvent (" Destroyed" ,eventData )
3939end
4040
Original file line number Diff line number Diff line change @@ -119,10 +119,10 @@ end
119119--- @param object ? Object the object that triggers the event
120120--- @return table
121121function RegisterObjectDestroyedEvent (action , object )
122- local trigData = {thing = object }
122+ local trigData = {object = object }
123123
124124 local trigger = CreateTrigger (" Destroyed" ,action ,trigData )
125- if unit then
125+ if object then
126126 TriggerAddCondition (trigger , function (eventData ,triggerData ) return eventData .object == triggerData .object end )
127127 end
128128 return trigger
You can’t perform that action at this time.
0 commit comments