Skip to content

Commit 51b06de

Browse files
authored
Merge branch 'master' into streak
2 parents f77d978 + 2837285 commit 51b06de

File tree

17 files changed

+252
-67
lines changed

17 files changed

+252
-67
lines changed

.github/workflows/build.yml

-16
This file was deleted.

.github/workflows/luacheck.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: luacheck
2+
on: [push, pull_request]
3+
jobs:
4+
luacheck:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v4
9+
- name: Luacheck
10+
uses: lunarmodules/luacheck@master

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Note that this version may be slightly behind the git version, but it will be a
4545
* If you use Visual Studio Code we recommend these extensions:
4646
* https://marketplace.visualstudio.com/items?itemName=sumneko.lua
4747
* https://marketplace.visualstudio.com/items?itemName=dwenegar.vscode-luacheck
48+
* https://marketplace.visualstudio.com/items?itemName=GreenXenith.minetest-tools
4849

4950
## License
5051

mods/ctf/ctf_modebase/mode_vote.lua

+2-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,8 @@ function ctf_modebase.mode_vote.start_vote()
129129
timer = minetest.after(VOTING_TIME, ctf_modebase.mode_vote.end_vote)
130130
formspec_send_timer = minetest.after(2, send_formspec)
131131
else
132-
ctf_modebase.current_mode_matches = mode_defined_rounds
133-
ctf_modebase.mode_on_next_match = new_mode
134-
ctf_modebase.start_match_after_vote()
132+
votes = {mode_defined_rounds}
133+
ctf_modebase.mode_vote.end_vote()
135134
end
136135
end
137136

mods/ctf/ctf_modebase/ranking_commands.lua

+15-13
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ minetest.register_chatcommand("top50", {
257257
})
258258

259259
minetest.register_chatcommand("make_pro", {
260-
description = "Make yourself or another player a pro",
260+
description = "Make yourself or another player a pro (Will break target player's ranks)",
261261
params = "[mode:technical modename] <playername>",
262262
privs = {ctf_admin = true},
263263
func = function(name, param)
@@ -271,16 +271,17 @@ minetest.register_chatcommand("make_pro", {
271271
end
272272

273273
local old_ranks = mode_data.rankings:get(pname)
274+
local note = ""
274275
if not old_ranks then
275-
return false, string.format("Player '%s' has no rankings!", pname)
276+
note = string.format(" Note: Player '%s' had no rankings before that.", pname)
276277
end
277278

278-
mode_data.rankings:add(pname, {score = 8000, kills = 7, deaths = 5, flag_captures = 5})
279+
mode_data.rankings:set(pname, {score = 8000, kills = 7, deaths = 5, flag_captures = 5})
279280

280281
minetest.log("action", string.format(
281282
"[ctf_admin] %s made player '%s' a pro in mode %s: %s", name, pname, mode_name, dump(old_ranks)
282283
))
283-
return true, string.format("Player '%s' is now a pro!", pname)
284+
return true, string.format("Player '%s' is now a pro.%s", pname, note)
284285
end
285286
})
286287

@@ -306,17 +307,17 @@ minetest.register_chatcommand("add_score", {
306307
end
307308

308309
local old_ranks = mode_data.rankings:get(pname)
310+
local note = ""
309311
if not old_ranks then
310-
return false, string.format("Player '%s' has no rankings!", pname)
312+
note = string.format(" Note: Player '%s' had no rankings before that.", pname)
311313
end
312314

313-
local old_score = old_ranks.score or 0
314-
mode_data.rankings:set(pname, {score = old_score + score})
315+
mode_data.rankings:add(pname, {score = score})
315316

316317
minetest.log("action", string.format(
317318
"[ctf_admin] %s added %s score to player '%s' in mode %s", name, score, pname, mode_name
318319
))
319-
return true, string.format("Added %s score to player '%s'", score, pname)
320+
return true, string.format("Added %s score to player '%s'.%s", score, pname, note)
320321
end
321322
})
322323

@@ -353,29 +354,30 @@ minetest.register_chatcommand("transfer_rankings", {
353354
end
354355
end
355356

357+
local note = ""
356358
if not src_exists then
357359
return false, string.format("Source player '%s' has no rankings!", src)
358360
end
359361
if not dst_exists then
360-
return false, string.format("Destination player '%s' has no rankings!", dst)
362+
note = string.format(" Note: Destination player '%s' had no rankings.", dst)
361363
end
362364

363365
if src == dst then
364366
return false, "Source name and destination name cannot be the same!"
365367
end
366368

367369
for mode_name, mode in pairs(ctf_modebase.modes) do
368-
mode.rankings:add(dst, src_rankings[mode_name])
370+
mode.rankings:set(dst, src_rankings[mode_name], true)
369371
end
370372

371373
for _, mode in pairs(ctf_modebase.modes) do
372374
mode.rankings:set(src, {}, true)
373375
end
374376

375377
minetest.log("action", string.format(
376-
"[ctf_admin] %s transferred rankings from '%s' to '%s': %s -> %s",
377-
name, src, dst, dump(src_rankings), dump(dst_rankings)
378+
"[ctf_admin] %s transferred rankings from '%s' to '%s': %s -> %s | %s",
379+
name, src, dst, dump(src_rankings), dump(dst_rankings), note
378380
))
379-
return true, string.format("Rankings of '%s' have been transferred to '%s'", src, dst)
381+
return true, string.format("Rankings of '%s' have been transferred to '%s'.%s", src, dst, note)
380382
end
381383
})

mods/ctf/ctf_modebase/recent_rankings.lua

+11-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,17 @@ return {
7676
rankings_teams = {}
7777
end,
7878
players = function() return rankings_players end,
79-
teams = function() return rankings_teams end,
79+
teams = function()
80+
local out = {}
81+
82+
for k, v in pairs(rankings_teams) do
83+
if not ctf_teams.team[k].not_playing then
84+
out[k] = v
85+
end
86+
end
87+
88+
return out
89+
end,
8090
}
8191

8292
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# textdomain: ctf_report
2+
<msg>=<mensaje>
3+
Report misconduct or bugs=Reportar falta de conducta o errores
4+
Please add a message to your report.=Por favor añade un mensaje a tu reporte
5+
If it's about (a) particular player(s), please also include their name(s).=Si trata sobre jugadores en específico, por favor incluye sus nombres.
6+
If you're reporting a player,=Si estás reportando a un jugador,
7+
you should also include a reason why (e.g. swearing, griefing, spawnkilling, etc.).=también debes de incluir el motivo (p.j., decir malas palabras, destrucción, matar tan rápido a un jugador que aparezca, etc.)
8+
Report has been sent.=El reporte ha sido enviado.

mods/ctf/ctf_teams/team_chest.lua

+73-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,59 @@ local blacklist = {
55
"default:pick_stone",
66
}
77

8+
--[[
9+
local item_value = {
10+
["grenades:poison"] = 5,
11+
["grenades:frag"] = 6,
12+
["grenades:smoke"] = 2,
13+
["ctf_ranged:pistol_loaded"] = 2,
14+
["ctf_ranged:pistol"] = 1,
15+
["ctf_ranged:rifle"] = 4,
16+
["ctf_ranged:rifle_loaded"] = 5,
17+
["ctf_ranged:smg"] = 4,
18+
["ctf_ranged:smg_loaded"] = 5,
19+
["ctf_ranged:sniper_magnum"] = 8,
20+
["ctf_ranged:sniper_magnum_loaded"] = 10,
21+
["ctf_ranged:ammo"] = 4,
22+
["default:diamond"] = 2.5,
23+
["default:mese_crystal"] = 2,
24+
["default:mese"] = 18,
25+
["default:steel_ingot"] = 1,
26+
["default:iron_lump"] = 1,
27+
["default:sword_diamond"] = 16,
28+
["default:sword_steel"] = 7,
29+
["default:sword_mese"] = 13,
30+
["default:pick_steel"] = 3,
31+
["default:pick_mese"] = 6,
32+
["default:pick_diamond"] = 7,
33+
["default:axe_steel"] = 3,
34+
["default:axe_mese"] = 6,
35+
["default:axe_diamond"] = 7,
36+
["default:shovel_steel"] = 2,
37+
["default:shovel_mese"] = 3,
38+
["default:shovel_diamond"] = 4,
39+
["default:stick"] = 0.5,
40+
["default:wood"] = 1,
41+
["default:cobble"] = 1,
42+
["ctf_map:reinforced_cobble"] = 3,
43+
["ctf_map:damage_cobble"] = 3,
44+
["ctf_map:unwalkable_cobble"] = 1,
45+
["ctf_map:unwalkable_stone"] = 1,
46+
["ctf_map:unwalkable_dirt"] = 1,
47+
["default:steelblock"] = 2.5,
48+
["default:bronzeblock"] = 2.5,
49+
["default:obsidian_block"] = 3.5,
50+
["ctf_map:spike"] = 2.5,
51+
["default:apple"] = 1.5,
52+
["ctf_healing:medkit"] = 6,
53+
["ctf_healing:bandage"] = 6,
54+
}
55+
--]]
56+
57+
58+
59+
60+
861
local function get_chest_access(name)
962
local current_mode = ctf_modebase:get_current_mode()
1063
if not current_mode then return false, false end
@@ -246,13 +299,27 @@ for _, team in ipairs(ctf_teams.teamlist) do
246299
end
247300
end
248301

249-
function def.on_metadata_inventory_put(pos, listname, index, stack, player)
250-
minetest.log("action", string.format("%s puts %s to team chest at %s",
251-
player:get_player_name(),
252-
stack:to_string(),
253-
minetest.pos_to_string(pos)
254-
))
302+
303+
function def.on_metadata_inventory_put(pos, listname, index, stack, player)
304+
minetest.log("action", string.format("%s puts %s to team chest at %s",
305+
player:get_player_name(),
306+
stack:to_string(),
307+
minetest.pos_to_string(pos)
308+
))
309+
local meta = stack:get_meta()
310+
local dropped_by = meta:get_string("dropped_by")
311+
local pname = player:get_player_name()
312+
if dropped_by ~= pname and dropped_by ~= "" then
313+
local cur_mode = ctf_modebase:get_current_mode()
314+
if pname and cur_mode then
315+
--local score = (item_value[stack:get_name()] or 0) * stack:get_count()
316+
cur_mode.recent_rankings.add(pname, { score = 1 }, false)
317+
end
255318
end
319+
meta:set_string("dropped_by", "")
320+
local inv = minetest.get_inventory({ type="node", pos=pos })
321+
inv:set_stack(listname, index, stack)
322+
end
256323

257324
function def.on_metadata_inventory_take(pos, listname, index, stack, player)
258325
minetest.log("action", string.format("%s takes %s from team chest at %s",
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# textdomain: afkkick
2+
Allow to AFK without being kicked=Permite estar inactivo sin ser sacado del juego
3+
Warning, you have @1 seconds to move or be kicked=Advertencia, tienes @1 segundo(s) para moverte o ser sacado del juego

mods/other/playertag/init.lua

+39-24
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,56 @@ playertag = {
99
TYPE_ENTITY = TYPE_ENTITY,
1010
}
1111

12+
local function remove_entity_tag(player)
13+
local tag = players[player:get_player_name()]
14+
if tag then
15+
if tag.entity then
16+
tag.entity.object:remove()
17+
tag.entity = nil
18+
end
19+
20+
if tag.nametag_entity then
21+
tag.nametag_entity.object:remove()
22+
tag.nametag_entity = nil
23+
end
24+
25+
if tag.symbol_entity then
26+
tag.symbol_entity.object:remove()
27+
tag.symbol_entity = nil
28+
end
29+
end
30+
end
31+
1232
local function add_entity_tag(player, old_observers)
33+
local pname = player:get_player_name()
34+
local ppos = player:get_pos()
35+
1336
-- Hide fixed nametag
1437
player:set_nametag_attributes({
1538
color = {a = 0, r = 0, g = 0, b = 0}
1639
})
1740

18-
local ent = minetest.add_entity(player:get_pos(), "playertag:tag")
41+
remove_entity_tag(player)
42+
43+
local ent = minetest.add_entity(ppos, "playertag:tag")
1944
local ent2 = false
2045
local ent3 = false
2146

47+
if not ent then
48+
minetest.after(1, add_entity_tag, player, old_observers)
49+
return
50+
end
51+
2252
if ent.set_observers then
23-
ent2 = minetest.add_entity(player:get_pos(), "playertag:tag")
53+
ent2 = minetest.add_entity(ppos, "playertag:tag")
2454
ent2:set_observers(old_observers.nametag_entity or {})
2555
ent2:set_properties({
26-
nametag = player:get_player_name(),
56+
nametag = pname,
2757
nametag_color = "#EEFFFFDD",
2858
nametag_bgcolor = "#0000002D"
2959
})
3060

31-
ent3 = minetest.add_entity(player:get_pos(), "playertag:tag")
61+
ent3 = minetest.add_entity(ppos, "playertag:tag")
3262
ent3:set_observers(old_observers.symbol_entity or {})
3363
ent3:set_properties({
3464
collisionbox = { 0, 0, 0, 0, 0, 0 },
@@ -40,9 +70,9 @@ local function add_entity_tag(player, old_observers)
4070

4171
-- Build name from font texture
4272
local texture = "npcf_tag_bg.png"
43-
local x = math.floor(134 - ((player:get_player_name():len() * 11) / 2))
73+
local x = math.floor(134 - ((pname:len() * 11) / 2))
4474
local i = 0
45-
player:get_player_name():gsub(".", function(char)
75+
pname:gsub(".", function(char)
4676
local n = "_"
4777
if char:byte() > 96 and char:byte() < 123 or char:byte() > 47 and char:byte() < 58 or char == "-" then
4878
n = char
@@ -64,24 +94,9 @@ local function add_entity_tag(player, old_observers)
6494
end
6595

6696
-- Store
67-
players[player:get_player_name()].entity = ent:get_luaentity()
68-
players[player:get_player_name()].nametag_entity = ent2 and ent2:get_luaentity()
69-
players[player:get_player_name()].symbol_entity = ent3 and ent3:get_luaentity()
70-
end
71-
72-
local function remove_entity_tag(player)
73-
local tag = players[player:get_player_name()]
74-
if tag and tag.entity then
75-
tag.entity.object:remove()
76-
77-
if tag.nametag_entity then
78-
tag.nametag_entity.object:remove()
79-
end
80-
81-
if tag.symbol_entity then
82-
tag.symbol_entity.object:remove()
83-
end
84-
end
97+
players[pname].entity = ent:get_luaentity()
98+
players[pname].nametag_entity = ent2 and ent2:get_luaentity()
99+
players[pname].symbol_entity = ent3 and ent3:get_luaentity()
85100
end
86101

87102
local function update(player, settings)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# textdomain: random_messages
2+
3+
To talk to only your team, start your messages with /t. For example, /t Hello team!=Para hablar únicamente a tu equipo, comienza tus mensajes con /t. Por ejemplo, /t ¡Hola equipo!
4+
Use apples to quickly restore your health.=Use manzanas para restaurar tu salud rápidamente
5+
Moving or fighting can avoid an inactivity kick.=Moverse o pelear puede evitar ser sacado por inactividad
6+
Gain more score by killing more than you die, by healing teammates with bandages, or by capturing the flag.=Gana más puntos por tener más asesinatos que muertes, dando vida a tus compañeros de equipo con vendajes, o capturando la bandera.
7+
You gain more score the better the opponent you defeat.=Obtendrás mejor puntuación cuanto mejor sea el oponente que derrotes.
8+
Find weapons in chests or mine and use furnaces to make stronger swords.=Encuentra armas en los cofres o mina y use hornos para crear espadas más fuertes.
9+
Use team doors (steel) to stop the enemy walking into your base.=Use puertas del equipo (hierro) para prevenir al enemigo entrar a tu base.
10+
Sprint by pressing the fast key (E) when you have stamina.=Corre presionando la tecla de rápido (E) cuando tengas resistencia.
11+
Like CTF? Give feedback using /report, and consider donating at rubenwardy.com/donate=¿Te gusta CTF? De su opinión usando /report, y considere donar en rubenwardy.com/donate
12+
Want to submit your own map? Visit https://github.com/MT-CTF/maps to get involved.=¿Quieres publicar tu propio mapa? Visita https://github.com/MT-CTF/maps para participar.
13+
Using limited resources for building structures that don't strengthen your base's defences is discouraged.=Usar recursos limitados para construir estructuras que no fortalezcan las defensas de tu base no está aconsejado.
14+
To report misbehaving players to moderators, please use /report <name> <action>=Para reportar jugadores que se porten mal a los moderadores, por favor use /report <nombre> <acción>
15+
Swearing, trolling and being rude will not be tolerated and strict action will be taken.=Decir maldiciones, engañar y ser grosero no será tolerado y se tomarán medidas estrictas.
16+
Trapping team mates on purpose is strictly against the rules and you will be kicked immediately.=Atrapar a tus compañeros de equipo a propósito está estrictamente en contra de las reglas y serás sacado fuera inmediatamente.
17+
Help your team claim victory by storing extra weapons in the team chest, and never taking more than you need.=Ayuda a tu equipo reclamar la victoria guardando armas adicionales en el cofre del equipo, y nunca tomar más de lo que necesites.
18+
Excessive spawn-killing is a direct violation of the rules - appropriate punishments will be given.=Matar a otros jugadores que acaban de aparecer excesivamente es una violación directa de las reglas - se darán los castigos necesarios.
19+
Use /r to check your rank and other statistics.=Use /r para ver tu clasificación y otras estadísticas.
20+
Use /r <playername> to check the rankings of another player.=Use /r <nombredejugador> para ver las clasificaciones de otro jugador.
21+
Use bandages on team-mates to heal them by 3-4 HP if their health is below 15 HP.=Use vendajes en tus compañeros de equipo para darles 3-4 de vida si su salud está debajo de 15 de vida.
22+
Use /m to add a team marker at pointed location, that's visible only to team-mates.=Use /m para añadir un marcador en la ubicación señalada, que es solamente visible para tus compañeros de equipo.
23+
Use /summary (or /s) to check scores of the current match and the previous match.=Use /summary (o /s) para ver las puntuaciones de la partida actual y de la partida anterior.
24+
Strengthen your team by capturing enemy flags.=Fortalece tu equipo capturando banderas enemigas.
25+
Hitting your enemy does more damage than not hitting them.=Pegarle a tu enemigo hace más daño que no pegarle.
26+
Use /top50 command to see the leaderboard.=Use /top50 para ver la tabla de clasificación.
27+
Use /top50 <mode:technical modename> to see the leaderboard on another mode. For example: /top50 mode:nade_fight.=Use /top50 <modo:nombre de modo técnico> para ver la tabla de clasificación en otro modo. Por ejemplo: /top50 mode:nade_fight.
28+
To check someone's rank on another mode use /r <mode:technical modename> <playername>. For example: /r mode:nade_fight randomplayer.=Para ver la clasificación de alguien en otro modo use /r <modo:nombre de modo técnico> <nombredejugador>. Por ejemplo: /r mode:nade_fight jugador
29+
To check someone's team use /team player <player_name>.=Para ver a que equipo pertenece alguien use /team player <nombre_de_jugador>.
30+
To check all team members use /team.=Para ver todos los miembros de tu equipo use /team.
31+
You can capture multiple enemy flags at once!=¡Puedes capturar múltiples banderas enemigas al mismo tiempo!
32+
Consider joining our Discord server at https://discord.gg/vcZTRPX=Considera unirte a nuestro servidor de Discord en https://discord.gg/vcZTRPX
33+
You can press sneak while jumping, to jump up two blocks.=Puedes presionar sneak mientras brincas, para brincar dos bloques.
34+
Use /donate <playername> <score> to reward a team-mate for their work.=Use /donate <nombredejugador> <puntos> para recompensar a un compañero del equipo por su trabajo.

0 commit comments

Comments
 (0)