Time system redo + timer option in editor
18
DOCS.md
|
@ -13,7 +13,8 @@ An arena is a table having as a key an ID and as a value its parameters. They ar
|
|||
* `players_amount`: (int) separately stores how many players are inside the arena/queue
|
||||
* `max_players`: (string) default is 4. When this value is reached, queue time decreases to 5 if it's not lower already
|
||||
* `min_players`: (string) default is 2. When this value is reached, a queue starts
|
||||
* `timer`: (int) inherited by the mod's timer value, it can be changed later, per arena. When it's disabled, it's nil.
|
||||
* `initial_time`: (int) in seconds. It's nil when the mod doesn't keep track of time, it's 0 when the mod does it incrementally and it's inherited by the mod if the mod has a timer. In this case, every arena can have its specific value. By default time tracking is disabled, hence it's nil
|
||||
* `current_time`: (int) in seconds. It requires `initial_time` and it exists only when a game is in progress, keeping track of the current time
|
||||
* `in_queue`: (bool) about phases, look at "Arena phases" down below
|
||||
* `in_loading`: (bool)
|
||||
* `in_game`: (bool)
|
||||
|
@ -68,7 +69,7 @@ If you don't want to rely on the hotbar, or you want both the editor and the com
|
|||
`arena_lib.toggle_teams_per_arena(sender, mod, arena_name, enable)` enables/disables teams per single arena. `enable` is an int, where 0 disables teams and 1 enables them.
|
||||
|
||||
##### 1.2.2.3 Timers
|
||||
`arena_lib.set_timer(sender, mod, arena_name, timer)` changes the timer of the arena. If `timer` is -1, it'll be disabled and set to `nil`.
|
||||
`arena_lib.set_timer(sender, mod, arena_name, timer)` changes the timer of the arena. It only works if timers are enabled (explained further below).
|
||||
|
||||
##### 1.2.2.4 Arenas properties
|
||||
Properties are explained down below, but essentially they allow you to create additional attributes specifically suited for what you have in mind (e.g. a score to reach to win the game).
|
||||
|
@ -165,8 +166,10 @@ The second field, on the contrary, is a table of parameters: they define the ver
|
|||
* `keep_inventory`: whether to keep players inventories when joining an arena. Default is false
|
||||
* `show_nametags`: whether to show the players nametags while in game. Default is false
|
||||
* `show_minimap`: whether to allow players to use the builtin minimap function. Default is false
|
||||
* `timer`: an eventual timer, in seconds. Default is -1, meaning it's disabled. If disabled, new arenas won't have a timer. If not, they'll inherit the same value
|
||||
* `is_timer_incrementing`: whether arenas' timers decrease as in a countdown or increase as in a stopwatch. Default is false
|
||||
* `time_mode`: whether arenas will keep track of the time or not.
|
||||
* `0`: no time tracking at all (default)
|
||||
* `1`: incremental time (0, 1, 2, ...)
|
||||
* `2`: decremental time, as in a timer (3, 2, 1, 0). The timer value is 300 seconds by default, but it can be changed per arena
|
||||
* `queue_waiting_time`: the time to wait before the loading phase starts. It gets triggered when the minimium amount of players has been reached to start the queue. Default is 10
|
||||
* `load_time`: the time between the loading state and the start of the match. Default is 3
|
||||
* `celebration_time`: the time between the celebration state and the end of the match. Default is 3
|
||||
|
@ -207,8 +210,8 @@ To customise your mod even more, there are a few empty callbacks you can use. Th
|
|||
* `arena_lib.on_end(mod, function(arena, players))`
|
||||
* `arena_lib.on_join(mod, function(p_name, arena))`: called when a player joins an ongoing match
|
||||
* `arena_lib.on_death(mod, function(arena, p_name, reason))`: called when a player dies
|
||||
* `arena_lib.on_timer_tick(mod, function(arena))`: called every second inside the arena if there is a timer and it's greater than 0
|
||||
* `arena_lib.on_timeout(mod, function(arena))`: called when the timer of an arena, if exists, reaches 0. Not declaring it will make the server crash when time runs out
|
||||
* `arena_lib.on_time_tick(mod, function(arena))`: called every second inside the arena if `time_mode` is 2.
|
||||
* `arena_lib.on_timeout(mod, function(arena))`: called when the timer of an arena, if exists (`time_mode = 2`), reaches 0. Not declaring it will make the server crash when time runs out
|
||||
* `arena_lib.on_eliminate(mod, function(arena, p_name))`: called when a player is eliminated (see `arena_lib.remove_player_from_arena(...)`)
|
||||
* `arena_lib.on_kick(mod, function(arena, p_name))`: called when a player is kicked from a match (same as above)
|
||||
* `arena_lib.on_quit(mod, function(arena, p_name, is_forced))`: called when a player quits from a match (same as above). `is_forced` is true when the match has been terminated via `force_arena_ending(...)`
|
||||
|
@ -324,8 +327,9 @@ Executioner can be passed to tell who removed the player. By default, this happe
|
|||
|
||||
### 2.7 Things you don't want to do with a light heart
|
||||
* Changing the number of the teams: it'll delete your spawners (this has to be done in order to avoid further problems)
|
||||
* Any action in the "Players" section of the editor, aside changing their minimum amount: it'll delete your spawners (same as above)
|
||||
* Any action in the "Players" section of the editor, except changing their minimum amount: it'll delete your spawners (same as above)
|
||||
* Removing properties in the minigame declaration: it'll delete them from every arena, without any possibility to get them back. Always do a backup first
|
||||
* Disabling timers (`time_mode = 2` to something else) when arenas have custom timer values: it'll reset every custom value, so you have to put them again manually if/when you decide to turning timers back up.
|
||||
|
||||
## 3. About the author(s)
|
||||
I'm Zughy (Marco), a professional Italian pixel artist who fights for FOSS and digital ethics. If this library spared you a lot of time and you want to support me somehow, please consider donating on [LiberaPay](https://liberapay.com/Zughy/). Also, this project wouldn't have been possible if it hadn't been for some friends who helped me testing through: `SonoMichele`, `_Zaizen_` and `Xx_Crazyminer_xX`
|
||||
|
|
|
@ -3,16 +3,17 @@ local FS = minetest.formspec_escape
|
|||
|
||||
local function get_rename_formspec() end
|
||||
local function get_properties_formspec() end
|
||||
local function get_timer_formspec() end
|
||||
local function get_delete_formspec() end
|
||||
local function value_to_string() end
|
||||
|
||||
local settings_tools = {
|
||||
"arena_lib:settings_rename",
|
||||
"arena_lib:settings_properties",
|
||||
"", -- timer_off/_on
|
||||
"",
|
||||
"arena_lib:settings_delete",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"arena_lib:editor_return",
|
||||
"arena_lib:editor_quit",
|
||||
}
|
||||
|
@ -21,6 +22,36 @@ local sel_property_attr = {} --KEY: p_name; VALUE: {id = idx, name = propert
|
|||
|
||||
|
||||
|
||||
minetest.register_craftitem("arena_lib:timer", {
|
||||
|
||||
description = S("Timer: on"),
|
||||
inventory_image = "arenalib_tool_settings_timer.png",
|
||||
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"},
|
||||
on_place = function() end,
|
||||
on_drop = function() end,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
minetest.show_formspec(user:get_player_name(), "arena_lib:settings_timer", get_timer_formspec())
|
||||
end,
|
||||
|
||||
on_secondary_use = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local mod = placer:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = placer:get_meta():get_string("arena_lib_editor.arena")
|
||||
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local inv = placer:get_inventory()
|
||||
|
||||
arena_lib.set_timer(placer:get_player_name(), mod, arena_name, -1, true)
|
||||
|
||||
minetest.after(0, function()
|
||||
inv:set_stack("main", 1, "arena_lib:timer_off")
|
||||
end)
|
||||
end
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_tool("arena_lib:settings_rename", {
|
||||
|
||||
|
@ -31,8 +62,7 @@ minetest.register_tool("arena_lib:settings_rename", {
|
|||
on_drop = function() end,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local p_name = user:get_player_name()
|
||||
minetest.show_formspec(p_name, "arena_lib:settings_rename", get_rename_formspec(p_name))
|
||||
minetest.show_formspec(user:get_player_name(), "arena_lib:settings_rename", get_rename_formspec())
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -80,6 +110,17 @@ minetest.register_tool("arena_lib:settings_delete", {
|
|||
|
||||
function arena_lib.give_settings_tools(user)
|
||||
user:get_inventory():set_list("main", settings_tools)
|
||||
|
||||
local inv = user:get_inventory()
|
||||
local mod = user:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = user:get_meta():get_string("arena_lib_editor.arena")
|
||||
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
|
||||
local mod_ref = arena_lib.mods[mod]
|
||||
|
||||
if mod_ref.time_mode == 2 then
|
||||
inv:set_stack("main", 3, "arena_lib:timer")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -90,6 +131,22 @@ end
|
|||
---------------FUNZIONI LOCALI----------------
|
||||
----------------------------------------------
|
||||
|
||||
function get_rename_formspec()
|
||||
|
||||
local formspec = {
|
||||
"size[5.2,0.4]",
|
||||
"no_prepend[]",
|
||||
"bgcolor[;neither]",
|
||||
"field[0.2,0.25;4,1;rename;;]",
|
||||
"button[3.8,-0.05;1.7,1;rename_confirm;" .. S("Rename arena") .. "]",
|
||||
"field_close_on_enter[rename;false]"
|
||||
}
|
||||
|
||||
return table.concat(formspec, "")
|
||||
end
|
||||
|
||||
|
||||
|
||||
function get_properties_formspec(p_name, mod, arena, sel_idx)
|
||||
|
||||
local mod_ref = arena_lib.mods[mod]
|
||||
|
@ -134,15 +191,15 @@ end
|
|||
|
||||
|
||||
|
||||
function get_rename_formspec(p_name)
|
||||
function get_timer_formspec()
|
||||
|
||||
local formspec = {
|
||||
"size[5.2,0.4]",
|
||||
"no_prepend[]",
|
||||
"bgcolor[;neither]",
|
||||
"field[0.2,0.25;4,1;rename;;]",
|
||||
"button[3.8,-0.05;1.7,1;rename_confirm;" .. S("Rename arena") .. "]",
|
||||
"field_close_on_enter[rename;false]"
|
||||
"field[0.2,0.25;4,1;set_timer;;]",
|
||||
"button[3.8,-0.05;1.7,1;timer_confirm;" .. S("Set timer") .. "]",
|
||||
"field_close_on_enter[set_timer;false]"
|
||||
}
|
||||
|
||||
return table.concat(formspec, "")
|
||||
|
@ -191,14 +248,30 @@ end
|
|||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
if formname ~= "arena_lib:settings_rename" and formname ~= "arena_lib:settings_properties" and formname ~= "arena_lib:settings_delete" then return end
|
||||
if formname ~= "arena_lib:settings_timer" and formname ~= "arena_lib:settings_rename"
|
||||
and formname ~= "arena_lib:settings_properties" and formname ~= "arena_lib:settings_delete" then return end
|
||||
|
||||
local p_name = player:get_player_name()
|
||||
local mod = player:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = player:get_meta():get_string("arena_lib_editor.arena")
|
||||
|
||||
-- GUI per timer
|
||||
if formname == "arena_lib:settings_timer" then
|
||||
|
||||
if fields.timer_confirm or fields.key_enter then
|
||||
|
||||
local timer = tonumber(fields.set_timer)
|
||||
|
||||
if timer == nil or timer < 1 then
|
||||
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] Parameters don't seem right!")))
|
||||
return end
|
||||
|
||||
arena_lib.set_timer(p_name, mod, arena_name, timer, true)
|
||||
minetest.close_formspec(p_name, formname)
|
||||
end
|
||||
|
||||
-- GUI per rinominare arena
|
||||
if formname == "arena_lib:settings_rename" then
|
||||
elseif formname == "arena_lib:settings_rename" then
|
||||
|
||||
if fields.rename_confirm or fields.key_enter then
|
||||
if arena_lib.rename_arena(p_name, mod, arena_name, fields.rename, true) then
|
||||
|
@ -239,10 +312,5 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
minetest.close_formspec(p_name, formname)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end)
|
||||
|
|
|
@ -55,8 +55,6 @@ minetest.register_tool("arena_lib:sign_remove", {
|
|||
local node_name = minetest.get_node(pos).name
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
minetest.chat_send_player(p_name, node_name)
|
||||
|
||||
-- controllo se è un cartello
|
||||
if node_name ~= "arena_lib:sign" then
|
||||
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] That's not an arena_lib sign!")))
|
||||
|
|
|
@ -17,7 +17,7 @@ local function copy_table() end
|
|||
local function next_available_ID() end
|
||||
local function is_arena_name_allowed() end
|
||||
local function assign_team_spawner() end
|
||||
local function timer_start() end
|
||||
local function time_start() end
|
||||
|
||||
local players_in_game = {} -- KEY: player name, VALUE: {(string) minigame, (int) arenaID}
|
||||
local players_in_queue = {} -- KEY: player name, VALUE: {(string) minigame, (int) arenaID}
|
||||
|
@ -33,7 +33,8 @@ local arena_default = {
|
|||
spawn_points = {}, -- KEY: ids, VALUE: {position, team}
|
||||
max_players = 4,
|
||||
min_players = 2,
|
||||
timer = nil,
|
||||
initial_time = nil,
|
||||
current_time = nil,
|
||||
in_queue = false,
|
||||
in_loading = false,
|
||||
in_game = false,
|
||||
|
@ -63,6 +64,18 @@ function arena_lib.register_minigame(mod, def)
|
|||
end
|
||||
--^------------------ LEGACY UPDATE, to remove in 4.0 -------------------^
|
||||
|
||||
--v------------------ LEGACY UPDATE, to remove in 5.0 -------------------v
|
||||
if def.is_timer_incrementing then
|
||||
minetest.log("warning", "[ARENA_LIB] is_timer_incrementing is deprecated. Use time_mode = 1 instead")
|
||||
def.time_mode = 1
|
||||
end
|
||||
|
||||
if def.timer then
|
||||
minetest.log("warning", "[ARENA_LIB] timer is deprecated. Use time_mode = 2 instead")
|
||||
def.time_mode = 2
|
||||
end
|
||||
--^------------------ LEGACY UPDATE, to remove in 5.0 -------------------^
|
||||
|
||||
arena_lib.mods[mod] = {}
|
||||
arena_lib.mods[mod].arenas = {} -- KEY: (int) arenaID , VALUE: (table) arena properties
|
||||
arena_lib.mods[mod].highest_arena_ID = highest_arena_ID
|
||||
|
@ -84,8 +97,7 @@ function arena_lib.register_minigame(mod, def)
|
|||
mod_ref.keep_inventory = false
|
||||
mod_ref.show_nametags = false
|
||||
mod_ref.show_minimap = false
|
||||
mod_ref.timer = -1
|
||||
mod_ref.is_timer_incrementing = false
|
||||
mod_ref.time_mode = 0
|
||||
mod_ref.queue_waiting_time = 10
|
||||
mod_ref.load_time = 3 -- time in the loading phase (the pre-match)
|
||||
mod_ref.celebration_time = 3 -- time in the celebration phase
|
||||
|
@ -152,12 +164,8 @@ function arena_lib.register_minigame(mod, def)
|
|||
mod_ref.show_minimap = def.show_minimap
|
||||
end
|
||||
|
||||
if def.timer then
|
||||
mod_ref.timer = def.timer
|
||||
end
|
||||
|
||||
if def.is_timer_incrementing == true then
|
||||
mod_ref.is_timer_incrementing = true
|
||||
if def.time_mode then
|
||||
mod_ref.time_mode = def.time_mode
|
||||
end
|
||||
|
||||
if def.queue_waiting_time then
|
||||
|
@ -247,9 +255,11 @@ function arena_lib.create_arena(sender, mod, arena_name, min_players, max_player
|
|||
end
|
||||
end
|
||||
|
||||
-- eventuale timer
|
||||
if mod_ref.timer ~= -1 then
|
||||
arena.timer = mod_ref.timer
|
||||
-- eventuale tempo
|
||||
if mod_ref.time_mode == 1 then
|
||||
arena.initial_time = 0
|
||||
elseif mod_ref.time_mode == 2 then
|
||||
arena.initial_time = 300
|
||||
end
|
||||
|
||||
-- aggiungo eventuali proprietà
|
||||
|
@ -741,14 +751,18 @@ function arena_lib.set_timer(sender, mod, arena_name, timer, in_editor)
|
|||
|
||||
local mod_ref = arena_lib.mods[mod]
|
||||
|
||||
-- se è da disabilitare
|
||||
if timer == -1 then
|
||||
arena.timer = nil
|
||||
minetest.chat_send_player(sender, mod_ref.prefix .. S("Arena @1's timer successfully disabled", arena_name))
|
||||
else
|
||||
arena.timer = timer
|
||||
minetest.chat_send_player(sender, mod_ref.prefix .. S("Arena @1's timer is now @2s", arena_name, timer))
|
||||
end
|
||||
-- se la mod non supporta i timer
|
||||
if mod_ref.time_mode ~= 2 then
|
||||
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Timers are currently disabled! (you need time_mode = 2)")))
|
||||
return end
|
||||
|
||||
-- se è inferiore a 1
|
||||
if timer < 1 then
|
||||
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Parameters don't seem right!")))
|
||||
return end
|
||||
|
||||
arena.initial_time = timer
|
||||
minetest.chat_send_player(sender, mod_ref.prefix .. S("Arena @1's timer is now @2s", arena_name, timer))
|
||||
end
|
||||
|
||||
|
||||
|
@ -988,11 +1002,11 @@ function arena_lib.start_arena(mod_ref, arena)
|
|||
})
|
||||
end
|
||||
|
||||
-- parte l'eventuale timer
|
||||
if arena.timer then
|
||||
arena.timer_current = arena.timer
|
||||
-- parte l'eventuale tempo
|
||||
if mod_ref.time_mode > 0 then
|
||||
arena.current_time = arena.initial_time
|
||||
minetest.after(1, function()
|
||||
timer_start(mod_ref, arena)
|
||||
time_start(mod_ref, arena)
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -1150,7 +1164,7 @@ function arena_lib.end_arena(mod_ref, mod, arena)
|
|||
end
|
||||
|
||||
-- azzero il timer
|
||||
arena.timer_current = nil
|
||||
arena.current_time = nil
|
||||
|
||||
-- rimuovo eventuali proprietà temporanee
|
||||
for temp_property, v in pairs(mod_ref.temp_properties) do
|
||||
|
@ -1685,32 +1699,39 @@ function init_storage(mod, mod_ref)
|
|||
-- spawners conversion from 2.7.0 to 3.0+ version
|
||||
if next(arena.spawn_points) then
|
||||
if arena.spawn_points[next(arena.spawn_points)].x ~= nil then
|
||||
to_update = true
|
||||
minetest.log("action", "[ARENA_LIB] Converting old spawn points for arena " .. arena.name)
|
||||
for id, coords in pairs(arena.spawn_points) do
|
||||
arena.spawn_points[id] = {pos = coords}
|
||||
minetest.log("action", "[ARENA_LIB] Spawn point #" .. id .. "(" .. minetest.pos_to_string(arena.spawn_points[id].pos) .. ") converted")
|
||||
end
|
||||
to_update = true
|
||||
end
|
||||
end
|
||||
|
||||
-- team conversion for 2.7.0 and lesser versions
|
||||
if not arena.teams then
|
||||
to_update = true
|
||||
arena.teams = {-1}
|
||||
to_update = true
|
||||
end
|
||||
--^------------------ LEGACY UPDATE, to remove in 4.0 -------------------^
|
||||
|
||||
--v------------------ LEGACY UPDATE, to remove in 5.0 -------------------v
|
||||
-- team per arena for 3.2.0 and lesser versions
|
||||
if arena.teams_enabled == nil then
|
||||
to_update = true
|
||||
if #arena.teams > 1 then
|
||||
arena.teams_enabled = true
|
||||
else
|
||||
arena.teams_enabled = false
|
||||
end
|
||||
minetest.log("action", "[ARENA_LIB] Added '.teams_enabled' property from 3.2.0")
|
||||
to_update = true
|
||||
end
|
||||
|
||||
-- refactoring arena.timer in arena.initial_time for 3.6.0 and lesser versions
|
||||
if arena.timer then
|
||||
arena.initial_time = arena.timer
|
||||
arena.timer = nil
|
||||
to_update = true
|
||||
end
|
||||
--^------------------ LEGACY UPDATE, to remove in 5.0 -------------------^
|
||||
|
||||
|
@ -1736,10 +1757,25 @@ function init_storage(mod, mod_ref)
|
|||
to_update = true
|
||||
arena.enabled = false
|
||||
arena.spawn_points = {}
|
||||
minetest.log("warning", "[ARENA_LIB] spawn points of arena " .. arena.name ..
|
||||
minetest.log("action", "[ARENA_LIB] spawn points of arena " .. arena.name ..
|
||||
" has been reset due to not coinciding with the maximum amount of players (" .. arena_max_players .. ")")
|
||||
end
|
||||
|
||||
-- gestione tempo
|
||||
if mod_ref.time_mode == 0 and arena.initial_time then -- se avevo abilitato il tempo e ora l'ho rimosso, lo tolgo dalle arene
|
||||
arena.initial_time = nil
|
||||
to_update = true
|
||||
elseif mod_ref.time_mode ~= 0 and not arena.initial_time then -- se li ho abilitati ora e le arene non ce li hanno, glieli aggiungo
|
||||
arena.initial_time = mod_ref.time_mode == 1 and 0 or 300
|
||||
to_update = true
|
||||
elseif mod_ref.time_mode == 1 and arena.initial_time > 0 then -- se ho disabilitato i timer e le arene ce li avevano, porto il tempo a 0
|
||||
arena.initial_time = 0
|
||||
to_update = true
|
||||
elseif mod_ref.time_mode == 2 and arena.initial_time == 0 then -- se ho abilitato i timer e le arene partivano da 0, imposto il timer a 5 minuti
|
||||
arena.initial_time = 300
|
||||
to_update = true
|
||||
end
|
||||
|
||||
arena_lib.mods[mod].arenas[i] = arena
|
||||
|
||||
if to_update then
|
||||
|
@ -1936,26 +1972,26 @@ end
|
|||
|
||||
|
||||
|
||||
function timer_start(mod_ref, arena)
|
||||
function time_start(mod_ref, arena)
|
||||
|
||||
if arena.on_celebration or not arena.in_game then return end
|
||||
|
||||
if mod_ref.is_timer_incrementing then
|
||||
arena.timer_current = arena.timer_current + 1
|
||||
if mod_ref.time_mode == 1 then
|
||||
arena.current_time = arena.current_time + 1
|
||||
else
|
||||
arena.timer_current = arena.timer_current - 1
|
||||
arena.current_time = arena.current_time - 1
|
||||
end
|
||||
|
||||
if arena.timer_current <= 0 then
|
||||
if arena.current_time <= 0 then
|
||||
assert(mod_ref.on_timeout, "[ARENA_LIB] " .. S("[!] on_timeout callback must be declared to properly use a decreasing timer!"))
|
||||
mod_ref.on_timeout(arena)
|
||||
return
|
||||
else
|
||||
mod_ref.on_timer_tick(arena)
|
||||
mod_ref.on_time_tick(arena)
|
||||
end
|
||||
|
||||
minetest.after(1, function()
|
||||
timer_start(mod_ref, arena)
|
||||
time_start(mod_ref, arena)
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -1986,3 +2022,8 @@ end
|
|||
function arena_lib.update_properties(mod)
|
||||
minetest.log("warning", "[ARENA_LIB] arena_lib.update_properties is deprecated: properties are now updated automatically, pretty handy, init? :D")
|
||||
end
|
||||
|
||||
function arena_lib.on_timer_tick(mod, func)
|
||||
minetest.log("warning", "[ARENA_LIB] on_timer_tick is deprecated. Please use on_time_tick instead")
|
||||
arena_lib.mods[mod].on_time_tick = func
|
||||
end
|
||||
|
|
|
@ -52,8 +52,8 @@ end
|
|||
|
||||
|
||||
|
||||
function arena_lib.on_timer_tick(mod, func)
|
||||
arena_lib.mods[mod].on_timer_tick = func
|
||||
function arena_lib.on_time_tick(mod, func)
|
||||
arena_lib.mods[mod].on_time_tick = func
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -105,14 +105,11 @@ function arena_lib.print_arena_info(sender, mod, arena_name)
|
|||
end
|
||||
end
|
||||
|
||||
-- calcolo eventuale timer
|
||||
local timer = ""
|
||||
if arena.timer then
|
||||
if arena.timer_current then
|
||||
timer = minetest.colorize("#eea160", S("Timer: ")) .. minetest.colorize("#cfc6b8", arena.timer .. " (" .. S("current: ") .. arena.timer_current .. ")") .. "\n"
|
||||
else
|
||||
timer = minetest.colorize("#eea160", S("Timer: ")) .. minetest.colorize("#cfc6b8", arena.timer .. " (" .. S("current: ") .. " --- )") .. "\n"
|
||||
end
|
||||
-- calcolo eventuale tempo
|
||||
local time = ""
|
||||
if mod_ref.time_mode ~= 0 then
|
||||
local current_time = not arena.current_time and "---" or arena.current_time
|
||||
time = minetest.colorize("#eea160", S("Initial time: ")) .. minetest.colorize("#cfc6b8", arena.initial_time .. " (" .. S("current: ") .. current_time .. ")") .. "\n"
|
||||
end
|
||||
|
||||
--calcolo proprietà
|
||||
|
@ -172,7 +169,7 @@ function arena_lib.print_arena_info(sender, mod, arena_name)
|
|||
minetest.colorize("#eea160", S("Status: ")) .. minetest.colorize("#cfc6b8", status) .. "\n" ..
|
||||
minetest.colorize("#eea160", S("Sign: ")) .. minetest.colorize("#cfc6b8", sign_pos) .. "\n" ..
|
||||
minetest.colorize("#eea160", S("Spawn points: ")) .. minetest.colorize("#cfc6b8", #arena.spawn_points .. " ( " .. spawners_pos .. ")") .. "\n" ..
|
||||
timer ..
|
||||
time ..
|
||||
minetest.colorize("#eea160", S("Properties: ")) .. minetest.colorize("#cfc6b8", properties) .. "\n" ..
|
||||
minetest.colorize("#eea160", S("Temp properties: ")) .. minetest.colorize("#cfc6b8", temp_properties) .. "\n" ..
|
||||
minetest.colorize("#eea160", S("Team properties: ")) .. minetest.colorize("#cfc6b8", team_properties)
|
||||
|
|
|
@ -34,6 +34,8 @@ Sign of arena @1 successfully removed=Cartello dell'arena @1 rimosso con success
|
|||
[!] There is already a sign for this arena!=[!] Esiste già un cartello per quest'arena!
|
||||
[!] There is no sign to remove assigned to @1!=[!] Non c'è nessun cartello da rimuovere assegnato a @1!
|
||||
Sign of arena @1 successfully set=Cartello dell'arena @1 impostato con successo
|
||||
[!] Timers are not enabled in this mod!=[!] I timer non sono abilitati in questa mod!
|
||||
Arena @1's timer is now @2 seconds=Il timer dell'arena @1 è ora @2 secondi
|
||||
[!] Insufficient spawners, the arena can't be enabled!=[!] Spawner insufficienti, l'arena non può essere abilitata!
|
||||
[!] Sign not set, the arena can't be enabled!=[!] Cartello non impostato, l'arena non può essere abilitata!
|
||||
Arena @1 successfully enabled=Arena @1 abilitata con successo
|
||||
|
@ -91,7 +93,7 @@ loading=in caricamento
|
|||
in game=in partita
|
||||
celebrating=in celebrazione
|
||||
waiting=in attesa
|
||||
Timer: =Timer:
|
||||
Initial time: =Tempo iniziale:
|
||||
current: =corrente:
|
||||
Name: =Nome:
|
||||
Teams: =Squadre:
|
||||
|
@ -169,6 +171,7 @@ Rename arena=Rinomina arena
|
|||
Arena properties=Proprietà arena
|
||||
Delete arena=Cancella arena
|
||||
Overwrite=Sovrascrivi
|
||||
Set timer=Imposta timer
|
||||
Cancel=Annulla
|
||||
Yes=Sì
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ Sign of arena @1 successfully removed=
|
|||
[!] There is already a sign for this arena!=
|
||||
[!] There is no sign to remove assigned to @1!=
|
||||
Sign of arena @1 successfully set=
|
||||
[!] Timers are not enabled in this mod!=
|
||||
Arena @1's timer is now @2s=
|
||||
[!] Insufficient spawners, the arena can't be enabled!=
|
||||
[!] Sign not set, the arena can't be enabled!=
|
||||
Arena @1 successfully enabled=
|
||||
|
@ -91,7 +93,7 @@ loading=
|
|||
in game=
|
||||
celebrating=
|
||||
waiting=
|
||||
Timer: =
|
||||
Initial time: =
|
||||
current: =
|
||||
Name: =
|
||||
Teams: =
|
||||
|
@ -169,6 +171,7 @@ Rename arena=
|
|||
Arena properties=
|
||||
Delete arena=
|
||||
Overwrite=
|
||||
Set timer=
|
||||
Cancel=
|
||||
Yes=
|
||||
|
||||
|
|
|
@ -369,6 +369,7 @@ end
|
|||
|
||||
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
---------------FUNZIONI LOCALI----------------
|
||||
----------------------------------------------
|
||||
|
|
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 124 B |
Before Width: | Height: | Size: 82 B After Width: | Height: | Size: 82 B |
Before Width: | Height: | Size: 82 B After Width: | Height: | Size: 82 B |
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 78 B After Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
After Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |