diff --git a/depends.txt b/depends.txt deleted file mode 100644 index 29f829c..0000000 --- a/depends.txt +++ /dev/null @@ -1,3 +0,0 @@ -default -vessels -flowers diff --git a/init.lua b/init.lua index 0fb6187..5116b1c 100644 --- a/init.lua +++ b/init.lua @@ -4,6 +4,20 @@ invisibility = {} local effect_time = 180 -- 3 minutes +-- translation support +local S +if minetest.get_translator then + S = minetest.get_translator("invisibility") -- 5.x translation function +else -- boilerplate function + S = function(str, ...) + local args = {...} + return str:gsub("@%d+", function(match) + return args[tonumber(match:sub(2))] + end) + end +end + + -- reset player invisibility if they go offline minetest.register_on_leaveplayer(function(player) @@ -17,14 +31,14 @@ end) -- creative check local creative_mode_cache = minetest.settings:get_bool("creative_mode") -function is_creative(name) +local function is_creative(name) return creative_mode_cache or minetest.check_player_privs(name, {creative = true}) end -- invisibility potion minetest.register_node("invisibility:potion", { - description = "Invisibility Potion", + description = S("Invisibility Potion"), drawtype = "plantlike", tiles = {"invisibility_potion.png"}, inventory_image = "invisibility_potion.png", @@ -47,7 +61,7 @@ minetest.register_node("invisibility:potion", { -- are we already invisible? if invisibility[name] then - minetest.chat_send_player(name, ">>> You are already invisible!") + minetest.chat_send_player(name, S(">>> You are already invisible!")) return itemstack end @@ -67,7 +81,7 @@ minetest.register_node("invisibility:potion", { and user:get_pos() then minetest.chat_send_player(name, - ">>> You have 10 seconds before invisibility wears off!") + S(">>> You have 10 seconds before invisibility wears off!")) end end)