From 1b19afc7993d47d6db9fa09b389b7682d20b6508 Mon Sep 17 00:00:00 2001 From: Freeman Date: Tue, 20 Dec 2022 20:29:27 +0100 Subject: [PATCH] swap_shop func fix --- shop.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/shop.lua b/shop.lua index be93146..881669f 100644 --- a/shop.lua +++ b/shop.lua @@ -86,7 +86,7 @@ local function swap_shop(pos, closed) local oldnode = core.get_node(pos) local oldnodemeta = core.get_meta(pos):to_table() local nodename = core.get_node(pos).name - if nodename == "emeraldbank:shop" and closed then + if closed then core.swap_node(pos, {name = "emeraldbank:shop_empty"}) else core.swap_node(pos, {name = "emeraldbank:shop"}) @@ -153,7 +153,7 @@ local function on_rightclick(pos, node, clicker, itemstack) local owner = meta:get_string("owner") local pname = clicker:get_player_name() get_stonks(pos, clicker) - --if nodename == "emeraldbank:shop" and pname == owner then + --if nodename == "emeraldbank:shop" or pname == owner then core.show_formspec(pname, formspec_prefix..core.pos_to_string(pos), emeraldbank.get_shop_fs(pos, clicker) ) --end end @@ -163,14 +163,12 @@ local function on_punch(pos, node, puncher, pointed_thing) end local function on_metadata_inventory_put(pos, listname, index, stack, player) - set_item(pos, stack, player) + set_item(pos, stack, player) -- this func already show the fs check_empty(pos) - --core.show_formspec(player:get_player_name(), formspec_prefix..core.pos_to_string(pos), emeraldbank.get_shop_fs(pos, player) ) end local function on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) check_empty(pos) - --core.show_formspec(player:get_player_name(), formspec_prefix..core.pos_to_string(pos), emeraldbank.get_shop_fs(pos, player) ) end