forked from VoxeLibre/VoxeLibre
Put boat/minecart in inv when punched in creative
This commit is contained in:
parent
4bd9be22e0
commit
d59d789c80
|
@ -132,6 +132,11 @@ function boat.on_punch(self, puncher)
|
|||
-- Drop boat as item on the ground after punching
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
minetest.add_item(self.object:get_pos(), self._itemstring)
|
||||
else
|
||||
local inv = puncher:get_inventory()
|
||||
if not inv:contains_item("main", self._itemstring) then
|
||||
inv:add_item("main", self._itemstring)
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
|
|
|
@ -85,6 +85,13 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
|
|||
for d=1, #drop do
|
||||
minetest.add_item(self.object:get_pos(), drop[d])
|
||||
end
|
||||
elseif puncher and puncher:is_player() then
|
||||
local inv = puncher:get_inventory()
|
||||
for d=1, #drop do
|
||||
if not inv:contains_item("main", drop[d]) then
|
||||
inv:add_item("main", drop[d])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.object:remove()
|
||||
|
|
Loading…
Reference in New Issue