mirror of
https://git.minetest.land/Mineclonia/Mineclonia.git
synced 2024-11-24 11:35:10 +00:00
Drop crafting grid and armor on death
This commit is contained in:
parent
e3751d0931
commit
787568e5d6
1 changed files with 13 additions and 10 deletions
|
@ -2,16 +2,19 @@
|
||||||
minetest.register_on_dieplayer(function(player)
|
minetest.register_on_dieplayer(function(player)
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local pos = player:getpos()
|
local pos = player:getpos()
|
||||||
for i,stack in ipairs(inv:get_list("main")) do
|
local lists = { "main", "craft", "armor" }
|
||||||
local x = math.random(0, 9)/3
|
for l=1,#lists do
|
||||||
local z = math.random(0, 9)/3
|
for i,stack in ipairs(inv:get_list(lists[l])) do
|
||||||
pos.x = pos.x + x
|
local x = math.random(0, 9)/3
|
||||||
pos.z = pos.z + z
|
local z = math.random(0, 9)/3
|
||||||
minetest.add_item(pos, stack)
|
pos.x = pos.x + x
|
||||||
stack:clear()
|
pos.z = pos.z + z
|
||||||
inv:set_stack("main", i, stack)
|
minetest.add_item(pos, stack)
|
||||||
pos.x = pos.x - x
|
stack:clear()
|
||||||
pos.z = pos.z - z
|
inv:set_stack(lists[l], i, stack)
|
||||||
|
pos.x = pos.x - x
|
||||||
|
pos.z = pos.z - z
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
--end
|
--end
|
||||||
|
|
Loading…
Reference in a new issue