Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/controllers/configuration/entries/game_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
integer = FALSE
min_val = 1

/datum/config_entry/number/min_security_scaling_coeff //how much does the amount of players get divided by to determine forced security positions

/datum/config_entry/number/abductor_scaling_coeff //how many players per abductor team
config_entry_value = 15
integer = FALSE
Expand Down
35 changes: 32 additions & 3 deletions code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ SUBSYSTEM_DEF(job)
//This is basically to ensure that there's atleast a few heads in the round
/datum/controller/subsystem/job/proc/FillHeadPosition()
for(var/level in level_order)
for(var/command_position in GLOB.command_positions)
for(var/command_position in GLOB.original_command_positions)
var/datum/job/job = GetJob(command_position)
if(!job)
continue
Expand All @@ -215,7 +215,7 @@ SUBSYSTEM_DEF(job)
var/list/candidates = FindOccupationCandidates(job, level)
if(!candidates.len)
continue
var/mob/dead/new_player/candidate = PickCommander(candidates) // Yogs -- makes command jobs weighted towards players of greater experience
var/mob/dead/new_player/candidate = PickCommander(candidates,command_position) // Yogs -- makes command jobs weighted towards players of greater experience
if(AssignRole(candidate, command_position))
return 1
return 0
Expand All @@ -224,7 +224,7 @@ SUBSYSTEM_DEF(job)
//This proc is called at the start of the level loop of DivideOccupations() and will cause head jobs to be checked before any other jobs of the same level
//This is also to ensure we get as many heads as possible
/datum/controller/subsystem/job/proc/CheckHeadPositions(level)
for(var/command_position in GLOB.command_positions)
for(var/command_position in GLOB.original_command_positions)
var/datum/job/job = GetJob(command_position)
if(!job)
continue
Expand Down Expand Up @@ -256,6 +256,30 @@ SUBSYSTEM_DEF(job)
return TRUE
return FALSE

/// Rolls a number of security based on the roundstart population
/datum/controller/subsystem/job/proc/FillSecurityPositions()
var/coeff = CONFIG_GET(number/min_security_scaling_coeff)
if(!coeff)
return
var/target_count = initial_players_to_assign / coeff
var/current_count = 0

for(var/level in level_order)
for(var/security_position in GLOB.original_security_positions)
var/datum/job/job = GetJob(security_position)
if(!job)
continue
if((job.current_positions >= job.total_positions) && job.total_positions != -1)
continue
var/list/candidates = FindOccupationCandidates(job, level)
if(!candidates.len)
continue
var/mob/dead/new_player/candidate = pick(candidates) // Yogs -- makes command jobs weighted towards players of greater experience
if(AssignRole(candidate, security_position))
current_count++
if(current_count >= target_count)
return TRUE
return FALSE

/** Proc DivideOccupations
* fills var "assigned_role" for all ready players.
Expand Down Expand Up @@ -320,6 +344,11 @@ SUBSYSTEM_DEF(job)
FillAIPosition()
JobDebug("DO, AI Check end")

//Check for Security
JobDebug("DO, Running Security Check")
FillSecurityPositions()
JobDebug("DO, Security Check end")

//Other jobs are now checked
JobDebug("DO, Running Standard Check")

Expand Down
5 changes: 5 additions & 0 deletions config/game_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ CHANGELING_SCALING_COEFF 8
## Set to 0 to disable scaling and use default numbers instead.
SECURITY_SCALING_COEFF 7

## Scales the number of forced security posistions based on population, this should probably be higher than the one above
## Used as (Forced Security = Population / Coeff)
## Set to 0 to disable forced security rolling
MIN_SECURITY_SCALING_COEFF 10

## The number of objectives traitors get.
## Not including escaping/hijacking.
TRAITOR_OBJECTIVES_AMOUNT 2
Expand Down