Permalink
Browse files

Don't create bones if the player's inventory is empty

  • Loading branch information...
1 parent 8a0d51b commit f4594af0b1c9c5ae70a4fa7cb1b178f62921124a @arsdragonfly arsdragonfly committed with Jun 14, 2014
Showing with 8 additions and 4 deletions.
  1. +8 −4 mods/bones/init.lua
View
@@ -51,10 +51,8 @@ minetest.register_node("bones:bones", {
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
- if meta:get_string("owner") ~= "" and meta:get_inventory():is_empty("main") then
- meta:set_string("infotext", meta:get_string("owner").."'s old bones")
- meta:set_string("formspec", "")
- meta:set_string("owner", "")
+ if meta:get_inventory():is_empty("main") then
+ minetest.remove_node(pos)
end
end,
@@ -108,6 +106,12 @@ minetest.register_on_dieplayer(function(player)
return
end
+ local player_inv = player:get_inventory()
+ if player_inv:is_empty("main") and
+ player_inv:is_empty("craft") then
+ return
+ end
+
local pos = player:getpos()
pos.x = math.floor(pos.x+0.5)
pos.y = math.floor(pos.y+0.5)

0 comments on commit f4594af

Please sign in to comment.