swap_shop func fix

This commit is contained in:
Freeman 2022-12-20 20:29:27 +01:00
parent 41fa30ee22
commit 1b19afc799

@ -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