Skip to content

Commit

Permalink
Boats: Check inventory in boat.on_punch
Browse files Browse the repository at this point in the history
If puncher inventory is full, then drop boat
  • Loading branch information
paramat committed Oct 19, 2015
1 parent b292975 commit f3dc782
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mods/boats/init.lua
Expand Up @@ -105,7 +105,12 @@ function boat.on_punch(self, puncher, time_from_last_punch,
self.object:remove()
end)
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
Expand Down

2 comments on commit f3dc782

@kilbith
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git commit --amend --author "Author Name <email@address.com>"

... to attribute a commit to its real author.

@paramat
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Please sign in to comment.