From ac224647cbbab8a77440be9e0fb9306df5d30104 Mon Sep 17 00:00:00 2001 From: Geeves Date: Tue, 8 Oct 2019 22:19:48 +0200 Subject: [PATCH] Security + Heads of Staff are less likely to become certain types of antags (#7083) Revives #5809 Chances of getting antag: Security Officer: 50% chance to get antag. Security Cadet: 75% chance to get antag. Warden: 40% chance to get antag. Detective: 50% chance to get antag. Forensic Technician 50% chance to get antag. Heads of Staff: 25% chance to get antag. Antags affected: Changeling Traitor Vampire Cultist Revolutionary Loyalist --- code/game/antagonist/antagonist.dm | 5 ++- code/game/antagonist/antagonist_helpers.dm | 6 +++ code/game/antagonist/station/changeling.dm | 1 + code/game/antagonist/station/cultist.dm | 1 + code/game/antagonist/station/loyalist.dm | 1 + code/game/antagonist/station/revolutionary.dm | 1 + code/game/antagonist/station/traitor.dm | 1 + code/game/antagonist/station/vampire.dm | 1 + code/game/gamemodes/game_mode.dm | 4 ++ html/changelogs/geeves-targettingSec.yml | 41 +++++++++++++++++++ 10 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 html/changelogs/geeves-targettingSec.yml diff --git a/code/game/antagonist/antagonist.dm b/code/game/antagonist/antagonist.dm index d3a0f0151a6..38da6769880 100644 --- a/code/game/antagonist/antagonist.dm +++ b/code/game/antagonist/antagonist.dm @@ -4,6 +4,7 @@ var/list/restricted_jobs = list() // Jobs that cannot be this antagonist (depending on config) var/list/protected_jobs = list() // As above. var/list/restricted_species = list() // species that cannot be this antag - Ryan784 + var/list/chance_restricted_jobs = list() // chance based restrictions // Strings. var/welcome_text = "Cry havoc and let slip the dogs of war!" @@ -93,7 +94,7 @@ return 1 // Get the raw list of potential players. -/datum/antagonist/proc/build_candidate_list(var/ghosts_only, var/allow_animals = 0) +/datum/antagonist/proc/build_candidate_list(var/ghosts_only, var/allow_animals = 0, var/chance_per_job = TRUE) candidates = list() // Clear. // Prune restricted status. Broke it up for readability. @@ -111,6 +112,8 @@ log_debug("[key_name(player)] is not eligible to become a [role_text]: They are blacklisted for this role!") else if(player_is_antag(player)) log_debug("[key_name(player)] is not eligible to become a [role_text]: They are already an antagonist!") + else if(!can_become_antag_chance(player) && chance_per_job) + log_debug("[key_name(player)] is not eligible to become a [role_text]: They are unlucky (based on job)!") else candidates += player diff --git a/code/game/antagonist/antagonist_helpers.dm b/code/game/antagonist/antagonist_helpers.dm index 13fdc257277..b13c341926f 100644 --- a/code/game/antagonist/antagonist_helpers.dm +++ b/code/game/antagonist/antagonist_helpers.dm @@ -12,6 +12,12 @@ return 0 return 1 +/datum/antagonist/proc/can_become_antag_chance(var/datum/mind/player) + if(!isnull(chance_restricted_jobs[player.assigned_role])) + return prob(chance_restricted_jobs[player.assigned_role]) + else + return 1 + /datum/antagonist/proc/antags_are_dead() for(var/datum/mind/antag in current_antagonists) if(mob_path && !istype(antag.current,mob_path)) diff --git a/code/game/antagonist/station/changeling.dm b/code/game/antagonist/station/changeling.dm index d11f74a3c6d..a7b3416835c 100644 --- a/code/game/antagonist/station/changeling.dm +++ b/code/game/antagonist/station/changeling.dm @@ -7,6 +7,7 @@ restricted_jobs = list("AI", "Cyborg", "Head of Security", "Captain", "Internal Affairs Agent") protected_jobs = list("Security Officer", "Security Cadet", "Warden", "Detective", "Forensic Technician") + chance_restricted_jobs = list("Security Officer" = 50, "Security Cadet" = 75, "Warden" = 40, "Detective" = 50, "Forensic Technician" = 50, "Head of Personnel" = 25, "Chief Engineer" = 25, "Research Director" = 25, "Chief Medical Officer" = 25) //Second value is chance to be considered for antag. Unlisted roles here are 100 by default. restricted_species = list( "Baseline Frame", "Shell Frame", diff --git a/code/game/antagonist/station/cultist.dm b/code/game/antagonist/station/cultist.dm index fb1257fad52..5838e43d5b6 100644 --- a/code/game/antagonist/station/cultist.dm +++ b/code/game/antagonist/station/cultist.dm @@ -19,6 +19,7 @@ var/datum/antagonist/cultist/cult bantype = "cultist" restricted_jobs = list("Chaplain","AI", "Cyborg", "Internal Affairs Agent", "Head of Security", "Captain") protected_jobs = list("Security Officer", "Security Cadet", "Warden", "Detective", "Forensic Technician") + chance_restricted_jobs = list("Security Officer" = 50, "Security Cadet" = 75, "Warden" = 40, "Detective" = 50, "Forensic Technician" = 50, "Head of Personnel" = 25, "Chief Engineer" = 25, "Research Director" = 25, "Chief Medical Officer" = 25) //Second value is chance to be considered for antag. Unlisted roles here are 100 by default. feedback_tag = "cult_objective" antag_indicator = "cult" welcome_text = "You have a talisman in your possession; one that will help you start the cult on this station. Use it well and remember - there are others." diff --git a/code/game/antagonist/station/loyalist.dm b/code/game/antagonist/station/loyalist.dm index adf62d50e72..35b9ca9cfe4 100644 --- a/code/game/antagonist/station/loyalist.dm +++ b/code/game/antagonist/station/loyalist.dm @@ -28,6 +28,7 @@ var/datum/antagonist/loyalists/loyalists faction_indicator = "loyal" faction_invisible = 1 restricted_jobs = list("AI", "Cyborg") + chance_restricted_jobs = list("Security Officer" = 50, "Security Cadet" = 75, "Warden" = 40, "Detective" = 50, "Forensic Technician" = 50) //Second value is chance to be considered for antag. Unlisted roles here are 100 by default. /datum/antagonist/loyalists/New() ..() diff --git a/code/game/antagonist/station/revolutionary.dm b/code/game/antagonist/station/revolutionary.dm index 416a756aebc..cc0b0ec9c8e 100644 --- a/code/game/antagonist/station/revolutionary.dm +++ b/code/game/antagonist/station/revolutionary.dm @@ -30,6 +30,7 @@ var/datum/antagonist/revolutionary/revs restricted_jobs = list("AI", "Cyborg") protected_jobs = list("Security Officer", "Security Cadet", "Warden", "Detective", "Forensic Technician", "Head of Personnel", "Chief Engineer", "Research Director", "Chief Medical Officer", "Captain", "Head of Security", "Internal Affairs Agent") + chance_restricted_jobs = list("Security Officer" = 50, "Security Cadet" = 75, "Warden" = 40, "Detective" = 50, "Forensic Technician" = 50, "Head of Personnel" = 25, "Chief Engineer" = 25, "Research Director" = 25, "Chief Medical Officer" = 25) //Second value is chance to be considered for antag. Unlisted roles here are 100 by default. /datum/antagonist/revolutionary/New() ..() diff --git a/code/game/antagonist/station/traitor.dm b/code/game/antagonist/station/traitor.dm index 4ee21e3b491..cfc92d730c9 100644 --- a/code/game/antagonist/station/traitor.dm +++ b/code/game/antagonist/station/traitor.dm @@ -5,6 +5,7 @@ var/datum/antagonist/traitor/traitors id = MODE_TRAITOR restricted_jobs = list("Internal Affairs Agent", "Head of Security", "Captain", "AI") protected_jobs = list("Security Officer", "Security Cadet", "Warden", "Detective", "Forensic Technician") + chance_restricted_jobs = list("Security Officer" = 50, "Security Cadet" = 75, "Warden" = 40, "Detective" = 50, "Forensic Technician" = 50, "Head of Personnel" = 25, "Chief Engineer" = 25, "Research Director" = 25, "Chief Medical Officer" = 25) //Second value is chance to be considered for antag. Unlisted roles here are 100 by default. flags = ANTAG_SUSPICIOUS | ANTAG_RANDSPAWN | ANTAG_VOTABLE faction = "syndicate" diff --git a/code/game/antagonist/station/vampire.dm b/code/game/antagonist/station/vampire.dm index 142d80cb6c5..f9c5575b300 100644 --- a/code/game/antagonist/station/vampire.dm +++ b/code/game/antagonist/station/vampire.dm @@ -9,6 +9,7 @@ var/datum/antagonist/vampire/vamp = null restricted_jobs = list("AI", "Cyborg", "Chaplain", "Head of Security", "Captain", "Internal Affairs Agent") protected_jobs = list("Security Officer", "Security Cadet", "Warden", "Detective", "Forensic Technician") + chance_restricted_jobs = list("Security Officer" = 50, "Security Cadet" = 75, "Warden" = 40, "Detective" = 50, "Forensic Technician" = 50, "Head of Personnel" = 25, "Chief Engineer" = 25, "Research Director" = 25, "Chief Medical Officer" = 25) //Second value is chance to be considered for antag. Unlisted roles here are 100 by default. restricted_species = list( "Baseline Frame", "Shell Frame", diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index d39fba2bd80..dd5d5ba4df4 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -218,6 +218,10 @@ var/global/list/additional_antag_types = list() antag.update_initial_spawn_target() antag.build_candidate_list() //compile a list of all eligible candidates + //can't find enough antags? check again but don't apply the antag chance restrictions per job + if(antag.candidates < required_enemies) + antag.build_candidate_list(FALSE, FALSE, FALSE) + //antag roles that replace jobs need to be assigned before the job controller hands out jobs. if(antag.flags & ANTAG_OVERRIDE_JOB) antag.attempt_spawn() //select antags to be spawned diff --git a/html/changelogs/geeves-targettingSec.yml b/html/changelogs/geeves-targettingSec.yml new file mode 100644 index 00000000000..f617b329d5e --- /dev/null +++ b/html/changelogs/geeves-targettingSec.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: Geeves, code by BurgerBB + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Security and Heads of Staff are less likely to gain antag status (Range: 25-75%)."