Fix flag claimed right after creation (#433)
Regression introduced byabbd62ac
: - Sinceabbd62ac
, all map metas are loaded at server startup. - In `ctf_match.create_teams`, `map.teams.pos` is passed to `ctf_flag.add`. - As tables are passed by reference, properties added to `ctf.team("team_name").flags[i]` are also added to ctf_map.map.teams. - This means that the next time this table is passed to `ctf_flag.add`, this table would already contain the `claimed` property, that holds the name of the player who last claimed the flag at this pos, and the name of their team. This is fixed by simply passing `map.teams.pos` to `ctf_flag.add` using `table.copy`
This commit is contained in:
parent
99bb09def6
commit
d4c612d2fb
1 changed files with 1 additions and 1 deletions
|
@ -351,7 +351,7 @@ function ctf_match.create_teams()
|
|||
for key, value in pairs(ctf_map.map.teams) do
|
||||
local name = key
|
||||
local color = value.color
|
||||
local flag = value.pos
|
||||
local flag = table.copy(value.pos)
|
||||
|
||||
if name and color and flag then
|
||||
print(" - creating " .. key)
|
||||
|
|
Loading…
Reference in a new issue