@@ -87,7 +87,14 @@ function actor_binder:net_destroy()
8787
8888 ----| aVo |--------------------------------------------------------------------
8989 self.object:set_callback(callback.hit, nil)
90- --self.object:set_callback(123, nil)
90+ self.object:set_callback(callback.key_press, nil)
91+ self.object:set_callback(callback.key_release, nil)
92+ self.object:set_callback(callback.key_hold, nil)
93+ self.object:set_callback(callback.mouse_move, nil)
94+ self.object:set_callback(callback.mouse_wheel, nil)
95+ self.object:set_callback(callback.item_to_belt, nil)
96+ self.object:set_callback(callback.item_to_ruck, nil)
97+ self.object:set_callback(callback.item_to_slot, nil)
9198 ----| end:aVo |----------------------------------------------------------------
9299
93100 log("--------->"..tostring(_G.amb_vol))
@@ -126,22 +133,72 @@ function actor_binder:reinit()
126133
127134 ----| aVo |--------------------------------------------------------------------
128135 self.object:set_callback(callback.hit, self.actor_hit, self)
129- -- self.object:set_callback(123, self.key_press, self)
136+ self.object:set_callback(callback.key_press, self.key_press, self)
137+ self.object:set_callback(callback.key_release, self.key_release, self)
138+ self.object:set_callback(callback.key_hold, self.key_hold, self)
139+ self.object:set_callback(callback.mouse_move, self.mouse_move, self)
140+ self.object:set_callback(callback.mouse_wheel, self.mouse_wheel, self)
141+ self.object:set_callback(callback.item_to_ruck, self.item_to_ruck, self)
142+ self.object:set_callback(callback.item_to_belt, self.item_to_belt, self)
143+ self.object:set_callback(callback.item_to_slot, self.item_to_slot, self)
130144 ----| end:aVo |----------------------------------------------------------------
131145end
132146---------------------------------------------------------------------------------------------------------------------
133147
134148
135149----| aVo |--------------------------------------------------------------------
136- -- Actor hit callback
150+ -- actor hit callback
137151function actor_binder:actor_hit(obj, amount, local_direction, who, bone_index)
138152 -- local msg = string.format("actor_hit %f, %i", amount, bone_index)
139153 -- get_console():execute("load ~:"..msg)
140154end
141- -- x-ray extensions key press callback
142- --function actor_binder:key_press(key)
143- --sm:call("key_press", key)
144- --end
155+ -- key press callback
156+ function actor_binder:key_press(key)
157+ -- sm:call("key_press", key)
158+ -- log1(string.format("key pressed %d", key))
159+ if key == DIK_keys.DIK_F7 then
160+ log1("F7 pressed")
161+ end
162+ end
163+ -- key release callback (turn on in build_config_defines.h only if absolutely needed)
164+ function actor_binder:key_release(key)
165+ -- sm:call("key_release", key)
166+ -- log1(string.format("key released %d", key))
167+ if key == DIK_keys.DIK_F7 then
168+ log1("F7 released")
169+ end
170+ end
171+ -- key hold callback (turn on in build_config_defines.h only if absolutely needed)
172+ function actor_binder:key_hold(key)
173+ -- sm:call("key_hold", key)
174+ -- log1(string.format("key hold %d", key))
175+ if key == DIK_keys.DIK_F7 then
176+ log1("F7 hold")
177+ end
178+ end
179+ -- mouse move callback (turn on in build_config_defines.h only if absolutely needed)
180+ function actor_binder:mouse_move(dx, dy)
181+ log1(string.format("mouse moved to: [%d]:[%d]", dx, dy))
182+ end
183+ -- mouse wheel callback (direction is 120 up and -120 down)
184+ function actor_binder:mouse_wheel(direction)
185+ log1(string.format("mouse wheel moved %s", tostring(direction)))
186+ end
187+ -- item to ruck callback
188+ -- note: this is called on new game and level change
189+ function actor_binder:item_to_ruck(obj)
190+ log1(string.format("item_to_ruck [%s]", obj:name()))
191+ end
192+ -- item to belt callback
193+ -- note: this is called on new game and level change
194+ function actor_binder:item_to_belt(obj)
195+ log1(string.format("item_to_belt [%s]", obj:name()))
196+ end
197+ -- item to slot callback
198+ -- note: this is called on new game and level change
199+ function actor_binder:item_to_slot(obj)
200+ log1(string.format("item_to_slot [%s]", obj:name()))
201+ end
145202----------------------------------------------------------------------------------------------------------------------
146203function actor_binder:take_item_from_box(box, item)
147204 local box_name = box:name()
0 commit comments