Skip to content
This repository was archived by the owner on Dec 14, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f4594af

Browse files
arsdragonflyBlockMen
authored andcommittedJul 1, 2014
Don't create bones if the player's inventory is empty
1 parent 8a0d51b commit f4594af

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
 

Diff for: ‎mods/bones/init.lua

+8-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ minetest.register_node("bones:bones", {
5151

5252
on_metadata_inventory_take = function(pos, listname, index, stack, player)
5353
local meta = minetest.get_meta(pos)
54-
if meta:get_string("owner") ~= "" and meta:get_inventory():is_empty("main") then
55-
meta:set_string("infotext", meta:get_string("owner").."'s old bones")
56-
meta:set_string("formspec", "")
57-
meta:set_string("owner", "")
54+
if meta:get_inventory():is_empty("main") then
55+
minetest.remove_node(pos)
5856
end
5957
end,
6058

@@ -108,6 +106,12 @@ minetest.register_on_dieplayer(function(player)
108106
return
109107
end
110108

109+
local player_inv = player:get_inventory()
110+
if player_inv:is_empty("main") and
111+
player_inv:is_empty("craft") then
112+
return
113+
end
114+
111115
local pos = player:getpos()
112116
pos.x = math.floor(pos.x+0.5)
113117
pos.y = math.floor(pos.y+0.5)

0 commit comments

Comments
 (0)
This repository has been archived.