[currency] Update to Git commit 3ee673d & patch 9e9b1be:

Commit: https://github.com/minetest-mods/currency/tree/3ee673d
Patch: https://github.com/AntumDeluge/mtmod-currency/tree/9e9b1be
This commit is contained in:
AntumDeluge 2017-06-04 15:49:06 -07:00
parent 3a380484ca
commit 3a32b6a938
10 changed files with 166 additions and 76 deletions

View File

@ -34,7 +34,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* [chatlog][] ([CC0][lic.cc0]) -- version: (no version info) *2013-06-09* ([patched][patch.chatlog])
* crafting/
* [craftguide][] ([GPL / WTFPL](mods/crafting/craftguide/LICENSE)) -- version: [86a96c3 Git][ver.craftguide] *2017-03-21* ([patched][patch.craftguide])
* [currency][] ([WTFPL][lic.currency]) -- version: [21f9811 Git][ver.currency] *2017-03-22* ([patched][patch.currency])
* [currency][] ([WTFPL][lic.currency]) -- version: [3ee673d Git][ver.currency] *2017-05-18* ([patched][patch.currency])
* [enchanting][] ([GPL / WTFPL / CC BY-SA-NA][lic.enchanting]) -- version: [13ea31c Git][ver.enchanting] *2016-12-16*
* equipment/
* [airtanks][] ([MIT][lic.airtanks]) -- version: [fc01ffb Git][ver.airtanks] *2017-04-01* ([patched][patch.airtanks])
@ -420,7 +420,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.crafting_bench]: https://github.com/minetest-mods/crafting_bench/tree/3aa4cfb
[ver.craftguide]: https://github.com/minetest-mods/craftguide/tree/86a96c3
[ver.crops]: https://github.com/minetest-mods/crops/tree/2b1bb37
[ver.currency]: https://github.com/minetest-mods/currency/tree/21f9811
[ver.currency]: https://github.com/minetest-mods/currency/tree/3ee673d
[ver.deploy_nodes]: https://github.com/cornernote/minetest-deploy_nodes/tree/eb3d68c
[ver.desert_life]: https://github.com/NathanSalapat/desert_life/tree/d448fa3
[ver.drawers]: https://github.com/minetest-mods/drawers/tree/7b9a384
@ -513,7 +513,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[patch.craftguide]: https://github.com/AntumDeluge/mtmod-craftguide/tree/1197b13
[patch.crafting_bench]: https://github.com/AntumDeluge/mtmod-crafting_bench/tree/c5ff4e5
[patch.crops]: https://github.com/AntumDeluge/mtmod-crops/tree/f8b33ae
[patch.currency]: https://github.com/AntumDeluge/mtmod-currency/tree/6275e9b
[patch.currency]: https://github.com/AntumDeluge/mtmod-currency/tree/9e9b1be
[patch.drawers]: https://github.com/AntumDeluge/mtmod-drawers/tree/3887c5b
[patch.ethereal]: https://github.com/AntumDeluge/mtmod-ethereal/tree/4be06f0
[patch.farming_plus]: https://github.com/AntumDeluge/mtmod-farming_plus/tree/c9c3a3a

View File

@ -1,5 +1,9 @@
barter = {}
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
barter.chest = {}
barter.chest.formspec = {
main = "size[8,9]"..
@ -7,20 +11,20 @@ barter.chest.formspec = {
"list[current_name;pl2;5,0;3,4;]"..
"list[current_player;main;0,5;8,4;]",
pl1 = {
start = "button[3,1;1,1;pl1_start;Start]",
start = "button[3,1;1,1;pl1_start;" .. S("Start") .. "]",
player = function(name) return "label[3,0;"..name.."]" end,
accept1 = "button[3,1;1,1;pl1_accept1;Confirm]"..
"button[3,2;1,1;pl1_cancel;Cancel]",
accept2 = "button[3,1;1,1;pl1_accept2;Exchange]"..
"button[3,2;1,1;pl1_cancel;Cancel]",
accept1 = "button[3,1;1,1;pl1_accept1;" .. S("Confirm") .. "]"..
"button[3,2;1,1;pl1_cancel;" .. S("Cancel") .. "]",
accept2 = "button[3,1;1,1;pl1_accept2;" .. S("Exchange") .. "]"..
"button[3,2;1,1;pl1_cancel;" .. S("Cancel") .. "]",
},
pl2 = {
start = "button[4,1;1,1;pl2_start;Start]",
start = "button[4,1;1,1;pl2_start;" .. S("Start") .. "]",
player = function(name) return "label[4,0;"..name.."]" end,
accept1 = "button[4,1;1,1;pl2_accept1;Confirm]"..
"button[4,2;1,1;pl2_cancel;Cancel]",
accept2 = "button[4,1;1,1;pl2_accept2;Exchange]"..
"button[4,2;1,1;pl2_cancel;Cancel]",
accept1 = "button[4,1;1,1;pl2_accept1;" .. S("Confirm") .. "]"..
"button[4,2;1,1;pl2_cancel;" .. S("Cancel") .. "]",
accept2 = "button[4,1;1,1;pl2_accept2;" .. S("Exchange") .. "]"..
"button[4,2;1,1;pl2_cancel;" .. S("Cancel") .. "]",
},
}
@ -90,7 +94,7 @@ end
minetest.register_node("currency:barter", {
drawtype = "nodebox",
description = "Barter Table",
description = S("Barter Table"),
paramtype = "light",
paramtype2 = "facedir",
tiles = {"barter_top.png",
@ -111,7 +115,7 @@ minetest.register_node("currency:barter", {
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Barter Table")
meta:set_string("infotext", S("Barter Table"))
meta:set_string("pl1","")
meta:set_string("pl2","")
barter.chest.update_formspec(meta)

View File

@ -1,26 +1,30 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
minetest.register_craftitem("currency:minegeld", {
description = "1 MineGeld Note",
description = S("1 MineGeld Note"),
inventory_image = "minegeld.png",
stack_max = 30000,
groups = {minegeld = 1}
})
minetest.register_craftitem("currency:minegeld_5", {
description = "5 MineGeld Note",
description = S("5 MineGeld Note"),
inventory_image = "minegeld_5.png",
stack_max = 30000,
groups = {minegeld = 1}
})
minetest.register_craftitem("currency:minegeld_10", {
description = "10 MineGeld Note",
description = S("10 MineGeld Note"),
inventory_image = "minegeld_10.png",
stack_max = 30000,
groups = {minegeld = 1}
})
minetest.register_craftitem("currency:minegeld_bundle", {
description = "Bundle of random Minegeld notes",
description = S("Bundle of random Minegeld notes"),
inventory_image = "minegeld_bundle.png",
stack_max = 30000,
})

View File

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

View File

@ -1,5 +1,9 @@
players_income = {}
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime;
@ -11,7 +15,7 @@ minetest.register_globalstep(function(dtime)
players_income[name] = 0
end
players_income[name] = 1
minetest.log("info", "[Currency] basic income for "..name.."")
minetest.log("info", "[Currency] "..S("basic income for @1", name))
end
end
end)
@ -27,7 +31,7 @@ earn_income = function(player)
local inv = player:get_inventory()
inv:add_item("main", {name="currency:minegeld_5", count=count})
players_income[name] = 0
minetest.log("info", "[Currency] added basic income for "..name.." to inventory")
minetest.log("info", "[Currency] "..S("added basic income for @1 to inventory", name))
end
end

View File

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

45
mods/currency/intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

30
mods/currency/loot.lua Normal file
View File

@ -0,0 +1,30 @@
if not minetest.get_modpath("loot") then
return
end
loot.register_loot({
weights = { generic = 50 },
payload = {
stack = ItemStack("currency:minegeld"),
min_size = 1,
max_size = 250,
},
})
loot.register_loot({
weights = { generic = 50 },
payload = {
stack = ItemStack("currency:minegeld_5"),
min_size = 1,
max_size = 50,
},
})
loot.register_loot({
weights = { generic = 50 },
payload = {
stack = ItemStack("currency:minegeld_10"),
min_size = 1,
max_size = 10,
},
})

View File

@ -1,3 +1,7 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
function default.get_safe_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec =
@ -22,12 +26,12 @@ local function has_safe_privilege(meta, player)
end
minetest.register_node("currency:safe", {
description = "Safe",
description = S("Safe"),
inventory_image = "safe_front.png",
paramtype = "light",
paramtype2 = "facedir",
tiles = {"safe_side.png",
"safe_side.png",
"safe_side.png",
"safe_side.png",
"safe_side.png",
"safe_side.png",
@ -37,8 +41,7 @@ minetest.register_node("currency:safe", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "Safe (owned by "..
meta:get_string("owner")..")")
meta:set_string("infotext", S("Safe (owned by @1)", meta:get_string("owner")))
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
@ -55,10 +58,8 @@ minetest.register_node("currency:safe", {
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_safe_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a safe belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
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)))
return 0
end
return count
@ -66,10 +67,8 @@ minetest.register_node("currency:safe", {
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_safe_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a safe belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
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)))
return 0
end
return stack:get_count()
@ -77,25 +76,20 @@ minetest.register_node("currency:safe", {
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_safe_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a safe belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
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)))
return 0
end
return stack:get_count()
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in safe at "..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,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to safe at "..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,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from safe at "..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,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)

View File

@ -1,33 +1,37 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
default.shop = {}
default.shop.current_shop = {}
default.shop.formspec = {
customer = function(pos)
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
local formspec = "size[8,9.5]"..
"label[0,0;Customer gives (pay here !)]"..
"label[0,0;" .. S("Customer gives (pay here!)") .. "]"..
"list[current_player;customer_gives;0,0.5;3,2;]"..
"label[0,2.5;Customer gets]"..
"label[0,2.5;" .. S("Customer gets:") .. "]"..
"list[current_player;customer_gets;0,3;3,2;]"..
"label[5,0;Owner wants]"..
"label[5,0;" .. S("Owner wants:") .. "]"..
"list["..list_name..";owner_wants;5,0.5;3,2;]"..
"label[5,2.5;Owner gives]"..
"label[5,2.5;" .. S("Owner gives:") .. "]"..
"list["..list_name..";owner_gives;5,3;3,2;]"..
"list[current_player;main;0,5.5;8,4;]"..
"button[3,2;2,1;exchange;Exchange]"
"button[3,2;2,1;exchange;" .. S("Exchange") .. "]"
return formspec
end,
owner = function(pos)
local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z
local formspec = "size[8,9.5]"..
"label[0,0;Customers gave:]"..
"label[0,0;" .. S("Customers gave:") .. "]"..
"list["..list_name..";customers_gave;0,0.5;3,2;]"..
"label[0,2.5;Your stock:]"..
"label[0,2.5;" .. S("Your stock:") .. "]"..
"list["..list_name..";stock;0,3;3,2;]"..
"label[5,0;You want:]"..
"label[5,0;" .. S("You want:") .. "]"..
"list["..list_name..";owner_wants;5,0.5;3,2;]"..
"label[5,2.5;In exchange, you give:]"..
"label[5,2.5;" .. S("In exchange, you give:") .. "]"..
"list["..list_name..";owner_gives;5,3;3,2;]"..
"label[0,5;Owner, Use(E)+Place(RMB) 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;]"
return formspec
end,
@ -83,10 +87,10 @@ default.shop.exchange = function(meta)
end
minetest.register_node("currency:shop", {
description = "Shop",
description = S("Shop"),
paramtype2 = "facedir",
tiles = {"shop_top.png",
"shop_top.png",
"shop_top.png",
"shop_side.png",
"shop_side.png",
"shop_side.png",
@ -97,7 +101,7 @@ minetest.register_node("currency:shop", {
after_place_node = function(pos, placer, itemstack)
local owner = placer:get_player_name()
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Exchange shop (owned by "..owner..")")
meta:set_string("infotext", S("Exchange shop (owned by @1)", owner))
meta:set_string("owner",owner)
--[[meta:set_string("pl1","")
meta:set_string("pl2","")]]
@ -162,7 +166,7 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields)
local pos = default.shop.current_shop[name]
local meta = minetest.get_meta(pos)
if meta:get_string("owner") == name then
minetest.chat_send_player(name,"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
local minv = meta:get_inventory()
local pinv = sender:get_inventory()
@ -199,12 +203,12 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields)
minv:remove_item("stock",item)
pinv:add_item("customer_gets",item)
end
minetest.chat_send_player(name,"Exchanged!")
minetest.chat_send_player(name,S("Exchanged!"))
else
if owners_fault then
minetest.chat_send_player(name,"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
minetest.chat_send_player(name,"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