mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 18:22:14 +00:00
Adds required jobs support to gamemodes (#44026)
* Adds required_jobs support to gamemodes * alos needs to be checked with no players present * early return
This commit is contained in:
@@ -228,7 +228,7 @@ SUBSYSTEM_DEF(job)
|
||||
* fills var "assigned_role" for all ready players.
|
||||
* This proc must not have any side effect besides of modifying "assigned_role".
|
||||
**/
|
||||
/datum/controller/subsystem/job/proc/DivideOccupations()
|
||||
/datum/controller/subsystem/job/proc/DivideOccupations(list/required_jobs)
|
||||
//Setup new player list and get the jobs list
|
||||
JobDebug("Running DO")
|
||||
|
||||
@@ -248,7 +248,7 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
JobDebug("DO, Len: [unassigned.len]")
|
||||
if(unassigned.len == 0)
|
||||
return TRUE
|
||||
return validate_required_jobs(required_jobs)
|
||||
|
||||
//Scale number of open security officer slots to population
|
||||
setup_officer_positions()
|
||||
@@ -354,7 +354,26 @@ SUBSYSTEM_DEF(job)
|
||||
if(!GiveRandomJob(player))
|
||||
if(!AssignRole(player, SSjob.overflow_role)) //If everything is already filled, make them an assistant
|
||||
return FALSE //Living on the edge, the forced antagonist couldn't be assigned to overflow role (bans, client age) - just reroll
|
||||
|
||||
return validate_required_jobs(required_jobs)
|
||||
|
||||
/datum/controller/subsystem/job/proc/validate_required_jobs(list/required_jobs)
|
||||
if(!required_jobs.len)
|
||||
return TRUE
|
||||
for(var/required_group in required_jobs)
|
||||
var/group_ok = TRUE
|
||||
for(var/rank in required_group)
|
||||
var/datum/job/J = GetJob(rank)
|
||||
if(!J)
|
||||
SSticker.mode.setup_error = "Invalid job [rank] in gamemode required jobs."
|
||||
return FALSE
|
||||
if(J.current_positions < required_group[rank])
|
||||
group_ok = FALSE
|
||||
break
|
||||
if(group_ok)
|
||||
return TRUE
|
||||
SSticker.mode.setup_error = "Required jobs not present."
|
||||
return FALSE
|
||||
|
||||
//We couldn't find a job from prefs for this guy.
|
||||
/datum/controller/subsystem/job/proc/HandleUnassigned(mob/dead/new_player/player)
|
||||
|
||||
@@ -230,7 +230,7 @@ SUBSYSTEM_DEF(ticker)
|
||||
var/can_continue = 0
|
||||
can_continue = src.mode.pre_setup() //Choose antagonists
|
||||
CHECK_TICK
|
||||
can_continue = can_continue && SSjob.DivideOccupations() //Distribute jobs
|
||||
can_continue = can_continue && SSjob.DivideOccupations(mode.required_jobs) //Distribute jobs
|
||||
CHECK_TICK
|
||||
|
||||
if(!GLOB.Debug2)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
var/list/datum/mind/antag_candidates = list() // List of possible starting antags goes here
|
||||
var/list/restricted_jobs = list() // Jobs it doesn't make sense to be. I.E chaplain or AI cultist
|
||||
var/list/protected_jobs = list() // Jobs that can't be traitors because
|
||||
var/list/required_jobs = list() // alternative required job groups eg list(list(cap=1),list(hos=1,sec=2)) translates to one captain OR one hos and two secmans
|
||||
var/required_players = 0
|
||||
var/maximum_players = -1 // -1 is no maximum, positive numbers limit the selection of a mode on overstaffed stations
|
||||
var/required_enemies = 0
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
antag_flag = ROLE_REV
|
||||
false_report_weight = 10
|
||||
restricted_jobs = list("Security Officer", "Warden", "Detective", "AI", "Cyborg","Captain", "Head of Personnel", "Head of Security", "Chief Engineer", "Research Director", "Chief Medical Officer")
|
||||
required_jobs = list(list("Captain"=1),list("Head of Personnel"=1),list("Head of Security"=1),list("Chief Engineer"=1),list("Research Director"=1),list("Chief Medical Officer"=1)) //Any head present
|
||||
required_players = 30
|
||||
required_enemies = 2
|
||||
recommended_enemies = 3
|
||||
|
||||
Reference in New Issue
Block a user