From ccda750ee1063652fd24e5d31ac80166fd524bf7 Mon Sep 17 00:00:00 2001 From: ccomp5950 Date: Thu, 24 Dec 2015 02:43:52 -0500 Subject: [PATCH] AI Malf will no longer be able to spawn a non-antag AI fixes #10554 --- code/game/gamemodes/game_mode.dm | 2 + .../game/gamemodes/malfunction/malfunction.dm | 1 + code/game/jobs/job_controller.dm | 38 +------------------ 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 8dea479de5..d5e55f4c12 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -16,6 +16,8 @@ var/global/list/additional_antag_types = list() var/ert_disabled = 0 // ERT cannot be called. var/deny_respawn = 0 // Disable respawn during this round. + var/list/disabled_jobs = list() // Mostly used for Malf. This check is performed in job_controller so it doesn't spawn a regular AI. + var/shuttle_delay = 1 // Shuttle transit time is multiplied by this. var/auto_recall_shuttle = 0 // Will the shuttle automatically be recalled? diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index a86773235b..35646524f0 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -9,3 +9,4 @@ end_on_antag_death = 0 auto_recall_shuttle = 0 antag_tags = list(MODE_MALFUNCTION) + disabled_jobs = list("AI") diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 142190dca5..82441ead32 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -185,36 +185,6 @@ var/global/datum/controller/occupations/job_master return - proc/FillAIPosition() - var/ai_selected = 0 - var/datum/job/job = GetJob("AI") - if(!job) return 0 - if((job.title == "AI") && (config) && (!config.allow_ai)) return 0 - - for(var/i = job.total_positions, i > 0, i--) - for(var/level = 1 to 3) - var/list/candidates = list() - if(ticker.mode.name == "AI malfunction")//Make sure they want to malf if its malf - candidates = FindOccupationCandidates(job, level, BE_MALF) - else - candidates = FindOccupationCandidates(job, level) - if(candidates.len) - var/mob/new_player/candidate = pick(candidates) - if(AssignRole(candidate, "AI")) - ai_selected++ - break - //Malf NEEDS an AI so force one if we didn't get a player who wanted it - if((ticker.mode.name == "AI malfunction")&&(!ai_selected)) - unassigned = shuffle(unassigned) - for(var/mob/new_player/player in unassigned) - if(jobban_isbanned(player, "AI")) continue - if(AssignRole(player, "AI")) - ai_selected++ - break - if(ai_selected) return 1 - return 0 - - /** Proc DivideOccupations * fills var "assigned_role" for all ready players. * This proc must not have any side effect besides of modifying "assigned_role". @@ -260,11 +230,6 @@ var/global/datum/controller/occupations/job_master FillHeadPosition() Debug("DO, Head Check end") - //Check for an AI - Debug("DO, Running AI Check") - FillAIPosition() - Debug("DO, AI Check end") - //Other jobs are now checked Debug("DO, Running Standard Check") @@ -275,6 +240,7 @@ var/global/datum/controller/occupations/job_master // Loop through all levels from high to low var/list/shuffledoccupations = shuffle(occupations) + // var/list/disabled_jobs = ticker.mode.disabled_jobs // So we can use .Find down below without a colon. for(var/level = 1 to 3) //Check the head jobs first each level CheckHeadPositions(level) @@ -284,7 +250,7 @@ var/global/datum/controller/occupations/job_master // Loop through all jobs for(var/datum/job/job in shuffledoccupations) // SHUFFLE ME BABY - if(!job) + if(!job || ticker.mode.disabled_jobs.Find(job.title) ) continue if(jobban_isbanned(player, job.title))