Pulizie di primavera

master
Zughy 2020-07-26 11:04:18 +02:00
parent f8000944fd
commit 9fa9802d37
9 changed files with 59 additions and 60 deletions

View File

@ -15,7 +15,7 @@ function quake.panel_create(arena, p_name)
scale = {x = 44, y = 1.7},
offset = {x = 0, y = -121},
alignment = { x = 0, y = 0 },
text = "quake_hud_panel_playerindicator.png"
text = "quake_hud_panel_playerindicator_teams.png"
},
team_indicator_red = {
scale = {x = 44, y = 1.7},
@ -95,19 +95,20 @@ end
function quake.update_stats(arena)
if arena.teams_enabled then
update_team(arena)
update_team_stats(arena)
else
update_single(arena)
update_solo_stats(arena)
end
end
function update_single(arena)
function update_solo_stats(arena)
local players = ""
local kills = ""
local deaths = ""
-- li ordino per chi ha più kill (fino al table.sort)
-- li ordino per chi ha più kill
local sorted_players = {}
for pl_name, stats in pairs(arena.players) do
table.insert(sorted_players, {pl_name, stats.kills, stats.deaths})
@ -120,7 +121,7 @@ function update_single(arena)
local bar_pos = -121 -- posizione Y più alta della barra per evidenziare il giocatore client
local dist_between_bars = 36 -- distanza Y tra un giocatore e l'altro (equivalente a "\n\n")
-- scrivo le stringhe da stampare a schermo
-- creo le stringhe dei giocatori
for _, stats in pairs(sorted_players) do
players = players .. stats[1] .. "\n\n"
@ -135,7 +136,7 @@ function update_single(arena)
for pl_name, stats in pairs(arena.players) do
local panel = panel_lib.get_panel(pl_name)
local bar_height = players_idx[pl_name] --l'altezza della barra che segnala al client dove si trova nella panel
local bar_height = players_idx[pl_name] -- l'altezza della barra che segnala al client dove si trova nel panello
panel:update(nil,
@ -158,8 +159,7 @@ end
function update_team(arena)
function update_team_stats(arena)
local plyrs_clmn = ""
local kills_clmn = ""
local deaths_clmn = ""
@ -172,16 +172,16 @@ function update_team(arena)
local bar_pos = -121 -- posizione Y più alta della barra per evidenziare il giocatore client
local dist_between_bars = 36 -- distanza Y tra un giocatore e l'altro (equivalente a "\n\n")
local sorted_teams = {}
for id,team in pairs(arena.teams) do
--salvo anche l'id del team così da non dovewr ciclare di nuovo
-- ordino i team
for id, team in pairs(arena.teams) do
--salvo anche l'id del team così da non dover iterare di nuovo
table.insert(sorted_teams, {name = team.name, kills = team.kills, deaths = team.deaths, id = id})
end
--table.sort(sorted_teams, function (a,b) return a.kills > b.kills end)
for _,team in pairs(sorted_teams) do
-- determino come stampate i team seguiti dai giocatori
for _, team in pairs(sorted_teams) do
plyrs_clmn = plyrs_clmn .. S("Team") .. " " .. team.name .. "\n\n"
kills_clmn = kills_clmn .. team.kills .. "\n\n"
deaths_clmn = deaths_clmn .. team.deaths .. "\n\n"
@ -201,7 +201,7 @@ function update_team(arena)
table.sort(sorted_players, function (a,b) return a[2] > b[2] end)
-- scrivo le stringhe da stampare a schermo
-- creo le stringhe dei giocatori
for _, stats in pairs(sorted_players) do
plyrs_clmn = plyrs_clmn .. stats[1] .. "\n\n"
@ -220,9 +220,10 @@ function update_team(arena)
end
-- aggiorno il pannello
for pl_name, stats in pairs(arena.players) do
local panel = panel_lib.get_panel(pl_name)
local bar_height = players_idx[pl_name] --l'altezza della barra che segnala al client dove si trova nella panel
local bar_height = players_idx[pl_name] --l'altezza della barra che segnala al client dove si trova nel panello
panel:update(nil,
@ -250,17 +251,3 @@ function update_team(arena)
end
end
--arena_lib.get_players_in_team(arena, team[1]

View File

@ -120,11 +120,16 @@ arena_lib.on_death("quake", function(arena, p_name, reason)
-- se muoio suicida, perdo una kill
if reason.type == "fall" or reason.player_name == p_name then
local team = arena.teams[arena.players[p_name].teamID]
team.kills = team.kills - 1
team.deaths = team.deaths + 1
arena.players[p_name].kills = arena.players[p_name].kills - 1
quake.update_HUD(arena, p_name, "KLS_data", arena.players[p_name].kills)
local p_stats = arena.players[p_name]
if arena.teams_enabled then
local team = arena.teams[p_stats.teamID]
team.deaths = team.deaths + 1
end
p_stats.kills = p_stats.kills - 1
quake.update_HUD(arena, p_name, "KLS_data", p_stats.kills)
quake.update_stats(arena)
quake.subtract_exp(p_name, 10)

View File

@ -32,10 +32,10 @@ function quake.register_weapon(name, def)
if inv:contains_item("main", "quake:match_over") then return end
user:get_meta():set_int("quake_weap_delay", 0)
end)
-----fine gestione delay -----
----- fine gestione delay -----
--se sono immune e sparo, perdo l'immunità
-- se sono immune e sparo, perdo l'immunità
if inv:contains_item("main", "arena_lib:immunity") then
inv:remove_item("main", "arena_lib:immunity")
end
@ -224,7 +224,9 @@ function kill(arena, p_name, target)
})
local t_name = target:get_player_name()
if t_name ~= p_name then
-- informo dell'uccisione
minetest.chat_send_player(p_name, minetest.colorize("#d7ded7", S("You've killed @1", minetest.colorize("#eea160", t_name))))
minetest.chat_send_player(t_name, minetest.colorize("#d7ded7", S("You've been killed by @1", minetest.colorize("#eea160", p_name))))
@ -235,15 +237,15 @@ function kill(arena, p_name, target)
if arena.teams_enabled then
local team = arena.teams[arena.players[p_name].teamID]
team.kills = team.kills +1
local team_avversario = arena.teams[arena.players[t_name].teamID]
team_avversario.deaths = team_avversario.deaths +1
local enemy_team = arena.teams[arena.players[t_name].teamID]
enemy_team.deaths = team_avversario.deaths +1
end
p_stats.kills = p_stats.kills +1
p_stats.killstreak = p_stats.killstreak +1
quake.calc_kill_leader(arena, p_name)
--eventuale first blood
-- eventuale first blood
if arena.first_blood == "" then
arena.first_blood = p_name
quake.add_achievement(p_name, 5)

View File

@ -7,88 +7,93 @@ ChatCmdBuilder.new("quakeadmin", function(cmd)
-- creazione arene
cmd:sub("create :arena", function(sender, arena_name)
arena_lib.create_arena(sender, mod, arena_name)
end)
end)
cmd:sub("create :arena :minplayers:int :maxplayers:int", function(sender, arena_name, min_players, max_players)
arena_lib.create_arena(sender, mod, arena_name, min_players, max_players)
end)
end)
cmd:sub("create :arena :minplayers:int :maxplayers:int :killcap:int", function(sender, arena_name, min_players, max_players, kill_cap)
arena_lib.create_arena(sender, mod, arena_name, min_players, max_players)
local id, arena = arena_lib.get_arena_by_name("quake", arena_name)
arena.kill_cap = kill_cap
end)
end)
-- rimozione arene
cmd:sub("remove :arena", function(sender, arena_name)
arena_lib.remove_arena(sender, mod, arena_name)
end)
end)
-- rinominazione arene
cmd:sub("rename :arena :newname", function(sender, arena_name, new_name)
arena_lib.rename_arena(sender, mod, arena_name, new_name)
end)
end)
-- cambio giocatori minimi/massimi
cmd:sub("setplayers :arena :minplayers:int :maxplayers:int", function(sender, arena_name, min_players, max_players)
arena_lib.change_players_amount(sender, mod, arena_name, min_players, max_players)
end)
end)
-- abilitazione/disabilitazione team per arena (enable 0 o 1)
cmd:sub("toggleteams :arena :enable:int", function(sender, arena_name, enable)
arena_lib.toggle_teams_per_arena(sender, mod, arena_name, enable)
end)
-- lista arene
cmd:sub("list", function(sender)
arena_lib.print_arenas(sender, mod)
end)
end)
-- info su un'arena specifica
cmd:sub("info :arena", function(sender, arena_name)
arena_lib.print_arena_info(sender, mod, arena_name)
end)
end)
-- info su stats partita
cmd:sub("score :arena", function(sender, arena_name)
arena_lib.print_arena_stats(sender, mod, arena_name)
end)
end)
-- modifiche arena
--editor
cmd:sub("edit :arena", function(sender, arena)
arena_lib.enter_editor(sender, mod, arena)
end)
end)
--inline
-- cartello arena
cmd:sub("setsign :arena", function(sender, arena)
arena_lib.set_sign(sender, nil, nil, mod, arena)
end)
end)
-- spawner (ie. deleteall)
cmd:sub("setspawn :arena :param:word :ID:int", function(sender, arena, param, ID)
arena_lib.set_spawner(sender, mod, arena, nil, param, ID)
end)
end)
-- spawner (ie. deleteall)
cmd:sub("setspawn :arena :team:word :param:word :ID:int", function(sender, arena, team_name, param, ID)
arena_lib.set_spawner(sender, mod, arena, team_name, param, ID)
end)
end)
cmd:sub("setspawn :arena", function(sender, arena)
arena_lib.set_spawner(sender, mod, arena)
end)
end)
-- teletrasporto
cmd:sub("tp :arena", function(sender, arena)
arena_lib.teleport_in_arena(sender, mod, arena)
end)
end)
-- abilitazione e disabilitazione arene
cmd:sub("enable :arena", function(sender, arena)
arena_lib.enable_arena(sender, mod, arena)
end)
end)
cmd:sub("disable :arena", function(sender, arena)
arena_lib.disable_arena(sender, mod, arena)
end)
end)
end, {
description = S("mod management"),

View File

@ -11,7 +11,7 @@ arena_lib.register_minigame("quake", {
join_while_in_progress = true,
celebration_time = 5,
properties = {
kill_cap = 2
kill_cap = 10
},
temp_properties = {
kill_leader = "",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 82 B