aboutsummaryrefslogtreecommitdiff
path: root/safe.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-05-18 05:38:58 -0400
committerGitHub <noreply@github.com>2017-05-18 05:38:58 -0400
commit1979be782088e44ee5fb62b9f1ebe6d93109f14a (patch)
tree3020336c54ab1eafbc95e8cdcbdfcc9d1502a029 /safe.lua
parent21f981163e1a7605e6e866cf378b8efd6e0c6de1 (diff)
parentc4adcee072a0ddcc241f67409453c7b540acfcfd (diff)
downloadcurrency-1979be782088e44ee5fb62b9f1ebe6d93109f14a.tar.gz
currency-1979be782088e44ee5fb62b9f1ebe6d93109f14a.tar.bz2
currency-1979be782088e44ee5fb62b9f1ebe6d93109f14a.zip
Merge pull request #6 from FaceDeer/master
adding intllib and loot mod support
Diffstat (limited to 'safe.lua')
-rw-r--r--safe.lua38
1 files changed, 16 insertions, 22 deletions
diff --git a/safe.lua b/safe.lua
index 794e23a..1c53184 100644
--- a/safe.lua
+++ b/safe.lua
@@ -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)