From 70c7996986c33cece0fd8b80a3c313b4cf5ab52e Mon Sep 17 00:00:00 2001 From: AnturK Date: Tue, 21 Nov 2017 02:35:20 +0100 Subject: [PATCH 1/2] Fixes abductor teams getting assigned to same pod (#32859) * Fixes abductors getting assigned to same team * Remove explicit null return --- code/game/gamemodes/miniantags/abduction/abduction.dm | 7 ++++++- code/modules/events/abductor.dm | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/code/game/gamemodes/miniantags/abduction/abduction.dm b/code/game/gamemodes/miniantags/abduction/abduction.dm index d6f1b775e9..4eb8642c02 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction.dm @@ -26,6 +26,7 @@ var/max_teams = 4 var/list/datum/objective_team/abductor_team/abductor_teams = list() var/finished = FALSE + var/static/team_count = 0 /datum/game_mode/abduction/announce() to_chat(world, "The current game mode is - Abduction!") @@ -44,7 +45,11 @@ return TRUE /datum/game_mode/abduction/proc/make_abductor_team(datum/mind/agent, datum/mind/scientist) - var/team_number = abductor_teams.len+1 + team_count++ //TODO: Fix the edge case of abductor game mode rolling twice+ and failing to setup on first time. + var/team_number = team_count + + if(team_number > max_teams) + return //or should it try to stuff them in anway ? var/datum/objective_team/abductor_team/team = new team.team_number = team_number diff --git a/code/modules/events/abductor.dm b/code/modules/events/abductor.dm index 9bba04a68d..c7e9baf779 100755 --- a/code/modules/events/abductor.dm +++ b/code/modules/events/abductor.dm @@ -26,7 +26,11 @@ var/mob/living/carbon/human/agent = makeBody(pick_n_take(candidates)) var/mob/living/carbon/human/scientist = makeBody(pick_n_take(candidates)) - GM.post_setup_team(GM.make_abductor_team(agent.mind, scientist.mind)) + var/team = GM.make_abductor_team(agent.mind, scientist.mind) + if(!team) + return MAP_ERROR + + GM.post_setup_team(team) spawned_mobs += list(agent, scientist) return SUCCESSFUL_SPAWN