mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
[MIRROR] Fix unintended case allowing multiple AI spawns shiftstart (#5808)
* Fix unintended case allowing multiple AI spawns shiftstart (#59160) * Fix unintended case allowing multiple AI spawns shiftstart Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
This commit is contained in:
@@ -290,23 +290,20 @@ SUBSYSTEM_DEF(job)
|
||||
var/mob/dead/new_player/candidate = pick(candidates)
|
||||
AssignRole(candidate, command_position)
|
||||
|
||||
/datum/controller/subsystem/job/proc/FillAIPosition()
|
||||
var/ai_selected = FALSE
|
||||
var/datum/job/job = GetJob("AI")
|
||||
if(!job)
|
||||
return FALSE
|
||||
for(var/i = job.total_positions, i > 0, i--)
|
||||
/// Attempts to fill out all available AI positions.
|
||||
/datum/controller/subsystem/job/proc/fill_ai_positions()
|
||||
var/datum/job/ai_job = GetJob("AI")
|
||||
if(!ai_job)
|
||||
return
|
||||
// In byond for(in to) loops, the iteration is inclusive so we need to stop at ai_job.total_positions - 1
|
||||
for(var/i in ai_job.current_positions to ai_job.total_positions - 1)
|
||||
for(var/level in level_order)
|
||||
var/list/candidates = list()
|
||||
candidates = FindOccupationCandidates(job, level)
|
||||
candidates = FindOccupationCandidates(ai_job, level)
|
||||
if(candidates.len)
|
||||
var/mob/dead/new_player/candidate = pick(candidates)
|
||||
if(AssignRole(candidate, "AI"))
|
||||
ai_selected++
|
||||
break
|
||||
if(ai_selected)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
/** Proc DivideOccupations
|
||||
@@ -372,9 +369,9 @@ SUBSYSTEM_DEF(job)
|
||||
FillHeadPosition()
|
||||
JobDebug("DO, Head Check end")
|
||||
|
||||
//Check for an AI
|
||||
// Fill out any remaining AI positions.
|
||||
JobDebug("DO, Running AI Check")
|
||||
FillAIPosition()
|
||||
fill_ai_positions()
|
||||
JobDebug("DO, AI Check end")
|
||||
|
||||
//Other jobs are now checked
|
||||
|
||||
Reference in New Issue
Block a user