mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 09:31:07 +01:00
Put boat/minecart in inv when punched in creative
This commit is contained in:
parent
4bd9be22e0
commit
d59d789c80
2 changed files with 12 additions and 0 deletions
|
@ -132,6 +132,11 @@ function boat.on_punch(self, puncher)
|
||||||
-- Drop boat as item on the ground after punching
|
-- Drop boat as item on the ground after punching
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.settings:get_bool("creative_mode") then
|
||||||
minetest.add_item(self.object:get_pos(), self._itemstring)
|
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
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,6 +85,13 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
|
||||||
for d=1, #drop do
|
for d=1, #drop do
|
||||||
minetest.add_item(self.object:get_pos(), drop[d])
|
minetest.add_item(self.object:get_pos(), drop[d])
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
Loading…
Reference in a new issue