mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-03-21 15:21:21 +00:00
Boats: Check inventory in boat.on_punch
If puncher inventory is full, then drop boat
This commit is contained in:
parent
b292975fbc
commit
f3dc78204c
1 changed files with 6 additions and 1 deletions
|
@ -105,7 +105,12 @@ function boat.on_punch(self, puncher, time_from_last_punch,
|
||||||
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue