obj/considered/redeploybox/button/spin
var/mousetimer/timer
army/icon_state="spinunit"
rsc/icon_state="spinrsc"
Click()
// this overrides obj/considered/Click()
// which calls C.Click(src); C is a /consider datum
MouseDown()
C.Click(src)
timer=new(10,usr.client,src,"Trigger")
MouseDrop()
if(timer) del(timer)
MouseUp()
if(timer) del(timer)
proc/Trigger()
C.Click(src)
if(!timer || !C || !C.owner || !C.owner.mob || timer.client!=C.owner.mob.client)
if(timer) del(timer)
return
timer.delay=max(2,timer.delay-2)
timer.Reset()
mousetimer
var/obj/O
var/procname
var/delay=10
var/client/client
var/theargs
New(_delay,client/C,obj/_O,_procname,_args)
O=_O
procname=_procname
delay=_delay
client=C
theargs=_args
Reset()
proc/Reset()
sleep(delay)
if(O)
spawn(-1) call(O,procname)(theargs)
else del(src)
Lummox JR
You had better spawn that call to Reset() in New(). Otherwise, new() won't return to the caller until after the sleep finishes, so the object's timer variable might not get set before the MouseUp() event.
Also, I just thought it was worth mentioning that you could accept any number of additional args, make a list out of them, and pass that to your callback via call(O,procname)(arglist(theargs)).