added custom treasure chest

This commit is contained in:
cale 2016-12-28 11:08:51 +01:00
parent 5bea54276c
commit c4b0a116bb
3 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1 @@
default

View File

@ -15,3 +15,42 @@ minetest.register_on_generated(function(minp, maxp, seed)
end, table.copy(g.dungeon))
end
end)
local chest_form = "size[8,7]"
local chest_form = chest_form..default.gui_colors
local chest_form = chest_form..default.gui_bg
local chest_form = chest_form.."list[current_name;main;0,0.3;8,2;]"
local chest_form = chest_form..default.itemslot_bg(0,0.3,8,2)
local chest_form = chest_form.."list[current_player;main;0,2.85;8,1;]"
local chest_form = chest_form..default.itemslot_bg(0,2.85,8,1)
local chest_form = chest_form.."list[current_player;main;0,4.08;8,3;8]"
local chest_form = chest_form..default.itemslot_bg(0,4.08,8,3)
local chest_form = chest_form.."listring[current_name;main]"
local chest_form = chest_form.."listring[current_player;main]"
minetest.register_node("dungeons:custom_treasure_chest", {
description = "Custom Treasure Chest",
tiles = {"default_treasure_chest.png"},
groups = {choppy = 3},
after_place_node = function(pos, placer, itemstack, pt)
local name = placer:get_player_name()
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("main", 8 * 2)
meta:set_string("owner", name)
meta:set_string("infotext", "Custom Treasure Chest (" .. name .. ")")
meta:set_string("formspec", chest_form)
itemstack:take_item()
return itemstack
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local name = player:get_player_name()
end,
})

View File

@ -15,7 +15,9 @@ money.shop.page = {}
money.shop.offers = {
{input="money:silver_coin", output="default:coal_lump"},
{input="money:silver_coin 2", output="default:box"},
{input="money:coin 1", output="default:pick"}
{input="money:coin 1", output="default:pick"},
{input="money:silver_coin 4", output="dungeons:custom_treasure_chest"},
{input="default:stone_item 891", output="money:silver_coin 5"}
}
function money.shop.get_formspec(page)