mirror of
https://github.com/minetest-mods/item_drop.git
synced 2024-12-22 22:02:26 +01:00
Support the moveresult parameter of on_step
The parameter is available in Minetest 5.3.0-dev. thanks to sofar and VanessaE for the fix and report
This commit is contained in:
parent
7cb8086a25
commit
72f4225058
6
init.lua
6
init.lua
@ -201,9 +201,9 @@ if legacy_setting_getbool("item_drop.enable_item_pickup",
|
|||||||
local itemdef = minetest.registered_entities["__builtin:item"]
|
local itemdef = minetest.registered_entities["__builtin:item"]
|
||||||
local old_on_step = itemdef.on_step
|
local old_on_step = itemdef.on_step
|
||||||
local function do_nothing() end
|
local function do_nothing() end
|
||||||
function itemdef.on_step(self, dtime)
|
function itemdef.on_step(self, ...)
|
||||||
if not self.is_magnet_item then
|
if not self.is_magnet_item then
|
||||||
return old_on_step(self, dtime)
|
return old_on_step(self, ...)
|
||||||
end
|
end
|
||||||
ObjectRef = ObjectRef or getmetatable(self.object)
|
ObjectRef = ObjectRef or getmetatable(self.object)
|
||||||
local old_funcs = {}
|
local old_funcs = {}
|
||||||
@ -212,7 +212,7 @@ if legacy_setting_getbool("item_drop.enable_item_pickup",
|
|||||||
old_funcs[method] = ObjectRef[method]
|
old_funcs[method] = ObjectRef[method]
|
||||||
ObjectRef[method] = do_nothing
|
ObjectRef[method] = do_nothing
|
||||||
end
|
end
|
||||||
old_on_step(self, dtime)
|
old_on_step(self, ...)
|
||||||
for i = 1, #blocked_methods do
|
for i = 1, #blocked_methods do
|
||||||
local method = blocked_methods[i]
|
local method = blocked_methods[i]
|
||||||
ObjectRef[method] = old_funcs[method]
|
ObjectRef[method] = old_funcs[method]
|
||||||
|
Loading…
Reference in New Issue
Block a user