From f2f9cf9fc76c07077d9323e2cb3f3de92d7976f9 Mon Sep 17 00:00:00 2001 From: Freeman Date: Fri, 18 Aug 2023 06:17:47 +0200 Subject: [PATCH] global func get_stonks, old shop drops is not a variable --- init.lua | 2 +- shop.lua | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index cc40a69..74f7707 100644 --- a/init.lua +++ b/init.lua @@ -30,6 +30,6 @@ if income_enabled then end dofile(modpath .. "/bank.lua") -dofile(modpath .. "/fancyshop.lua") dofile(modpath .. "/shop.lua") +dofile(modpath .. "/fancyshop.lua") dofile(modpath .. "/commands.lua") diff --git a/shop.lua b/shop.lua index 0364eff..a9e9adc 100644 --- a/shop.lua +++ b/shop.lua @@ -117,7 +117,7 @@ local function check_empty(pos) end end -local function get_stonks(pos, player) +function emeraldbank.get_stonks(pos, player) local name = player:get_player_name() local meta = core.get_meta(pos) local owner = meta:get_string("owner") @@ -152,14 +152,14 @@ local function on_rightclick(pos, node, clicker, itemstack) local nodename = core.get_node(pos).name local owner = meta:get_string("owner") local pname = clicker:get_player_name() - get_stonks(pos, clicker) + emeraldbank.get_stonks(pos, clicker) --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 local function on_punch(pos, node, puncher, pointed_thing) - get_stonks(pos, puncher) + emeraldbank.get_stonks(pos, puncher) end local function on_metadata_inventory_put(pos, listname, index, stack, player) @@ -187,7 +187,7 @@ local function on_timer(pos, elapsed) if is_online then local player = core.get_player_by_name(owner) if not player or player.is_fake_player then return end - get_stonks(pos, player) + emeraldbank.get_stonks(pos, player) end end @@ -197,9 +197,7 @@ local function can_dig(pos, player) local meta = core.get_meta(pos) local owner = meta:get_string("owner") local inv = meta:get_inventory() - if inv:is_empty("stock") and (pname == owner or is_admin) then - return true - end + return inv:is_empty("stock") and (pname == owner or is_admin) end -- register shop node @@ -215,7 +213,6 @@ core.register_node("emeraldbank:shop", { stack_max = 64, groups = {axey=1, handy=1, building_block=1}, sounds = mcl_sounds.node_sound_wood_defaults(), - drop = emeraldbank.shop_drop, _mcl_blast_resistance = 5, _mcl_hardness = 1, @@ -242,7 +239,7 @@ core.register_node("emeraldbank:shop_empty", { stack_max = 64, groups = {axey=1, handy=1, building_block=1, not_in_creative_inventory=1}, sounds = mcl_sounds.node_sound_wood_defaults(), - drop = emeraldbank.shop_empty_drop, + drop = "emeraldbank:shop", _mcl_blast_resistance = 5, _mcl_hardness = 1,