Don't delete spawners when changing max players amount, if such amount is greater than the spawners amount
This commit is contained in:
parent
6d058c5e3f
commit
40bab99d1c
5
DOCS.md
5
DOCS.md
@ -411,8 +411,9 @@ When a player is inside the editor, they have 2 string metadata containing the n
|
||||
If you want to use an arena_lib function inside the logic of the items of your section, you must pass an additional parameter at the end: `true`. This tells arena_lib that the action is run whilst being inside the editor - e.g. instead of `arena_lib.change_teams_amount(sender, mod, arena_name, amount)`, you shall use `arena_lib.change_teams_amount(sender, mod, arena_name, amount, true)`. If you don't, the function will most likely stop you from running it.
|
||||
|
||||
### 1.12 Things you don't want to do with a light heart
|
||||
* Changing the number of teams, if `variable_teams_amount` is false: 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, except changing their minimum amount: it'll delete your spawners (same as above)
|
||||
* Changing the number of teams in your minigame registration, if `variable_teams_amount` is false: it'll delete your spawners (this has to be done in order to avoid further problems)
|
||||
* Changing the number of teams of an arena (it requires `variable_teams_amount`): it'll delete your spawners (same as above)
|
||||
* Changing the number of max players with something lesser than the spawners 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 = "decremental"` 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
|
||||
<br>
|
||||
|
@ -734,9 +734,25 @@ function arena_lib.change_players_amount(sender, mod, arena_name, min_players, m
|
||||
arena.max_players = old_max_players
|
||||
return end
|
||||
|
||||
-- se lɜ giocatorɜ massimɜ sono cambiatɜ, svuoto i vecchi punti rinascita per evitare problemi
|
||||
-- se lɜ giocatorɜ massimɜ sono cambiatɜ e ci sono più punti rinascita dellɜ giocatorɜ massimɜ, li svuoto
|
||||
if max_players and old_max_players ~= max_players then
|
||||
arena_lib.set_spawner(sender, mod, arena_name, nil, "deleteall", in_editor)
|
||||
local spawners_amount
|
||||
|
||||
if arena.teams_enabled then
|
||||
-- se ci son le squadre, ottengo l'ammontare della squadra con più punti rinascita
|
||||
for t_id, _ in pairs(arena.teams) do
|
||||
local t_spawners_amount = arena_lib.get_arena_spawners_count(arena, t_id)
|
||||
if not spawners_amount or spawners_amount < t_spawners_amount then
|
||||
spawners_amount = t_spawners_amount
|
||||
end
|
||||
end
|
||||
else
|
||||
spawners_amount = arena_lib.get_arena_spawners_count(arena)
|
||||
end
|
||||
|
||||
if max_players < spawners_amount then
|
||||
arena_lib.set_spawner(sender, mod, arena_name, nil, "deleteall", in_editor)
|
||||
end
|
||||
end
|
||||
|
||||
-- aggiorno l'entrata, se esiste
|
||||
|
Loading…
x
Reference in New Issue
Block a user