Adds configs for hijack population minimums (#31206)

* add config for hijack pop lock

* woopsie daisy

* doth this please you, your lintliness?

* nerd emoji

* address DGL's most beauteous code review
This commit is contained in:
Pooble
2025-12-29 08:49:45 -05:00
committed by GitHub
parent 00eb823fe6
commit 8e79d6c089
10 changed files with 88 additions and 6 deletions
@@ -405,6 +405,12 @@ GLOBAL_LIST_EMPTY(antagonists)
/datum/antagonist/proc/finalize_antag()
return
/**
* Check if this antag can be assigned hijack.
*/
/datum/antagonist/proc/can_assign_hijack_objective()
return FALSE
/**
* Create and assign a full set of randomized, basic human traitor objectives.
* can_hijack - If you want the 5% chance for the antagonist to be able to roll hijack, only true for traitors
@@ -412,11 +418,13 @@ GLOBAL_LIST_EMPTY(antagonists)
/datum/antagonist/proc/forge_basic_objectives(can_hijack = FALSE, number_of_objectives = GLOB.configuration.gamemode.traitor_objectives_amount)
// Hijack objective.
if(can_hijack && prob(5) && !(locate(/datum/objective/hijack) in owner.get_all_objectives()))
if(prob(50)) // 50% chance you have to detonate the nuke instead
add_antag_objective(/datum/objective/nuke)
return
add_antag_objective(/datum/objective/hijack)
return // Hijack should be their only objective (normally), so return.
// Check if hijack is allowed based on player count and number of sec
if(can_assign_hijack_objective())
if(prob(50)) // 50% chance you have to detonate the nuke instead
add_antag_objective(/datum/objective/nuke)
return
add_antag_objective(/datum/objective/hijack)
return // Hijack should be their only objective (normally), so return.
// Will give normal steal/kill/etc. type objectives.
for(var/i in 1 to number_of_objectives)
@@ -21,6 +21,8 @@ RESTRICT_TYPE(/datum/antagonist/traitor)
/// Have we / are we sending a backstab message at this time. If we are, do not send another.
var/sending_backstab = FALSE
/// Whether this traitor was assigned during round start
var/is_roundstart = FALSE
/datum/antagonist/traitor/on_gain()
// Create this in case the traitor wants to mindslaves someone.
@@ -90,7 +92,14 @@ RESTRICT_TYPE(/datum/antagonist/traitor)
/datum/antagonist/traitor/select_organization()
if(is_ai(owner.current))
return
var/chaos = pickweight(list(ORG_CHAOS_HUNTER = ORG_PROB_HUNTER, ORG_CHAOS_MILD = ORG_PROB_MILD, ORG_CHAOS_AVERAGE = ORG_PROB_AVERAGE, ORG_CHAOS_HIJACK = ORG_PROB_HIJACK))
var/list/chaos_weights = list(
ORG_CHAOS_HUNTER = ORG_PROB_HUNTER,
ORG_CHAOS_MILD = ORG_PROB_MILD,
ORG_CHAOS_AVERAGE = ORG_PROB_AVERAGE
)
if(can_assign_hijack_objective())
chaos_weights[ORG_CHAOS_HIJACK] = ORG_PROB_HIJACK
var/chaos = pickweight(chaos_weights)
for(var/org_type in shuffle(subtypesof(/datum/antag_org/syndicate)))
var/datum/antag_org/org = org_type
if(initial(org.chaos_level) == chaos)
@@ -344,3 +353,21 @@ RESTRICT_TYPE(/datum/antagonist/traitor)
var/list/messages = owner.prepare_announce_objectives()
to_chat(owner.current, chat_box_red(messages.Join("<br>")))
SEND_SOUND(owner.current, sound('sound/ambience/alarm4.ogg'))
/// Helper functions for hijack pop checks
/datum/antagonist/traitor/can_assign_hijack_objective()
var/total_players
if(is_roundstart)
total_players = GLOB.roundstart_ready_players
if(total_players < GLOB.configuration.gamemode.min_players_hijack_roundstart)
return FALSE
return TRUE
total_players = get_living_players_count()
if(total_players < GLOB.configuration.gamemode.min_players_hijack_midround)
return FALSE
var/security_count = get_living_security_players_count()
if(security_count < GLOB.configuration.gamemode.min_security_hijack_midround)
return FALSE
return TRUE