1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 18:20:36 +01:00

Add a chatcommand to clear graveyard inventory

This commit is contained in:
LeMagnesium 2015-08-26 15:29:40 +02:00
parent a3ce7b3157
commit 58b76ff1e5

View File

@ -48,11 +48,21 @@ unified_inventory.register_page("graveyard", {
get_formspec = function(player) get_formspec = function(player)
local pname = player:get_player_name() local pname = player:get_player_name()
local form = "label[0,0;Graveyard]" .. local form = "label[0,0;Graveyard]" ..
"list[detached:" .. pname .. "_graveyard;graveyard;1,1;7,8]" "list[detached:" .. pname .. "_graveyard;graveyard;0.5,0.7;7,8]"
return {formspec = form, draw_inventory = false} return {formspec = form, draw_inventory = false}
end end
}) })
minetest.register_chatcommand("clear_graveyard", {
description = "Clear Graveyard Inventory",
privs = {},
func = function(name, param)
local grave_inv = minetest.get_inventory({type = "detached", name = name .. "_graveyard"})
grave_inv:set_list("graveyard", {})
return true, "Graveyard flushed"
end,
})
function pclasses.api.vacuum_graveyard(player) function pclasses.api.vacuum_graveyard(player)
local pname = player:get_player_name() local pname = player:get_player_name()
local grave_inv = minetest.get_inventory({type = "detached", name = pname .. "_graveyard"}) local grave_inv = minetest.get_inventory({type = "detached", name = pname .. "_graveyard"})