global func get_stonks, old shop drops is not a variable

This commit is contained in:
Freeman 2023-08-18 06:17:47 +02:00
parent decf90ac92
commit f2f9cf9fc7
2 changed files with 7 additions and 10 deletions

@ -30,6 +30,6 @@ if income_enabled then
end end
dofile(modpath .. "/bank.lua") dofile(modpath .. "/bank.lua")
dofile(modpath .. "/fancyshop.lua")
dofile(modpath .. "/shop.lua") dofile(modpath .. "/shop.lua")
dofile(modpath .. "/fancyshop.lua")
dofile(modpath .. "/commands.lua") dofile(modpath .. "/commands.lua")

@ -117,7 +117,7 @@ local function check_empty(pos)
end end
end end
local function get_stonks(pos, player) function emeraldbank.get_stonks(pos, player)
local name = player:get_player_name() local name = player:get_player_name()
local meta = core.get_meta(pos) local meta = core.get_meta(pos)
local owner = meta:get_string("owner") 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 nodename = core.get_node(pos).name
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local pname = clicker:get_player_name() local pname = clicker:get_player_name()
get_stonks(pos, clicker) emeraldbank.get_stonks(pos, clicker)
--if nodename == "emeraldbank:shop" or 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) ) core.show_formspec(pname, formspec_prefix..core.pos_to_string(pos), emeraldbank.get_shop_fs(pos, clicker) )
--end --end
end end
local function on_punch(pos, node, puncher, pointed_thing) local function on_punch(pos, node, puncher, pointed_thing)
get_stonks(pos, puncher) emeraldbank.get_stonks(pos, puncher)
end end
local function on_metadata_inventory_put(pos, listname, index, stack, player) 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 if is_online then
local player = core.get_player_by_name(owner) local player = core.get_player_by_name(owner)
if not player or player.is_fake_player then return end if not player or player.is_fake_player then return end
get_stonks(pos, player) emeraldbank.get_stonks(pos, player)
end end
end end
@ -197,9 +197,7 @@ local function can_dig(pos, player)
local meta = core.get_meta(pos) local meta = core.get_meta(pos)
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local inv = meta:get_inventory() local inv = meta:get_inventory()
if inv:is_empty("stock") and (pname == owner or is_admin) then return inv:is_empty("stock") and (pname == owner or is_admin)
return true
end
end end
-- register shop node -- register shop node
@ -215,7 +213,6 @@ core.register_node("emeraldbank:shop", {
stack_max = 64, stack_max = 64,
groups = {axey=1, handy=1, building_block=1}, groups = {axey=1, handy=1, building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
drop = emeraldbank.shop_drop,
_mcl_blast_resistance = 5, _mcl_blast_resistance = 5,
_mcl_hardness = 1, _mcl_hardness = 1,
@ -242,7 +239,7 @@ core.register_node("emeraldbank:shop_empty", {
stack_max = 64, stack_max = 64,
groups = {axey=1, handy=1, building_block=1, not_in_creative_inventory=1}, groups = {axey=1, handy=1, building_block=1, not_in_creative_inventory=1},
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
drop = emeraldbank.shop_empty_drop, drop = "emeraldbank:shop",
_mcl_blast_resistance = 5, _mcl_blast_resistance = 5,
_mcl_hardness = 1, _mcl_hardness = 1,