mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
Fix unintended case allowing multiple AI spawns shiftstart (#59160)
This commit is contained in:
@@ -259,23 +259,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
|
||||
@@ -341,9 +338,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