Code: Select all
function dlog(text)
__log(text)
dsb_write(debug_color, text )
end
function log_on_remove(self,id,who)
dlog("MOVED : " .. id)
end
obj.silk_shirt.after_from_torso=log_on_remove
obj.tabard.after_from_legs=log_on_remove
-- callback for M_NEXTTICK
function test_on_tick(id, data)
dlog("CALL0")
dsb_move(2,0,3,4,3) -- refers to a worn shirt
dlog("CALL1")
dsb_move(3,0,3,4,3) -- refers to a worn tabard
dlog("CALL2")
end
Answer: It depends on when it is called...
Code: Select all
function test_after_remove(self,id,who)
dsb_msg(0,id,M_NEXTTICK,0)
end
function method_trigger(name, ppos, who, what)
dsb_msg(0,what,M_NEXTTICK,0)
end
obj.testcase=clone_arch(obj.dagger, {
after_from_r_hand=test_after_remove,
msg_handler={[M_NEXTTICK]=test_on_tick},
methods = {
{ "THROW", 0, CLASS_NINJA, method_throw_obj },
{ "TRIGGER", 0, CLASS_NINJA, method_trigger }
}
})
Lua: CALL0
Lua: MOVED : 2
Lua: CALL1
Lua: MOVED : 3
Lua: CALL2
From the remove callback:
Lua: CALL0
Lua: CALL1
Lua: CALL2
Lua: MOVED : 2
Lua: MOVED : 3
OK I can see why it could wind up working that way, but it sure makes understanding the system challenging...