New translation system, part 2: Environment, help
This commit is contained in:
parent
1217d9fa88
commit
d691490016
6 changed files with 62 additions and 62 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
--[[
|
||||
|
||||
Copyright (C) 2016 - Auke Kok <sofar@foo-projects.org>
|
||||
|
@ -10,6 +9,8 @@ of the license, or (at your option) any later version.
|
|||
|
||||
--]]
|
||||
|
||||
local S = minetest.get_translator("lightning")
|
||||
|
||||
lightning = {}
|
||||
|
||||
lightning.interval_low = 17
|
||||
|
@ -178,7 +179,7 @@ lightning.strike = function(pos)
|
|||
if obj:is_player() then
|
||||
-- Player damage
|
||||
if minetest.get_modpath("mcl_death_messages") then
|
||||
mcl_death_messages.player_damage(obj, string.format("%s was struck by lightning.", obj:get_player_name()))
|
||||
mcl_death_messages.player_damage(obj, S("@1 was struck by lightning.", obj:get_player_name()))
|
||||
end
|
||||
obj:set_hp(obj:get_hp()-5)
|
||||
-- Mobs
|
||||
|
@ -233,7 +234,7 @@ end)
|
|||
|
||||
minetest.register_chatcommand("lightning", {
|
||||
params = "[<X> <Y> <Z>]",
|
||||
description = "Let lightning strike at the specified position or yourself",
|
||||
description = S("Let lightning strike at the specified position or yourself"),
|
||||
privs = { maphack = true },
|
||||
func = function(name, param)
|
||||
local pos = {}
|
||||
|
@ -254,7 +255,7 @@ minetest.register_chatcommand("lightning", {
|
|||
if player then
|
||||
lightning.strike(player:get_pos())
|
||||
else
|
||||
return false, "No position specified and unknown player"
|
||||
return false, S("No position specified and unknown player")
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
local S = minetest.get_translator("mcl_void_damage")
|
||||
|
||||
local voidtimer = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
@ -24,7 +26,7 @@ minetest.register_globalstep(function(dtime)
|
|||
local spawn = mcl_spawn.get_spawn_pos(obj)
|
||||
obj:set_pos(spawn)
|
||||
mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(spawn))
|
||||
minetest.chat_send_player(obj:get_player_name(), "The void is off-limits to you!")
|
||||
minetest.chat_send_player(obj:get_player_name(), S("The void is off-limits to you!"))
|
||||
else
|
||||
obj:remove()
|
||||
end
|
||||
|
@ -32,7 +34,7 @@ minetest.register_globalstep(function(dtime)
|
|||
-- Damage enabled, not immortal: Deal void damage (4 HP / 0.5 seconds)
|
||||
if obj:get_hp() > 0 then
|
||||
if is_player then
|
||||
mcl_death_messages.player_damage(obj, string.format("%s fell into the endless void.", obj:get_player_name()))
|
||||
mcl_death_messages.player_damage(obj, S("@1 fell into the endless void.", obj:get_player_name()))
|
||||
end
|
||||
obj:set_hp(obj:get_hp() - 4)
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
local S = minetest.get_translator("mcl_weather")
|
||||
|
||||
-- weather states, 'none' is default, other states depends from active mods
|
||||
mcl_weather.state = "none"
|
||||
|
||||
|
@ -182,18 +184,18 @@ mcl_weather.get_weather = function()
|
|||
end
|
||||
|
||||
minetest.register_privilege("weather_manager", {
|
||||
description = "Gives ability to control weather",
|
||||
description = S("Gives ability to control weather"),
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
|
||||
-- Weather command definition. Set
|
||||
minetest.register_chatcommand("weather", {
|
||||
params = "(clear | rain | snow | thunder) [<duration>]",
|
||||
description = "Changes the weather to the specified parameter.",
|
||||
params = S("(clear | rain | snow | thunder) [<duration>]"),
|
||||
description = S("Changes the weather to the specified parameter."),
|
||||
privs = {weather_manager = true},
|
||||
func = function(name, param)
|
||||
if (param == "") then
|
||||
return false, "Error: No weather specified."
|
||||
return false, S("Error: No weather specified.")
|
||||
end
|
||||
local new_weather, end_time
|
||||
local parse1, parse2 = string.match(param, "(%w+) ?(%d*)")
|
||||
|
@ -204,13 +206,13 @@ minetest.register_chatcommand("weather", {
|
|||
new_weather = parse1
|
||||
end
|
||||
else
|
||||
return false, "Error: Invalid parameters."
|
||||
return false, S("Error: Invalid parameters.")
|
||||
end
|
||||
if parse2 then
|
||||
if type(tonumber(parse2)) == "number" then
|
||||
local duration = tonumber(parse2)
|
||||
if duration < 1 then
|
||||
return false, "Error: Duration can't be less than 1 second."
|
||||
return false, S("Error: Duration can't be less than 1 second.")
|
||||
end
|
||||
end_time = minetest.get_gametime() + duration
|
||||
end
|
||||
|
@ -220,14 +222,14 @@ minetest.register_chatcommand("weather", {
|
|||
if success then
|
||||
return true
|
||||
else
|
||||
return false, "Error: Invalid weather specified. Use “clear”, “rain”, “snow” or “thunder”."
|
||||
return false, S("Error: Invalid weather specified. Use “clear”, “rain”, “snow” or “thunder”.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("toggledownfall", {
|
||||
params = "",
|
||||
description = "Toggles between clear weather and weather with downfall (randomly rain, thunderstorm or snow)",
|
||||
description = S("Toggles between clear weather and weather with downfall (randomly rain, thunderstorm or snow)"),
|
||||
privs = {weather_manager = true},
|
||||
func = function(name, param)
|
||||
-- Currently rain/thunder/snow: Set weather to clear
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue