add russian translation and ondie function (thx skybuilder1717)

This commit is contained in:
tenplus1 2024-11-09 16:42:46 +00:00
parent ee2aef6e90
commit e201501aef
6 changed files with 58 additions and 10 deletions

View File

@ -3,7 +3,7 @@ Invisibility Potion by TenPlus1
This mod lets you craft an invisibility potion using one of each sapling (tree, jungle, pine, acacia, aspen, bush, acacia bush), a red mushroom and glass bottle.
Use potion to hide yourself AND nametag (0.4.15+ only) for 3 minutes.
Use potion to hide yourself AND nametag (5.0.0+ only) for 3 minutes.
Server admin can use the '/vanish <name>' command to hide/unhide players or themselves by leaving it blank.
@ -16,3 +16,4 @@ Changelog:
- 0.3 - Potions can now be stacked
- 0.4 - Potion recipe changed now that Nyan Cat no longer in default game
- 0.5 - Use newer functions, Minetest 0.4.16 and anove needed to run
- 0.6 - Make invisibility function global for API use, add time setting.

View File

@ -15,3 +15,7 @@ player in their worlds e.g.
/vanish -- toggle their own visibility
/vanish <player name> -- toggle the visibility of another player.
Players can alter the 'invisibility.effect_time' setting to change the amount of time
they remain invisible [default is 180 seconds], with 10 second warning before running out.

View File

@ -1,10 +1,13 @@
invisibility = {}
-- global
invisibility = {
effect_time = minetest.settings:get("invisibility.effect_time") or 180 -- 3 mins
}
local effect_time = 180 -- 3 minutes
local S = minetest.get_translator("invisibility") -- translation support
-- reset player invisibility if they go offline
-- reset player invisibility if they go offline or die
minetest.register_on_leaveplayer(function(player)
@ -15,6 +18,10 @@ minetest.register_on_leaveplayer(function(player)
end
end)
minetest.register_on_dieplayer(function(player)
invisibility.invisible(player, nil)
end)
-- creative check
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
@ -88,7 +95,7 @@ minetest.register_node("invisibility:potion", {
pos = pos, gain = 1.0, max_hear_distance = 5}, true)
-- display 10 second warning
minetest.after(effect_time - 10, function()
minetest.after(invisibility.effect_time - 10, function()
if invisibility[name] and user:get_pos() then
@ -98,7 +105,7 @@ minetest.register_node("invisibility:potion", {
end)
-- make player visible 5 minutes later
minetest.after(effect_time, function()
minetest.after(invisibility.effect_time, function()
if invisibility[name] and user:get_pos() then
@ -155,7 +162,7 @@ minetest.register_craft( {
minetest.register_chatcommand("vanish", {
params = "<name>",
description = "Make player invisible",
description = S("Make player invisible"),
privs = {server = true},
func = function(name, param)
@ -168,17 +175,20 @@ minetest.register_chatcommand("vanish", {
-- player not online
elseif param ~= "" then
return false, "Player " .. param .. " is not online!"
return false, S("Player @1 is offline!", param)
end
local player = minetest.get_player_by_name(name)
local msg
-- hide / show player
if invisibility[name] then
invisibility.invisible(player, nil)
invisibility.invisible(player, nil) ; msg = "visible"
else
invisibility.invisible(player, true)
invisibility.invisible(player, true) ; msg = "invisible"
end
return true, S("Player @1 is now @2!", name, S(msg))
end
})

16
locale/invisibility.ru.tr Normal file
View File

@ -0,0 +1,16 @@
# textdomain: invisibility
# Items
Invisibility Potion=Зелье Невидимости
# Messages
>>> You are already invisible!=>>> Вы уже невидимы!
>>> You have 10 seconds before invisibility wears off!=>>> У вас 10 секунд, до того как невидимость спадёт!
# Command
Make player invisible=Делает игрока невидимым
Player @1 is offline!=Игрок @1 не в сети!
Player @1 is now @2!=Теперь игрок @1 @2!
visible=видимый
invisible=невидимый

16
locale/template.txt Normal file
View File

@ -0,0 +1,16 @@
# textdomain: invisibility
# Items
Invisibility Potion=
# Messages
>>> You are already invisible!=
>>> You have 10 seconds before invisibility wears off!=
# Command
Make player invisible=
Player @1 is offline!=
Player @1 is now @2!=
visible=
invisible=

1
settingtypes.txt Normal file
View File

@ -0,0 +1 @@
invisibility.effect_time (How many seconds player is invisible) float 180