Massive refactoring pt2 (xp system removed)

master
Zughy 2022-05-30 23:00:10 +02:00
parent d82b66d0f7
commit 7a2216b5f4
8 changed files with 24 additions and 128 deletions

View File

@ -85,7 +85,6 @@ dofile(srcpath .. "/utils.lua")
dofile(srcpath .. "/arena_lib/arena_manager.lua")
dofile(srcpath .. "/arena_lib/arena_timer.lua")
-- debug
dofile(srcpath .. "/debug/debug.lua")
dofile(srcpath .. "/debug/testkit.lua")
-- HUD
dofile(srcpath .. "/HUD/hud_achievements.lua")

View File

@ -7,21 +7,9 @@
orange=arancione
blue=blu
# info_panel.lua
Team=Squadra
# achievements.lua
two in one=due in uno
three in one=tre in uno
[!] This player doesn't exist!=[!] Questo giocatore non esiste!
@1 ACHIEVEMENTS=PRESTIGI DI @1
# commands.lua
mod management=gestione della mod
# exp_manager.lua
pass points=punti pass
# player_manager.lua
Back in the game in @1=Di nuovo in partita tra @1
@ -47,6 +35,7 @@ CRITICAL!=CRITICO!
TDs=TD
Deaths=Morti
Points=Punti
Team=Squadra
# modes/TD/ball.lua
Ball reset=Palla resettata
@ -58,6 +47,12 @@ Your team got the ball!=La tua squadra ha preso la palla!
You got the ball!=Hai preso la palla!
Enemy team got the ball!=La squadra avversaria ha preso la palla!
# player/achievements.lua
two in one=due in uno
three in one=tre in uno
[!] This player doesn't exist!=[!] Questo giocatore non esiste!
@1 ACHIEVEMENTS=PRESTIGI DI @1
# weapons/pixelgun.lua
Pixelgun=Pixelgun

View File

@ -7,21 +7,9 @@
orange=
blue=
# info_panel.lua
Team=
# achievements.lua
two in one=
three in one=
[!] This player doesn't exist!=
@1 ACHIEVEMENTS=
# commands.lua
mod management=
# exp_manager.lua
pass points=
# player_manager.lua
Back in the game in @1=
@ -47,6 +35,7 @@ CRITICAL!=
TDs=
Deaths=
Points=
Team=
# modes/TD/ball.lua
Ball reset=
@ -58,6 +47,12 @@ Your team got the ball!=
You got the ball!=
Enemy team got the ball!=
# player/achievements.lua
two in one=
three in one=
[!] This player doesn't exist!=
@1 ACHIEVEMENTS=
# weapons/pixelgun.lua
Pixelgun=

View File

@ -69,9 +69,9 @@ function block_league.info_panel_update(arena)
local sorted_teams = {}
-- ordino i team
-- ordino le squadre
for id, team in pairs(arena.teams) do
--salvo anche l'id del team così da non dover iterare di nuovo
--salvo anche l'id della squadra così da non dover iterare di nuovo
table.insert(sorted_teams, {name = team.name, id = id})
end
@ -86,7 +86,7 @@ function block_league.info_panel_update(arena)
third_clmn_value = "deaths"
end
-- determino come stampare i team seguiti dai giocatori
-- determino come stampare le squadre seguite dai giocatori
for _, team in pairs(sorted_teams) do
plyrs_clmn = plyrs_clmn .. S("Team") .. " " .. team.name .. "\n\n"
pts_clmn = pts_clmn .. S("Points") .. "\n\n"

View File

@ -77,8 +77,6 @@ arena_lib.on_celebration("block_league", function(arena, winners)
block_league.deactivate_zoom(player)
player:get_meta():set_int("bl_immunity", 1)
--block_league.calculate_and_add_xp(pl_name, pl_stats.entering_time, pl_stats.points)
panel_lib.get_panel(pl_name, "bl_info_panel"):show()
end

View File

@ -135,22 +135,6 @@ ChatCmdBuilder.new("bladmin", function(cmd)
block_league.enter_test_mode(sender)
end)
-- gestione esperienza
cmd:sub("exp :player :option :amount:number", function(sender, p_name, option, amount)
if option == "set" then
block_league.set_xp(p_name, amount)
end
end)
cmd:sub("exp :option", function(sender, option) -- BETA ONLY, DANGER ZONE
if option == "resetall" then
for pl_name, _ in pairs(block_league.players) do
block_league.set_xp(pl_name, 0)
end
minetest.chat_send_player(sender, "All players' xp has been reset")
end
end)
end, {
description = S("mod management"),
@ -169,8 +153,4 @@ ChatCmdBuilder.new("bleague", function(cmd)
block_league.list_achievements(sender, p_name)
end)
cmd:sub("info :playername", function(sender, p_name)
block_league.print_player_stats(sender, p_name)
end)
end,{})

View File

@ -1,35 +0,0 @@
local S = minetest.get_translator("block_league")
-- debug se devo mostrare una posizione
function block_league.show_position(pos, time)
minetest.add_particlespawner({
amount = 80,
time = .1,
minpos = {x=pos.x,y=pos.y,z=pos.z},
maxpos = {x=pos.x,y=pos.y,z=pos.z},
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0, z=0},
minacc = {x=0, y=-0, z=0},
maxacc = {x=0, y=-0, z=0},
minexptime = time,
maxexptime = time,
minsize = 2,
maxsize = 2,
collisiondetection = false,
vertical = false,
texture = "bl_rocket_particle.png",
})
end
function block_league.print_player_stats(sender, p_name)
local pl_stats --= block_league.players[p_name]
if not pl_stats then
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This player doesn't exist!")))
return end
local stats = "[Block League] Player: " .. p_name .. " | Exp: " .. pl_stats.XP
minetest.chat_send_player(sender, stats)
end

View File

@ -1,43 +1,7 @@
-- EXP is disabled right now as we haven't decided yet what purpose should have,
-- aside as a barrier for future ranked games
local XP_MAX = 5000
function block_league.calculate_and_add_xp(p_name, entering_time, points)
local minutes = entering_time / 60
local xp = points > 4 and math.floor((points * 9.375) + (minutes * 12.5)) or 0
block_league.add_xp(p_name, xp)
end
function block_league.add_xp(p_name, xp)
local p_xp = 0 --block_league.players[p_name].XP
if p_xp == XP_MAX then
--minetest.chat_send_player(p_name, "Hai raggiunto il livello massimo")
return end
local tot_xp = math.min(p_xp + xp, XP_MAX)
minetest.chat_send_player(p_name, minetest.colorize("#28ccdf", "[Block League] +" .. xp .. " " .. S("pass points")))
--block_league.players[p_name].XP = tot_xp
end
function block_league.set_xp(p_name, xp)
if xp < 0 or xp > XP_MAX then
return false, "Qualche parametro non è corretto"
end
minetest.chat_send_player(p_name, "La tua exp è ora " .. xp)
--block_league.players[p_name].XP = xp
block_league.update_storage(p_name)
end
-- EXP is not implemented for the moment, as the probably sole purpose of it would be to
-- act as a barrier for future ranked games (quite unlikely to happen, because there are
-- several other priorities, and time is what it is).
-- I'm against putting an experience system just to see people farming for no reason at all.
--
-- The formula we went for it was
-- xp = points > 4 and math.floor((points * 9.375) + (minutes * 12.5)) or 0