From 787568e5d6ac4e4754bea4b9e1b3e2d7de975116 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 1 Mar 2017 23:26:46 +0100 Subject: [PATCH] Drop crafting grid and armor on death --- mods/PLAYER/mcl_death/init.lua | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mods/PLAYER/mcl_death/init.lua b/mods/PLAYER/mcl_death/init.lua index 0c7959f92b..c33282b107 100644 --- a/mods/PLAYER/mcl_death/init.lua +++ b/mods/PLAYER/mcl_death/init.lua @@ -2,16 +2,19 @@ minetest.register_on_dieplayer(function(player) local inv = player:get_inventory() local pos = player:getpos() - for i,stack in ipairs(inv:get_list("main")) do - local x = math.random(0, 9)/3 - local z = math.random(0, 9)/3 - pos.x = pos.x + x - pos.z = pos.z + z - minetest.add_item(pos, stack) - stack:clear() - inv:set_stack("main", i, stack) - pos.x = pos.x - x - pos.z = pos.z - z + local lists = { "main", "craft", "armor" } + for l=1,#lists do + for i,stack in ipairs(inv:get_list(lists[l])) do + local x = math.random(0, 9)/3 + local z = math.random(0, 9)/3 + pos.x = pos.x + x + pos.z = pos.z + z + minetest.add_item(pos, stack) + stack:clear() + inv:set_stack(lists[l], i, stack) + pos.x = pos.x - x + pos.z = pos.z - z + end end end) --end