wraithseeker
Tired.
- Reaction score
- 122
I'm sure if you request it in wc3c to have a item death event, vex will do it.
private function init takes nothing returns nothing
local timer T= CreateTimer()
call TimerStart(T, RECYCLE_INTERVAL, true, function recycleLoop)
endfunction
private function init takes nothing returns nothing
call TimerStart(CreateTimer(), RECYCLE_INTERVAL, true, function recycleLoop)
endfunction
The Event struct can be privatized and put directly into the system. The indexer does actually depend upon the item death event, too.
module IDEA
//Tweaks a struct to work exactly like the "//! runtextmacro PUI()" textmacro in PUI (duh).
private struct ItemData
trigger Trig
static method create takes item i returns ItemData
local ItemData this = ItemData.allocate()
call SetItemUserData(i, this)
set .Trig = CreateTrigger()
call TriggerRegisterDeathEvent(.Trig, i)
call TriggerAddCondition(.Trig, OnDeath)
return this
endmethod
private method onDestroy takes nothing returns nothing
call TriggerClearConditions(.Trig)
call DestroyTrigger(.Trig)
endmethod
endstruct
//...
function RemoveItemEx takes item i returns nothing
local ItemData d = GetItemUserData(i)
//call DestroyTrigger(d.Trig)
call d.destroy()
call RemoveItem(i)
endfunction
For the love of god, stop smearing on perfectly good things for no reason...No H2I