fix bad line endings (DOS -> Unix)

This commit is contained in:
Vanessa Dannenberg 2018-09-21 18:27:03 -04:00
parent 11643571f2
commit cd3a41dd7d
8 changed files with 755 additions and 755 deletions

@ -1,36 +1,36 @@
Minegeld Minegeld
--------- ---------
They have no recipe. They have no recipe.
In general, one Mg equals one US dollar, as of Sept. 2018. In general, one Mg equals one US dollar, as of Sept. 2018.
A good starting amount is about 250Mg on a server A good starting amount is about 250Mg on a server
You currently get a basic income of 10 Minegeld per day, You currently get a basic income of 10 Minegeld per day,
so long as you dig at least one node in that day so long as you dig at least one node in that day
and have an empty inventory slot for the money to go in. and have an empty inventory slot for the money to go in.
Lump Conversion Lump Conversion
Coal Lump ~1Mg Coal Lump ~1Mg
Iron Lump ~4Mg Iron Lump ~4Mg
Copper Lump ~4Mg Copper Lump ~4Mg
Gold Lump ~5Mg Gold Lump ~5Mg
Mese Crystal ~40Mg Mese Crystal ~40Mg
Diamond ~50Mg Diamond ~50Mg
Ingot Conversion Ingot Conversion
Steel Ingot ~5Mg Steel Ingot ~5Mg
Copper Ingot ~5Mg Copper Ingot ~5Mg
Gold Ingot ~6Mg Gold Ingot ~6Mg
Block Conversion Block Conversion
Coal Block ~9Mg Coal Block ~9Mg
Steel Block ~45Mg Steel Block ~45Mg
Copper Block ~45Mg Copper Block ~45Mg
Gold Block ~54Mg Gold Block ~54Mg
Mese Block ~360Mg Mese Block ~360Mg
Diamond Block ~450Mg Diamond Block ~450Mg

@ -1,169 +1,169 @@
barter = {} barter = {}
-- internationalization boilerplate -- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname()) local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua") local S, NS = dofile(MP.."/intllib.lua")
barter.chest = {} barter.chest = {}
barter.chest.formspec = { barter.chest.formspec = {
main = "size[8,9]".. main = "size[8,9]"..
"list[current_name;pl1;0,0;3,4;]".. "list[current_name;pl1;0,0;3,4;]"..
"list[current_name;pl2;5,0;3,4;]".. "list[current_name;pl2;5,0;3,4;]"..
"list[current_player;main;0,5;8,4;]", "list[current_player;main;0,5;8,4;]",
pl1 = { pl1 = {
start = "button[3,1;1,1;pl1_start;" .. S("Start") .. "]", start = "button[3,1;1,1;pl1_start;" .. S("Start") .. "]",
player = function(name) return "label[3,0;"..name.."]" end, player = function(name) return "label[3,0;"..name.."]" end,
accept1 = "button[3,1;1,1;pl1_accept1;" .. S("Confirm") .. "]".. accept1 = "button[3,1;1,1;pl1_accept1;" .. S("Confirm") .. "]"..
"button[3,2;1,1;pl1_cancel;" .. S("Cancel") .. "]", "button[3,2;1,1;pl1_cancel;" .. S("Cancel") .. "]",
accept2 = "button[3,1;1,1;pl1_accept2;" .. S("Exchange") .. "]".. accept2 = "button[3,1;1,1;pl1_accept2;" .. S("Exchange") .. "]"..
"button[3,2;1,1;pl1_cancel;" .. S("Cancel") .. "]", "button[3,2;1,1;pl1_cancel;" .. S("Cancel") .. "]",
}, },
pl2 = { pl2 = {
start = "button[4,1;1,1;pl2_start;" .. S("Start") .. "]", start = "button[4,1;1,1;pl2_start;" .. S("Start") .. "]",
player = function(name) return "label[4,0;"..name.."]" end, player = function(name) return "label[4,0;"..name.."]" end,
accept1 = "button[4,1;1,1;pl2_accept1;" .. S("Confirm") .. "]".. accept1 = "button[4,1;1,1;pl2_accept1;" .. S("Confirm") .. "]"..
"button[4,2;1,1;pl2_cancel;" .. S("Cancel") .. "]", "button[4,2;1,1;pl2_cancel;" .. S("Cancel") .. "]",
accept2 = "button[4,1;1,1;pl2_accept2;" .. S("Exchange") .. "]".. accept2 = "button[4,1;1,1;pl2_accept2;" .. S("Exchange") .. "]"..
"button[4,2;1,1;pl2_cancel;" .. S("Cancel") .. "]", "button[4,2;1,1;pl2_cancel;" .. S("Cancel") .. "]",
}, },
} }
barter.chest.check_privilege = function(listname,playername,meta) barter.chest.check_privilege = function(listname,playername,meta)
if listname == "pl1" then if listname == "pl1" then
if playername ~= meta:get_string("pl1") then if playername ~= meta:get_string("pl1") then
return false return false
elseif meta:get_int("pl1step") ~= 1 then elseif meta:get_int("pl1step") ~= 1 then
return false return false
end end
end end
if listname == "pl2" then if listname == "pl2" then
if playername ~= meta:get_string("pl2") then if playername ~= meta:get_string("pl2") then
return false return false
elseif meta:get_int("pl2step") ~= 1 then elseif meta:get_int("pl2step") ~= 1 then
return false return false
end end
end end
return true return true
end end
barter.chest.update_formspec = function(meta) barter.chest.update_formspec = function(meta)
formspec = barter.chest.formspec.main formspec = barter.chest.formspec.main
pl_formspec = function (n) pl_formspec = function (n)
if meta:get_int(n.."step")==0 then if meta:get_int(n.."step")==0 then
formspec = formspec .. barter.chest.formspec[n].start formspec = formspec .. barter.chest.formspec[n].start
else else
formspec = formspec .. barter.chest.formspec[n].player(meta:get_string(n)) formspec = formspec .. barter.chest.formspec[n].player(meta:get_string(n))
if meta:get_int(n.."step") == 1 then if meta:get_int(n.."step") == 1 then
formspec = formspec .. barter.chest.formspec[n].accept1 formspec = formspec .. barter.chest.formspec[n].accept1
elseif meta:get_int(n.."step") == 2 then elseif meta:get_int(n.."step") == 2 then
formspec = formspec .. barter.chest.formspec[n].accept2 formspec = formspec .. barter.chest.formspec[n].accept2
end end
end end
end end
pl_formspec("pl1") pl_formspec("pl2") pl_formspec("pl1") pl_formspec("pl2")
meta:set_string("formspec",formspec) meta:set_string("formspec",formspec)
end end
barter.chest.give_inventory = function(inv,list,playername) barter.chest.give_inventory = function(inv,list,playername)
player = minetest.get_player_by_name(playername) player = minetest.get_player_by_name(playername)
if player then if player then
for k,v in ipairs(inv:get_list(list)) do for k,v in ipairs(inv:get_list(list)) do
player:get_inventory():add_item("main",v) player:get_inventory():add_item("main",v)
inv:remove_item(list,v) inv:remove_item(list,v)
end end
end end
end end
barter.chest.cancel = function(meta) barter.chest.cancel = function(meta)
barter.chest.give_inventory(meta:get_inventory(),"pl1",meta:get_string("pl1")) barter.chest.give_inventory(meta:get_inventory(),"pl1",meta:get_string("pl1"))
barter.chest.give_inventory(meta:get_inventory(),"pl2",meta:get_string("pl2")) barter.chest.give_inventory(meta:get_inventory(),"pl2",meta:get_string("pl2"))
meta:set_string("pl1","") meta:set_string("pl1","")
meta:set_string("pl2","") meta:set_string("pl2","")
meta:set_int("pl1step",0) meta:set_int("pl1step",0)
meta:set_int("pl2step",0) meta:set_int("pl2step",0)
end end
barter.chest.exchange = function(meta) barter.chest.exchange = function(meta)
barter.chest.give_inventory(meta:get_inventory(),"pl1",meta:get_string("pl2")) barter.chest.give_inventory(meta:get_inventory(),"pl1",meta:get_string("pl2"))
barter.chest.give_inventory(meta:get_inventory(),"pl2",meta:get_string("pl1")) barter.chest.give_inventory(meta:get_inventory(),"pl2",meta:get_string("pl1"))
meta:set_string("pl1","") meta:set_string("pl1","")
meta:set_string("pl2","") meta:set_string("pl2","")
meta:set_int("pl1step",0) meta:set_int("pl1step",0)
meta:set_int("pl2step",0) meta:set_int("pl2step",0)
end end
minetest.register_node("currency:barter", { minetest.register_node("currency:barter", {
drawtype = "nodebox", drawtype = "nodebox",
description = S("Barter Table"), description = S("Barter Table"),
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
tiles = {"barter_top.png", tiles = {"barter_top.png",
"barter_base.png", "barter_base.png",
"barter_side.png"}, "barter_side.png"},
inventory_image = "barter_top.png", inventory_image = "barter_top.png",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.500000,0.312500,-0.500000,0.500000,0.500000,0.500000}, {-0.500000,0.312500,-0.500000,0.500000,0.500000,0.500000},
{-0.437500,-0.500000,-0.437500,-0.250000,0.500000,-0.250000}, {-0.437500,-0.500000,-0.437500,-0.250000,0.500000,-0.250000},
{-0.437500,-0.500000,0.250000,-0.250000,0.500000,0.437500}, {-0.437500,-0.500000,0.250000,-0.250000,0.500000,0.437500},
{0.250000,-0.500000,-0.437500,0.437500,0.500000,-0.250000}, {0.250000,-0.500000,-0.437500,0.437500,0.500000,-0.250000},
{0.250000,-0.500000,0.250000,0.437500,0.500000,0.447500}, {0.250000,-0.500000,0.250000,0.437500,0.500000,0.447500},
}, },
}, },
groups = {choppy=2,oddly_breakable_by_hand=2}, groups = {choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Barter Table")) meta:set_string("infotext", S("Barter Table"))
meta:set_string("pl1","") meta:set_string("pl1","")
meta:set_string("pl2","") meta:set_string("pl2","")
barter.chest.update_formspec(meta) barter.chest.update_formspec(meta)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("pl1", 3*4) inv:set_size("pl1", 3*4)
inv:set_size("pl2", 3*4) inv:set_size("pl2", 3*4)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
pl_receive_fields = function(n) pl_receive_fields = function(n)
if fields[n.."_start"] and meta:get_string(n) == "" then if fields[n.."_start"] and meta:get_string(n) == "" then
meta:set_string(n,sender:get_player_name()) meta:set_string(n,sender:get_player_name())
end end
if meta:get_string(n) == "" then if meta:get_string(n) == "" then
meta:set_int(n.."step",0) meta:set_int(n.."step",0)
elseif meta:get_int(n.."step")==0 then elseif meta:get_int(n.."step")==0 then
meta:set_int(n.."step",1) meta:set_int(n.."step",1)
end end
if sender:get_player_name() == meta:get_string(n) then if sender:get_player_name() == meta:get_string(n) then
if meta:get_int(n.."step")==1 and fields[n.."_accept1"] then if meta:get_int(n.."step")==1 and fields[n.."_accept1"] then
meta:set_int(n.."step",2) meta:set_int(n.."step",2)
end end
if meta:get_int(n.."step")==2 and fields[n.."_accept2"] then if meta:get_int(n.."step")==2 and fields[n.."_accept2"] then
meta:set_int(n.."step",3) meta:set_int(n.."step",3)
if n == "pl1" and meta:get_int("pl2step") == 3 then barter.chest.exchange(meta) end if n == "pl1" and meta:get_int("pl2step") == 3 then barter.chest.exchange(meta) end
if n == "pl2" and meta:get_int("pl1step") == 3 then barter.chest.exchange(meta) end if n == "pl2" and meta:get_int("pl1step") == 3 then barter.chest.exchange(meta) end
end end
if fields[n.."_cancel"] then barter.chest.cancel(meta) end if fields[n.."_cancel"] then barter.chest.cancel(meta) end
end end
end end
pl_receive_fields("pl1") pl_receive_fields("pl2") pl_receive_fields("pl1") pl_receive_fields("pl2")
-- End -- End
barter.chest.update_formspec(meta) barter.chest.update_formspec(meta)
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not barter.chest.check_privilege(from_list,player:get_player_name(),meta) then return 0 end if not barter.chest.check_privilege(from_list,player:get_player_name(),meta) then return 0 end
if not barter.chest.check_privilege(to_list,player:get_player_name(),meta) then return 0 end if not barter.chest.check_privilege(to_list,player:get_player_name(),meta) then return 0 end
return count return count
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not barter.chest.check_privilege(listname,player:get_player_name(),meta) then return 0 end if not barter.chest.check_privilege(listname,player:get_player_name(),meta) then return 0 end
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not barter.chest.check_privilege(listname,player:get_player_name(),meta) then return 0 end if not barter.chest.check_privilege(listname,player:get_player_name(),meta) then return 0 end
return stack:get_count() return stack:get_count()
end, end,
}) })

@ -1,137 +1,137 @@
minetest.register_craft({ minetest.register_craft({
output = 'currency:safe', output = 'currency:safe',
recipe = { recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:mese_crystal', 'default:steel_ingot'}, {'default:steel_ingot', 'default:mese_crystal', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'currency:shop', output = 'currency:shop',
recipe = { recipe = {
{'default:sign_wall'}, {'default:sign_wall'},
{'default:chest_locked'}, {'default:chest_locked'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'currency:barter', output = 'currency:barter',
recipe = { recipe = {
{'default:sign_wall'}, {'default:sign_wall'},
{'default:chest'}, {'default:chest'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_cent_10", output = "currency:minegeld_cent_10",
recipe = {"currency:minegeld_cent_5", "currency:minegeld_cent_5"}, recipe = {"currency:minegeld_cent_5", "currency:minegeld_cent_5"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_cent_5 2", output = "currency:minegeld_cent_5 2",
recipe = {"currency:minegeld_cent_10"}, recipe = {"currency:minegeld_cent_10"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_cent_25", output = "currency:minegeld_cent_25",
recipe = {"currency:minegeld_cent_5", "currency:minegeld_cent_5", "currency:minegeld_cent_5", "currency:minegeld_cent_5", "currency:minegeld_cent_5",}, recipe = {"currency:minegeld_cent_5", "currency:minegeld_cent_5", "currency:minegeld_cent_5", "currency:minegeld_cent_5", "currency:minegeld_cent_5",},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_cent_5 5", output = "currency:minegeld_cent_5 5",
recipe = {"currency:minegeld_cent_25"}, recipe = {"currency:minegeld_cent_25"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld", output = "currency:minegeld",
recipe = {"currency:minegeld_cent_25", "currency:minegeld_cent_25", "currency:minegeld_cent_25", "currency:minegeld_cent_25"}, recipe = {"currency:minegeld_cent_25", "currency:minegeld_cent_25", "currency:minegeld_cent_25", "currency:minegeld_cent_25"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_cent_25 4", output = "currency:minegeld_cent_25 4",
recipe = {"currency:minegeld"}, recipe = {"currency:minegeld"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_5", output = "currency:minegeld_5",
recipe = {"currency:minegeld", "currency:minegeld", "currency:minegeld", "currency:minegeld", "currency:minegeld"}, recipe = {"currency:minegeld", "currency:minegeld", "currency:minegeld", "currency:minegeld", "currency:minegeld"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld 5", output = "currency:minegeld 5",
recipe = {"currency:minegeld_5"}, recipe = {"currency:minegeld_5"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_10", output = "currency:minegeld_10",
recipe = {"currency:minegeld_5", "currency:minegeld_5"}, recipe = {"currency:minegeld_5", "currency:minegeld_5"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_5 2", output = "currency:minegeld_5 2",
recipe = {"currency:minegeld_10"}, recipe = {"currency:minegeld_10"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld 5", output = "currency:minegeld 5",
recipe = {"currency:minegeld_5"}, recipe = {"currency:minegeld_5"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_10 5", output = "currency:minegeld_10 5",
recipe = {"currency:minegeld_50"}, recipe = {"currency:minegeld_50"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_50", output = "currency:minegeld_50",
recipe = {"currency:minegeld_10", "currency:minegeld_10", "currency:minegeld_10", "currency:minegeld_10", "currency:minegeld_10"}, recipe = {"currency:minegeld_10", "currency:minegeld_10", "currency:minegeld_10", "currency:minegeld_10", "currency:minegeld_10"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_100", output = "currency:minegeld_100",
recipe = {"currency:minegeld_50", "currency:minegeld_50"}, recipe = {"currency:minegeld_50", "currency:minegeld_50"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_50 2", output = "currency:minegeld_50 2",
recipe = {"currency:minegeld_100" }, recipe = {"currency:minegeld_100" },
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "currency:minegeld_bundle", output = "currency:minegeld_bundle",
recipe = { recipe = {
"group:minegeld", "group:minegeld",
"group:minegeld", "group:minegeld",
"group:minegeld", "group:minegeld",
"group:minegeld", "group:minegeld",
"group:minegeld", "group:minegeld",
"group:minegeld", "group:minegeld",
"group:minegeld", "group:minegeld",
"group:minegeld", "group:minegeld",
"group:minegeld" "group:minegeld"
}, },
}) })
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "currency:minegeld_bundle", recipe = "currency:minegeld_bundle",
burntime = 1, burntime = 1,
}) })

@ -1,65 +1,65 @@
-- internationalization boilerplate -- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname()) local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua") local S, NS = dofile(MP.."/intllib.lua")
minetest.register_craftitem("currency:minegeld_cent_5", { minetest.register_craftitem("currency:minegeld_cent_5", {
description = S("5 Minegeld cent coin"), description = S("5 Minegeld cent coin"),
inventory_image = "minegeld_cent_5.png", inventory_image = "minegeld_cent_5.png",
stack_max = 1000, stack_max = 1000,
groups = {minegeld = 1} groups = {minegeld = 1}
}) })
minetest.register_craftitem("currency:minegeld_cent_10", { minetest.register_craftitem("currency:minegeld_cent_10", {
description = S("10 Minegeld cent coin"), description = S("10 Minegeld cent coin"),
inventory_image = "minegeld_cent_10.png", inventory_image = "minegeld_cent_10.png",
stack_max = 1000, stack_max = 1000,
groups = {minegeld = 1} groups = {minegeld = 1}
}) })
minetest.register_craftitem("currency:minegeld_cent_25", { minetest.register_craftitem("currency:minegeld_cent_25", {
description = S("25 Minegeld cent coin"), description = S("25 Minegeld cent coin"),
inventory_image = "minegeld_cent_25.png", inventory_image = "minegeld_cent_25.png",
stack_max = 1000, stack_max = 1000,
groups = {minegeld = 1} groups = {minegeld = 1}
}) })
minetest.register_craftitem("currency:minegeld", { minetest.register_craftitem("currency:minegeld", {
description = S("1 Minegeld Note"), description = S("1 Minegeld Note"),
inventory_image = "minegeld.png", inventory_image = "minegeld.png",
stack_max = 65535, stack_max = 65535,
groups = {minegeld = 1} groups = {minegeld = 1}
}) })
minetest.register_craftitem("currency:minegeld_5", { minetest.register_craftitem("currency:minegeld_5", {
description = S("5 Minegeld Note"), description = S("5 Minegeld Note"),
inventory_image = "minegeld_5.png", inventory_image = "minegeld_5.png",
stack_max = 65535, stack_max = 65535,
groups = {minegeld = 1} groups = {minegeld = 1}
}) })
minetest.register_craftitem("currency:minegeld_10", { minetest.register_craftitem("currency:minegeld_10", {
description = S("10 Minegeld Note"), description = S("10 Minegeld Note"),
inventory_image = "minegeld_10.png", inventory_image = "minegeld_10.png",
stack_max = 65535, stack_max = 65535,
groups = {minegeld = 1} groups = {minegeld = 1}
}) })
minetest.register_craftitem("currency:minegeld_50", { minetest.register_craftitem("currency:minegeld_50", {
description = S("50 Minegeld Note"), description = S("50 Minegeld Note"),
inventory_image = "minegeld_50.png", inventory_image = "minegeld_50.png",
stack_max = 65535, stack_max = 65535,
groups = {minegeld = 1} groups = {minegeld = 1}
}) })
minetest.register_craftitem("currency:minegeld_100", { minetest.register_craftitem("currency:minegeld_100", {
description = S("100 Minegeld Note"), description = S("100 Minegeld Note"),
inventory_image = "minegeld_100.png", inventory_image = "minegeld_100.png",
stack_max = 65535, stack_max = 65535,
groups = {minegeld = 1} groups = {minegeld = 1}
}) })
minetest.register_craftitem("currency:minegeld_bundle", { minetest.register_craftitem("currency:minegeld_bundle", {
description = S("Bundle of random Minegeld notes"), description = S("Bundle of random Minegeld notes"),
inventory_image = "minegeld_bundle.png", inventory_image = "minegeld_bundle.png",
stack_max = 65535, stack_max = 65535,
}) })

@ -1,4 +1,4 @@
default default
intllib? intllib?
loot? loot?
pipeworks? pipeworks?

@ -1,24 +1,24 @@
local modpath = minetest.get_modpath("currency") local modpath = minetest.get_modpath("currency")
-- internationalization boilerplate -- internationalization boilerplate
local S, NS = dofile(modpath.."/intllib.lua") local S, NS = dofile(modpath.."/intllib.lua")
minetest.log("info", S("Currency mod loading...")) minetest.log("info", S("Currency mod loading..."))
dofile(modpath.."/craftitems.lua") dofile(modpath.."/craftitems.lua")
minetest.log("info", "[Currency] "..S("Craft_items Loaded!")) minetest.log("info", "[Currency] "..S("Craft_items Loaded!"))
dofile(modpath.."/shop.lua") dofile(modpath.."/shop.lua")
minetest.log("info", "[Currency] "..S("Shop Loaded!")) minetest.log("info", "[Currency] "..S("Shop Loaded!"))
dofile(modpath.."/barter.lua") dofile(modpath.."/barter.lua")
minetest.log("info", "[Currency] "..S("Barter Loaded!")) minetest.log("info", "[Currency] "..S("Barter Loaded!"))
dofile(modpath.."/safe.lua") dofile(modpath.."/safe.lua")
minetest.log("info", "[Currency] "..S("Safe Loaded!")) minetest.log("info", "[Currency] "..S("Safe Loaded!"))
dofile(modpath.."/crafting.lua") dofile(modpath.."/crafting.lua")
minetest.log("info", "[Currency] "..S("Crafting Loaded!")) minetest.log("info", "[Currency] "..S("Crafting Loaded!"))
if minetest.settings:get_bool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
minetest.log("info", "[Currency] "..S("Creative mode in use, skipping basic income.")) minetest.log("info", "[Currency] "..S("Creative mode in use, skipping basic income."))
else else
dofile(modpath.."/income.lua") dofile(modpath.."/income.lua")
minetest.log("info", "[Currency] "..S("Income Loaded!")) minetest.log("info", "[Currency] "..S("Income Loaded!"))
end end

212
safe.lua

@ -1,106 +1,106 @@
-- internationalization boilerplate -- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname()) local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua") local S, NS = dofile(MP.."/intllib.lua")
function default.get_safe_formspec(pos) function default.get_safe_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," ..pos.z local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec = local formspec =
"size[8,9]".. "size[8,9]"..
"list[nodemeta:".. spos .. ";main;1,1;6,2;]".. "list[nodemeta:".. spos .. ";main;1,1;6,2;]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"listring[nodemeta:".. spos .. ";main]".. "listring[nodemeta:".. spos .. ";main]"..
"listring[current_player;main]" "listring[current_player;main]"
return formspec return formspec
end end
local function has_safe_privilege(meta, player) local function has_safe_privilege(meta, player)
local name = "" local name = ""
if player then if player then
if minetest.check_player_privs(player, "protection_bypass") then if minetest.check_player_privs(player, "protection_bypass") then
return true return true
end end
name = player:get_player_name() name = player:get_player_name()
end end
if name ~= meta:get_string("owner") then if name ~= meta:get_string("owner") then
return false return false
end end
return true return true
end end
minetest.register_node("currency:safe", { minetest.register_node("currency:safe", {
description = S("Safe"), description = S("Safe"),
inventory_image = "safe_front.png", inventory_image = "safe_front.png",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
tiles = {"safe_side.png", tiles = {"safe_side.png",
"safe_side.png", "safe_side.png",
"safe_side.png", "safe_side.png",
"safe_side.png", "safe_side.png",
"safe_side.png", "safe_side.png",
"safe_front.png",}, "safe_front.png",},
is_ground_content = false, is_ground_content = false,
groups = {cracky=1}, groups = {cracky=1},
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "") meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", S("Safe (owned by @1)", meta:get_string("owner"))) meta:set_string("infotext", S("Safe (owned by @1)", meta:get_string("owner")))
end, end,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Safe") meta:set_string("infotext", "Safe")
meta:set_string("owner", "") meta:set_string("owner", "")
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("main", 6*2) inv:set_size("main", 6*2)
end, end,
can_dig = function(pos,player) can_dig = function(pos,player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:is_empty("main") and has_safe_privilege(meta, player) return inv:is_empty("main") and has_safe_privilege(meta, player)
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not has_safe_privilege(meta, player) then if not has_safe_privilege(meta, player) then
minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3", minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3",
player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos)))
return 0 return 0
end end
return count return count
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not has_safe_privilege(meta, player) then if not has_safe_privilege(meta, player) then
minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3", minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3",
player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos)))
return 0 return 0
end end
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not has_safe_privilege(meta, player) then if not has_safe_privilege(meta, player) then
minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3", minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3",
player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos)))
return 0 return 0
end end
return stack:get_count() return stack:get_count()
end, end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", S("@1 moves stuff in safe at @2", player:get_player_name(), minetest.pos_to_string(pos))) minetest.log("action", S("@1 moves stuff in safe at @2", player:get_player_name(), minetest.pos_to_string(pos)))
end, end,
on_metadata_inventory_put = function(pos, listname, index, stack, player) on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", S("@1 moves stuff to safe at @2", player:get_player_name(), minetest.pos_to_string(pos))) minetest.log("action", S("@1 moves stuff to safe at @2", player:get_player_name(), minetest.pos_to_string(pos)))
end, end,
on_metadata_inventory_take = function(pos, listname, index, stack, player) on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", S("@1 takes stuff from safe at @2", player:get_player_name(), minetest.pos_to_string(pos))) minetest.log("action", S("@1 takes stuff from safe at @2", player:get_player_name(), minetest.pos_to_string(pos)))
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if has_safe_privilege(meta, clicker) then if has_safe_privilege(meta, clicker) then
minetest.show_formspec( minetest.show_formspec(
clicker:get_player_name(), clicker:get_player_name(),
"currency:safe", "currency:safe",
default.get_safe_formspec(pos) default.get_safe_formspec(pos)
) )
end end
end, end,
}) })

434
shop.lua

@ -1,217 +1,217 @@
-- internationalization boilerplate -- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname()) local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua") local S, NS = dofile(MP.."/intllib.lua")
default.shop = {} default.shop = {}
default.shop.current_shop = {} default.shop.current_shop = {}
default.shop.formspec = { default.shop.formspec = {
customer = function(pos) customer = function(pos)
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
local formspec = "size[8,9.5]".. local formspec = "size[8,9.5]"..
"label[0,0;" .. S("Customer gives (pay here!)") .. "]".. "label[0,0;" .. S("Customer gives (pay here!)") .. "]"..
"list[current_player;customer_gives;0,0.5;3,2;]".. "list[current_player;customer_gives;0,0.5;3,2;]"..
"label[0,2.5;" .. S("Customer gets:") .. "]".. "label[0,2.5;" .. S("Customer gets:") .. "]"..
"list[current_player;customer_gets;0,3;3,2;]".. "list[current_player;customer_gets;0,3;3,2;]"..
"label[5,0;" .. S("Owner wants:") .. "]".. "label[5,0;" .. S("Owner wants:") .. "]"..
"list["..list_name..";owner_wants;5,0.5;3,2;]".. "list["..list_name..";owner_wants;5,0.5;3,2;]"..
"label[5,2.5;" .. S("Owner gives:") .. "]".. "label[5,2.5;" .. S("Owner gives:") .. "]"..
"list["..list_name..";owner_gives;5,3;3,2;]".. "list["..list_name..";owner_gives;5,3;3,2;]"..
"list[current_player;main;0,5.5;8,4;]".. "list[current_player;main;0,5.5;8,4;]"..
"button[3,2;2,1;exchange;" .. S("Exchange") .. "]" "button[3,2;2,1;exchange;" .. S("Exchange") .. "]"
return formspec return formspec
end, end,
owner = function(pos) owner = function(pos)
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
local formspec = "size[8,9.5]".. local formspec = "size[8,9.5]"..
"label[0,0;" .. S("Customers gave:") .. "]".. "label[0,0;" .. S("Customers gave:") .. "]"..
"list["..list_name..";customers_gave;0,0.5;3,2;]".. "list["..list_name..";customers_gave;0,0.5;3,2;]"..
"label[0,2.5;" .. S("Your stock:") .. "]".. "label[0,2.5;" .. S("Your stock:") .. "]"..
"list["..list_name..";stock;0,3;3,2;]".. "list["..list_name..";stock;0,3;3,2;]"..
"label[5,0;" .. S("You want:") .. "]".. "label[5,0;" .. S("You want:") .. "]"..
"list["..list_name..";owner_wants;5,0.5;3,2;]".. "list["..list_name..";owner_wants;5,0.5;3,2;]"..
"label[5,2.5;" .. S("In exchange, you give:") .. "]".. "label[5,2.5;" .. S("In exchange, you give:") .. "]"..
"list["..list_name..";owner_gives;5,3;3,2;]".. "list["..list_name..";owner_gives;5,3;3,2;]"..
"label[0,5;" .. S("Owner, Use (E)+Place (right mouse button) for customer interface") .. "]".. "label[0,5;" .. S("Owner, Use (E)+Place (right mouse button) for customer interface") .. "]"..
"list[current_player;main;0,5.5;8,4;]" "list[current_player;main;0,5.5;8,4;]"
return formspec return formspec
end, end,
} }
local have_pipeworks = minetest.global_exists("pipeworks") local have_pipeworks = minetest.global_exists("pipeworks")
default.shop.check_privilege = function(listname,playername,meta) default.shop.check_privilege = function(listname,playername,meta)
--[[if listname == "pl1" then --[[if listname == "pl1" then
if playername ~= meta:get_string("pl1") then if playername ~= meta:get_string("pl1") then
return false return false
elseif meta:get_int("pl1step") ~= 1 then elseif meta:get_int("pl1step") ~= 1 then
return false return false
end end
end end
if listname == "pl2" then if listname == "pl2" then
if playername ~= meta:get_string("pl2") then if playername ~= meta:get_string("pl2") then
return false return false
elseif meta:get_int("pl2step") ~= 1 then elseif meta:get_int("pl2step") ~= 1 then
return false return false
end end
end]] end]]
return true return true
end end
default.shop.give_inventory = function(inv,list,playername) default.shop.give_inventory = function(inv,list,playername)
player = minetest.get_player_by_name(playername) player = minetest.get_player_by_name(playername)
if player then if player then
for k,v in ipairs(inv:get_list(list)) do for k,v in ipairs(inv:get_list(list)) do
player:get_inventory():add_item("main",v) player:get_inventory():add_item("main",v)
inv:remove_item(list,v) inv:remove_item(list,v)
end end
end end
end end
default.shop.cancel = function(meta) default.shop.cancel = function(meta)
--[[default.shop.give_inventory(meta:get_inventory(),"pl1",meta:get_string("pl1")) --[[default.shop.give_inventory(meta:get_inventory(),"pl1",meta:get_string("pl1"))
default.shop.give_inventory(meta:get_inventory(),"pl2",meta:get_string("pl2")) default.shop.give_inventory(meta:get_inventory(),"pl2",meta:get_string("pl2"))
meta:set_string("pl1","") meta:set_string("pl1","")
meta:set_string("pl2","") meta:set_string("pl2","")
meta:set_int("pl1step",0) meta:set_int("pl1step",0)
meta:set_int("pl2step",0)]] meta:set_int("pl2step",0)]]
end end
default.shop.exchange = function(meta) default.shop.exchange = function(meta)
--[[default.shop.give_inventory(meta:get_inventory(),"pl1",meta:get_string("pl2")) --[[default.shop.give_inventory(meta:get_inventory(),"pl1",meta:get_string("pl2"))
default.shop.give_inventory(meta:get_inventory(),"pl2",meta:get_string("pl1")) default.shop.give_inventory(meta:get_inventory(),"pl2",meta:get_string("pl1"))
meta:set_string("pl1","") meta:set_string("pl1","")
meta:set_string("pl2","") meta:set_string("pl2","")
meta:set_int("pl1step",0) meta:set_int("pl1step",0)
meta:set_int("pl2step",0)]] meta:set_int("pl2step",0)]]
end end
minetest.register_node("currency:shop", { minetest.register_node("currency:shop", {
description = S("Shop"), description = S("Shop"),
paramtype2 = "facedir", paramtype2 = "facedir",
tiles = {"shop_top.png", tiles = {"shop_top.png",
"shop_top.png", "shop_top.png",
"shop_side.png", "shop_side.png",
"shop_side.png", "shop_side.png",
"shop_side.png", "shop_side.png",
"shop_front.png"}, "shop_front.png"},
inventory_image = "shop_front.png", inventory_image = "shop_front.png",
groups = {choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, groups = {choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local owner = placer:get_player_name() local owner = placer:get_player_name()
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Exchange shop (owned by @1)", owner)) meta:set_string("infotext", S("Exchange shop (owned by @1)", owner))
meta:set_string("owner",owner) meta:set_string("owner",owner)
--[[meta:set_string("pl1","") --[[meta:set_string("pl1","")
meta:set_string("pl2","")]] meta:set_string("pl2","")]]
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("customers_gave", 3*2) inv:set_size("customers_gave", 3*2)
inv:set_size("stock", 3*2) inv:set_size("stock", 3*2)
inv:set_size("owner_wants", 3*2) inv:set_size("owner_wants", 3*2)
inv:set_size("owner_gives", 3*2) inv:set_size("owner_gives", 3*2)
if have_pipeworks then pipeworks.after_place(pos) end if have_pipeworks then pipeworks.after_place(pos) end
end, end,
after_dig_node = (have_pipeworks and pipeworks and pipeworks.after_dig), after_dig_node = (have_pipeworks and pipeworks and pipeworks.after_dig),
tube = { tube = {
insert_object = function(pos, node, stack, direction) insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:add_item("stock",stack) return inv:add_item("stock",stack)
end, end,
can_insert = function(pos,node,stack,direction) can_insert = function(pos,node,stack,direction)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:room_for_item("stock", stack) return inv:room_for_item("stock", stack)
end, end,
input_inventory = "customers_gave", input_inventory = "customers_gave",
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1} connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
}, },
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
clicker:get_inventory():set_size("customer_gives", 3*2) clicker:get_inventory():set_size("customer_gives", 3*2)
clicker:get_inventory():set_size("customer_gets", 3*2) clicker:get_inventory():set_size("customer_gets", 3*2)
default.shop.current_shop[clicker:get_player_name()] = pos default.shop.current_shop[clicker:get_player_name()] = pos
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if clicker:get_player_name() == meta:get_string("owner") and not clicker:get_player_control().aux1 then if clicker:get_player_name() == meta:get_string("owner") and not clicker:get_player_control().aux1 then
minetest.show_formspec(clicker:get_player_name(),"currency:shop_formspec",default.shop.formspec.owner(pos)) minetest.show_formspec(clicker:get_player_name(),"currency:shop_formspec",default.shop.formspec.owner(pos))
else else
minetest.show_formspec(clicker:get_player_name(),"currency:shop_formspec",default.shop.formspec.customer(pos)) minetest.show_formspec(clicker:get_player_name(),"currency:shop_formspec",default.shop.formspec.customer(pos))
end end
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if player:get_player_name() ~= meta:get_string("owner") then return 0 end if player:get_player_name() ~= meta:get_string("owner") then return 0 end
return count return count
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if player:get_player_name() ~= meta:get_string("owner") then return 0 end if player:get_player_name() ~= meta:get_string("owner") then return 0 end
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if player:get_player_name() ~= meta:get_string("owner") then return 0 end if player:get_player_name() ~= meta:get_string("owner") then return 0 end
return stack:get_count() return stack:get_count()
end, end,
can_dig = function(pos, player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:is_empty("stock") and inv:is_empty("customers_gave") and inv:is_empty("owner_wants") and inv:is_empty("owner_gives") return inv:is_empty("stock") and inv:is_empty("customers_gave") and inv:is_empty("owner_wants") and inv:is_empty("owner_gives")
end end
}) })
minetest.register_on_player_receive_fields(function(sender, formname, fields) minetest.register_on_player_receive_fields(function(sender, formname, fields)
if formname == "currency:shop_formspec" and fields.exchange ~= nil and fields.exchange ~= "" then if formname == "currency:shop_formspec" and fields.exchange ~= nil and fields.exchange ~= "" then
local name = sender:get_player_name() local name = sender:get_player_name()
local pos = default.shop.current_shop[name] local pos = default.shop.current_shop[name]
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_string("owner") == name then if meta:get_string("owner") == name then
minetest.chat_send_player(name,S("This is your own shop, you can't exchange to yourself!")) minetest.chat_send_player(name,S("This is your own shop, you can't exchange to yourself!"))
else else
local minv = meta:get_inventory() local minv = meta:get_inventory()
local pinv = sender:get_inventory() local pinv = sender:get_inventory()
local invlist_tostring = function(invlist) local invlist_tostring = function(invlist)
local out = {} local out = {}
for i, item in pairs(invlist) do for i, item in pairs(invlist) do
out[i] = item:to_string() out[i] = item:to_string()
end end
return out return out
end end
local wants = minv:get_list("owner_wants") local wants = minv:get_list("owner_wants")
local gives = minv:get_list("owner_gives") local gives = minv:get_list("owner_gives")
if wants == nil or gives == nil then return end -- do not crash the server if wants == nil or gives == nil then return end -- do not crash the server
-- Check if we can exchange -- Check if we can exchange
local can_exchange = true local can_exchange = true
local owners_fault = false local owners_fault = false
for i, item in pairs(wants) do for i, item in pairs(wants) do
if not pinv:contains_item("customer_gives",item) then if not pinv:contains_item("customer_gives",item) then
can_exchange = false can_exchange = false
end end
end end
for i, item in pairs(gives) do for i, item in pairs(gives) do
if not minv:contains_item("stock",item) then if not minv:contains_item("stock",item) then
can_exchange = false can_exchange = false
owners_fault = true owners_fault = true
end end
end end
if can_exchange then if can_exchange then
for i, item in pairs(wants) do for i, item in pairs(wants) do
pinv:remove_item("customer_gives",item) pinv:remove_item("customer_gives",item)
minv:add_item("customers_gave",item) minv:add_item("customers_gave",item)
end end
for i, item in pairs(gives) do for i, item in pairs(gives) do
minv:remove_item("stock",item) minv:remove_item("stock",item)
pinv:add_item("customer_gets",item) pinv:add_item("customer_gets",item)
end end
minetest.chat_send_player(name,S("Exchanged!")) minetest.chat_send_player(name,S("Exchanged!"))
else else
if owners_fault then if owners_fault then
minetest.chat_send_player(name,S("Exchange can not be done, contact the shop owner.")) minetest.chat_send_player(name,S("Exchange can not be done, contact the shop owner."))
else else
minetest.chat_send_player(name,S("Exchange can not be done, check if you put all items!")) minetest.chat_send_player(name,S("Exchange can not be done, check if you put all items!"))
end end
end end
end end
end end
end) end)