mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-25 04:13:44 +01:00
Fix on_pick_up api
accepts a returned itemstring from the callback now
This commit is contained in:
parent
79265a596b
commit
8cb73ee509
@ -3133,7 +3133,12 @@ local function check_item_pickup(self)
|
|||||||
if l and l.name == "__builtin:item" then
|
if l and l.name == "__builtin:item" then
|
||||||
for k,v in pairs(self.pick_up) do
|
for k,v in pairs(self.pick_up) do
|
||||||
if not player_near(p) and self.on_pick_up and l.itemstring:find(v) then
|
if not player_near(p) and self.on_pick_up and l.itemstring:find(v) then
|
||||||
if self.on_pick_up(self,l) == nil then o:remove() end
|
local r = self.on_pick_up(self,l)
|
||||||
|
if r then
|
||||||
|
l.itemstring = r:to_string()
|
||||||
|
else
|
||||||
|
o:remove()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user