Adding bones' drop feature Before, when you died, you got to punch you bones to get...
authorLeMagnesium <mg.minetest@gmail.com>
Tue, 3 Feb 2015 19:23:00 +0000 (20:23 +0100)
committerparamat <mat.gregory@virginmedia.com>
Tue, 29 Sep 2015 20:01:34 +0000 (21:01 +0100)
Thanks for reading.

mods/bones/init.lua

index f35d5192afe375095116d7dfaefdeede95302b7a..899ac809b2a4a8020602bd03f10479c6287adce6 100644 (file)
@@ -76,6 +76,10 @@ minetest.register_node("bones:bones", {
                        return
                end
                
+               if(minetest.get_meta(pos):get_string("infotext") == "") then
+                       return
+               end
+               
                local inv = minetest.get_meta(pos):get_inventory()
                local player_inv = player:get_inventory()
                local has_space = true
@@ -93,6 +97,11 @@ minetest.register_node("bones:bones", {
                
                -- remove bones if player emptied them
                if has_space then
+                       if player_inv:room_for_item("main", {name = "bones:bones"}) then
+                               player_inv:add_item("main", {name = "bones:bones"})
+                       else
+                               minetest.add_item(pos,"bones:bones")
+                       end
                        minetest.remove_node(pos)
                end
        end,