mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-03 04:20:02 -04:00
check inventory in boat.on_punch
This commit is contained in:
parent
0cf4fd4c18
commit
4f7a76a150
1 changed files with 6 additions and 2 deletions
|
@ -92,7 +92,12 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end)
|
end)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
puncher:get_inventory():add_item("main", "boats:boat")
|
local inv = puncher:get_inventory()
|
||||||
|
if inv:room_for_item("main", "boats:boat") then
|
||||||
|
inv:add_item("main", "boats:boat")
|
||||||
|
else
|
||||||
|
minetest.add_item(self.object:getpos(), "boats:boat")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -214,4 +219,3 @@ minetest.register_craft({
|
||||||
{"group:wood", "group:wood", "group:wood"},
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue