mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
Dynamic Rework (#91290)
Implements https://hackmd.io/@tgstation/SkeUS7lSp , rewriting Dynamic
from the ground-up
- Dynamic configuration is now vastly streamlined, making it far far far
easier to understand and edit
- Threat is gone entirely; round chaos is now determined by dynamic
tiers
- There's 5 dynamic tiers, 0 to 4.
- 0 is a pure greenshift.
- Tiers are just picked via weight - "16% chance of getting a high chaos
round".
- Tiers have min pop ranges. "Tier 4 (high chaos) requires 25 pop to be
selected".
- Tier determines how much of every ruleset is picked. "Tier 4 (High
Chaos) will pick 3-4 roundstart[1], 1-2 light, 1-2 heavy, and 2-3
latejoins".
- The number of rulesets picked depends on how many people are in the
server - this is also configurable[2]. As an example, a tier that
demands "1-3" rulesets will not spawn 3 rulesets if population <= 40 and
will not spawn 2 rulesets if population <= 25.
- Tiers also determine time before light, heavy, and latejoin rulesets
are picked, as well as the cooldown range between spawns. More chaotic
tiers may send midrounds sooner or wait less time between sending them.
- On the ruleset side of things, "requirements", "scaling", and
"enemies" is gone.
- You can configure a ruleset's min pop and weight flat, or per tier.
- For example a ruleset like Obsession is weighted higher for tiers 1-2
and lower for tiers 3-4.
- Rather than scaling up, roundstart rulesets can just be selected
multiple times.
- Rulesets also have `min_antag_cap` and `max_antag_cap`.
`min_antag_cap` determines how many candidates are needed for it to run,
and `max_antag_cap` determines how many candidates are selected.
- Rulesets attempt to run every 2.5 minutes. [3]
- Light rulesets will ALWAYS be picked before heavy rulesets. [4]
- Light injection chance is no longer 100%, heavy injection chance
formula has been simplified.
- Chance simply scales based on number of dead players / total number
off players, with a flag 50% chance if no antags exist. [5]
[1] This does not guarantee you will actually GET 3-4 roundstart
rulesets. If a roundstart ruleset is picked, and it ends up being unable
to execute (such as "not enough candidates", that slot is effectively a
wash.) This might be revisited.
[2] Currently, this is a hard limit - below X pop, you WILL get a
quarter or a half of the rulesets. This might be revisited to just be
weighted - you are just MORE LIKELY to get a quarter or a half.
[3] Little worried about accidentally frontloading everything so we'll
see about this
[4] This may be revisited but in most contexts it seems sensible.
[5] This may also be revisited, I'm not 100% sure what the best / most
simple way to tackle midround chances is.
Other implementation details
- The process of making rulesets has been streamlined as well. Many
rulesets only amount to a definition and `assign_role`.
- Dynamic.json -> Dynamic.toml
- Dynamic event hijacked was ripped out entirely.
- Most midround antag random events are now dynamic rulesets. Fugitives,
Morphs, Slaughter Demons, etc.
- The 1 weight slaughter demon event is gone. RIP in peace.
- There is now a hidden midround event that simply adds +1 latejoin, +1
light, or +1 heavy ruleset.
- `mind.special_role` is dead. Minds have a lazylist of special roles
now but it's essentially only used for traitor panel.
- Revs refactored almost entirely. Revs can now exist without a dynamic
ruleset.
- Cult refactored a tiny bit.
- Antag datums cleaned up.
- Pre round setup is less centralized on Dynamic.
- Admins have a whole panel for interfacing with dynamic. It's pretty
slapdash I'm sure someone could make a nicer looking one.


- Maybe some other things.
See readme for more info.
Will you see a massive change in how rounds play out? My hunch says
rounds will spawn less rulesets on average, but it's ultimately to how
it's configured
🆑 Melbert
refactor: Dynamic rewritten entirely, report any strange rounds
config: Dynamic config reworked, it's now a TOML file
refactor: Refactored antag roles somewhat, report any oddities
refactor: Refactored Revolution entirely, report any oddities
del: Deleted most midround events that spawn antags - they use dynamic
rulesets now
add: Dynamic rulesets can now be false alarms
add: Adds a random event that gives dynamic the ability to run another
ruleset later
admin: Adds a panel for messing around with dynamic
admin: Adds a panel for chance for every dynamic ruleset to be selected
admin: You can spawn revs without using dynamic now
fix: Nuke team leaders get their fun title back
/🆑
(cherry picked from commit 4c277dc572)
This commit is contained in:
@@ -351,7 +351,7 @@ Versioning
|
||||
"name" = L.real_name,
|
||||
"key" = L.ckey,
|
||||
"job" = L.mind.assigned_role.title,
|
||||
"special" = L.mind.special_role,
|
||||
"special" = jointext(L.mind.get_special_roles(), " | "),
|
||||
"pod" = get_area_name(L, TRUE),
|
||||
"laname" = L.lastattacker,
|
||||
"lakey" = L.lastattackerckey,
|
||||
@@ -440,7 +440,7 @@ Versioning
|
||||
"ckey" = mob_ckey,
|
||||
"character_name" = new_character.real_name,
|
||||
"job" = new_character.mind?.assigned_role?.title,
|
||||
"special" = new_character.mind?.special_role,
|
||||
"special" = english_list(new_character.mind?.get_special_roles(), nothing_text = "NONE"),
|
||||
"latejoin" = 0,
|
||||
))
|
||||
SSdbcore.MassInsert(format_table_name("manifest"), query_rows, special_columns = special_columns)
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
// Config values, don't change these randomly
|
||||
/// Configuring "roundstart" type rulesets
|
||||
#define ROUNDSTART "roundstart"
|
||||
/// Configuring "light midround" type rulesets
|
||||
#define LIGHT_MIDROUND "light_midround"
|
||||
/// Configuring "heavy midround" type rulesets
|
||||
#define HEAVY_MIDROUND "heavy_midround"
|
||||
/// Configuring "latejoin" type rulesets
|
||||
#define LATEJOIN "latejoin"
|
||||
|
||||
/// Lower end for how many of a ruleset type can be selected
|
||||
#define LOW_END "low"
|
||||
/// Upper end for how many of a ruleset type can be selected
|
||||
#define HIGH_END "high"
|
||||
/// Population threshold for ruleset types - below this, only a quarter of the low to high end is used
|
||||
#define HALF_RANGE_POP_THRESHOLD "half_range_pop_threshold"
|
||||
/// Population threshold for ruleset types - below this, only a half of the low to high end is used
|
||||
#define FULL_RANGE_POP_THRESHOLD "full_range_pop_threshold"
|
||||
/// Round time threshold for which a ruleset type will be selected
|
||||
#define TIME_THRESHOLD "time_threshold"
|
||||
/// Lower end for cooldown duration for a ruleset type
|
||||
#define EXECUTION_COOLDOWN_LOW "execution_cooldown_low"
|
||||
/// Upper end for cooldown duration for a ruleset type
|
||||
#define EXECUTION_COOLDOWN_HIGH "execution_cooldown_high"
|
||||
|
||||
// Tiers, don't change these randomly
|
||||
/// Tier 0, no antags at all
|
||||
#define DYNAMIC_TIER_GREEN 0
|
||||
/// Tier 1, low amount of antags
|
||||
#define DYNAMIC_TIER_LOW 1
|
||||
/// Tier 2, medium amount of antags
|
||||
#define DYNAMIC_TIER_LOWMEDIUM 2
|
||||
/// Tier 3, high amount of antags
|
||||
#define DYNAMIC_TIER_MEDIUMHIGH 3
|
||||
/// Tier 4, maximum amount of antags
|
||||
#define DYNAMIC_TIER_HIGH 4
|
||||
|
||||
// Ruleset flags
|
||||
/// Ruleset denotes that it involves an outside force spawning in to attack the station
|
||||
#define RULESET_INVADER (1<<0)
|
||||
/// Multiple high impact rulesets cannot be selected unless we're at the highest tier
|
||||
#define RULESET_HIGH_IMPACT (1<<1)
|
||||
/// Ruleset can be configured by admins (implements /proc/configure_ruleset)
|
||||
/// Only implemented for midrounds currently
|
||||
#define RULESET_ADMIN_CONFIGURABLE (1<<2)
|
||||
|
||||
/// Href for cancelling midround rulesets before execution
|
||||
#define MIDROUND_CANCEL_HREF(...) "(<a href='byond://?src=[REF(src)];admin_cancel_midround=[REF(picked_ruleset)]'>CANCEL</a>)"
|
||||
/// Href for rerolling midround rulesets before execution
|
||||
#define MIDROUND_REROLL_HREF(rulesets) "[length(rulesets) \
|
||||
? "(<a href='byond://?src=[REF(src)];admin_reroll=[REF(picked_ruleset)]'>SOMETHING ELSE</a>)" \
|
||||
: "([span_tooltip("There are no more rulesets to pick from!", "NOTHING ELSE")])"\
|
||||
]"
|
||||
|
||||
#define RULESET_CONFIG_CANCEL "Cancel"
|
||||
@@ -0,0 +1,372 @@
|
||||
/**
|
||||
* ## Dynamic ruleset datum
|
||||
*
|
||||
* These datums (which are not singletons) are used by dynamic to create antagonists
|
||||
*/
|
||||
/datum/dynamic_ruleset
|
||||
/// Human-readable name of the ruleset.
|
||||
var/name
|
||||
/// Tag the ruleset uses for configuring.
|
||||
/// Don't change this unless you know what you're doing.
|
||||
var/config_tag
|
||||
|
||||
/// What flag to check for jobbans? Optional, if unset, uses pref_flag
|
||||
var/jobban_flag
|
||||
/// What flag to check for prefs? Required if the antag has an associated preference
|
||||
var/pref_flag
|
||||
/// Flags for this ruleset
|
||||
var/ruleset_flags = NONE
|
||||
/// Points to what antag datum this ruleset will use for generating a preview icon in the prefs menu
|
||||
var/preview_antag_datum
|
||||
/// List of all minds selected for this ruleset
|
||||
VAR_FINAL/list/datum/mind/selected_minds = list()
|
||||
|
||||
/**
|
||||
* The chance the ruleset is picked when selecting from the pool of rulesets.
|
||||
*
|
||||
* This can either be
|
||||
* - A list of weight corresponding to dynamic tiers.
|
||||
* If a tier is not specified, it will use the next highest tier.
|
||||
* Or
|
||||
* - A single weight for all tiers.
|
||||
*/
|
||||
var/list/weight = 0
|
||||
/**
|
||||
* The min population for which this ruleset is available.
|
||||
*
|
||||
* This can either be
|
||||
* - A list of min populations corresponding to dynamic tiers.
|
||||
* If a tier is not specified, it will use the next highest tier.
|
||||
* Or
|
||||
* - A single min population for all tiers.
|
||||
*/
|
||||
var/list/min_pop = 0
|
||||
/// List of roles that are blacklisted from this ruleset
|
||||
/// For roundstart rulesets, it will prevent players from being selected for this ruleset if they have one of these roles
|
||||
/// For latejoin or midround rulesets, it will prevent players from being assigned to this ruleset if they have one of these roles
|
||||
var/list/blacklisted_roles = list()
|
||||
/**
|
||||
* How many candidates are needed for this ruleset to be selected?
|
||||
* Ie. "We won't even bother attempting to run this ruleset unless at least x players want to be it"
|
||||
*
|
||||
* This can either be
|
||||
* - A number
|
||||
* Or
|
||||
* - A list in the form of list("denominator" = x, "offset" = y)
|
||||
* which will divide the population size by x and add y to it to calculate the number of candidates
|
||||
*/
|
||||
var/min_antag_cap = 1
|
||||
/**
|
||||
* How many candidates will be this ruleset try to select?
|
||||
* Ie. "We have 10 cadidates, but we only want x of them to be antags"
|
||||
*
|
||||
* This can either be
|
||||
* - A number
|
||||
* Or
|
||||
* - A list in the form of list("denominator" = x, "offset" = y)
|
||||
* which will divide the population size by x and add y to it to calculate the number of candidates
|
||||
*
|
||||
* If null, defaults to min_antag_cap
|
||||
*/
|
||||
var/max_antag_cap
|
||||
/// If set to TRUE, dynamic will be able to draft this ruleset again later on
|
||||
var/repeatable = FALSE
|
||||
/// Every time this ruleset is selected, the weight will be decreased by this amount
|
||||
var/repeatable_weight_decrease = 2
|
||||
/// Players whose account is less than this many days old will be filtered out of the candidate list
|
||||
var/minimum_required_age = 0
|
||||
/// Templates necessary for this ruleset to be executed
|
||||
VAR_PROTECTED/list/ruleset_lazy_templates
|
||||
|
||||
/datum/dynamic_ruleset/New(list/dynamic_config)
|
||||
for(var/new_var in dynamic_config?[config_tag])
|
||||
set_config_value(new_var, dynamic_config[config_tag][new_var])
|
||||
|
||||
/datum/dynamic_ruleset/Destroy()
|
||||
selected_minds = null
|
||||
return ..()
|
||||
|
||||
/// Used for parsing config entries to validate them
|
||||
/datum/dynamic_ruleset/proc/set_config_value(new_var, new_val)
|
||||
if(!(new_var in vars))
|
||||
log_dynamic("Erroneous config edit rejected: [new_var]")
|
||||
return FALSE
|
||||
var/static/list/locked_config_values = list(
|
||||
NAMEOF_STATIC(src, config_tag),
|
||||
NAMEOF_STATIC(src, jobban_flag),
|
||||
NAMEOF_STATIC(src, pref_flag),
|
||||
NAMEOF_STATIC(src, preview_antag_datum),
|
||||
NAMEOF_STATIC(src, ruleset_flags),
|
||||
NAMEOF_STATIC(src, ruleset_lazy_templates),
|
||||
NAMEOF_STATIC(src, selected_minds),
|
||||
NAMEOF_STATIC(src, vars),
|
||||
)
|
||||
|
||||
if(new_var in locked_config_values)
|
||||
log_dynamic("Bad config edit rejected: [new_var]")
|
||||
return FALSE
|
||||
if(islist(new_val) && (new_var == NAMEOF(src, weight) || new_var == NAMEOF(src, min_pop)))
|
||||
new_val = load_tier_list(new_val)
|
||||
|
||||
vars[new_var] = new_val
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/vv_edit_var(var_name, var_value)
|
||||
if(var_name == NAMEOF(src, config_tag))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/// Used to create tier lists for weights and min_pop values
|
||||
/datum/dynamic_ruleset/proc/load_tier_list(list/incoming_list)
|
||||
PRIVATE_PROC(TRUE)
|
||||
|
||||
var/list/tier_list = new /list(4)
|
||||
// loads a list of list("2" = 1, "3" = 3) into a list(null, 1, 3, null)
|
||||
for(var/tier in incoming_list)
|
||||
tier_list[text2num(tier)] = incoming_list[tier]
|
||||
|
||||
// turn list(null, 1, 3, null) into list(1, 1, 3, null)
|
||||
for(var/i in 1 to length(tier_list))
|
||||
var/val = tier_list[i]
|
||||
if(isnum(val))
|
||||
break
|
||||
for(var/j in i to length(tier_list))
|
||||
var/other_val = tier_list[j]
|
||||
if(!isnum(other_val))
|
||||
continue
|
||||
tier_list[i] = other_val
|
||||
break
|
||||
|
||||
// turn list(1, 1, 3, null) into list(1, 1, 3, 3)
|
||||
for(var/i in length(tier_list) to 1 step -1)
|
||||
var/val = tier_list[i]
|
||||
if(isnum(val))
|
||||
break
|
||||
for(var/j in i to 1 step -1)
|
||||
var/other_val = tier_list[j]
|
||||
if(!isnum(other_val))
|
||||
continue
|
||||
tier_list[i] = other_val
|
||||
break
|
||||
|
||||
// we can assert that tier[1] and tier[4] are not null, but we cannot say the same for tier[2] and tier[3]
|
||||
// this can be happen due to the following setup: list(1, null, null, 4)
|
||||
// (which is an invalid config, and should be fixed by the operator)
|
||||
if(isnull(tier_list[2]))
|
||||
tier_list[2] = tier_list[1]
|
||||
if(isnull(tier_list[3]))
|
||||
tier_list[3] = tier_list[4]
|
||||
|
||||
return tier_list
|
||||
|
||||
/**
|
||||
* Any additional checks to see if this ruleset can be selected
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/can_be_selected()
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Calculates the weight of this ruleset for the given tier.
|
||||
*
|
||||
* * population_size - How many players are alive
|
||||
* * tier - The dynamic tier to calculate the weight for
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/get_weight(population_size = 0, tier = DYNAMIC_TIER_LOW)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
|
||||
if(type in SSdynamic.admin_disabled_rulesets)
|
||||
return 0
|
||||
if(!can_be_selected())
|
||||
return 0
|
||||
var/final_minpop = islist(min_pop) ? min_pop[tier] : min_pop
|
||||
if(final_minpop > population_size)
|
||||
return 0
|
||||
|
||||
var/final_weight = islist(weight) ? weight[tier] : weight
|
||||
for(var/datum/dynamic_ruleset/other_ruleset as anything in SSdynamic.executed_rulesets)
|
||||
if(other_ruleset == src)
|
||||
continue
|
||||
if(tier != DYNAMIC_TIER_HIGH && (ruleset_flags & RULESET_HIGH_IMPACT) && (other_ruleset.ruleset_flags & RULESET_HIGH_IMPACT))
|
||||
return 0
|
||||
if(!istype(other_ruleset, type))
|
||||
continue
|
||||
if(!repeatable)
|
||||
return 0
|
||||
final_weight -= repeatable_weight_decrease
|
||||
|
||||
return max(final_weight, 0)
|
||||
|
||||
/// Returns what the antag cap with the given population is.
|
||||
/datum/dynamic_ruleset/proc/get_antag_cap(population_size, antag_cap)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
if (isnum(antag_cap))
|
||||
return antag_cap
|
||||
|
||||
return ceil(population_size / antag_cap["denominator"]) + antag_cap["offset"]
|
||||
|
||||
/**
|
||||
* Prepares the ruleset for execution, primarily used for selecting the players who will be assigned to this ruleset
|
||||
*
|
||||
* * antag_candidates - List of players who are candidates for this ruleset
|
||||
* This list is mutated by this proc!
|
||||
*
|
||||
* Returns TRUE if execution is ready, FALSE if it should be canceled
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/prepare_execution(population_size = 0, list/mob/antag_candidates = list())
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
|
||||
// !! THIS SLEEPS !!
|
||||
load_templates()
|
||||
|
||||
// This is (mostly) redundant, buuuut the (potential) sleep above makes it iffy, so let's just be safe
|
||||
if(!can_be_selected())
|
||||
return FALSE
|
||||
|
||||
var/max_candidates = get_antag_cap(population_size, max_antag_cap || min_antag_cap)
|
||||
var/min_candidates = get_antag_cap(population_size, min_antag_cap)
|
||||
|
||||
var/list/selected_candidates = select_candidates(antag_candidates, max_candidates)
|
||||
if(length(selected_candidates) < min_candidates)
|
||||
return FALSE
|
||||
|
||||
for(var/mob/candidate as anything in selected_candidates)
|
||||
var/datum/mind/candidate_mind = get_candidate_mind(candidate)
|
||||
prepare_for_role(candidate_mind)
|
||||
LAZYADDASSOC(SSjob.prevented_occupations, candidate_mind, get_blacklisted_roles()) // this is what makes sure you can't roll traitor as a sec-off
|
||||
selected_minds += candidate_mind
|
||||
antag_candidates -= candidate
|
||||
|
||||
return TRUE
|
||||
|
||||
/// Gets the mind of a candidate, can be overridden to return a different mind if necessary
|
||||
/datum/dynamic_ruleset/proc/get_candidate_mind(mob/dead/candidate)
|
||||
return candidate.mind
|
||||
|
||||
/// Returns a list of roles that cannot be selected for this ruleset
|
||||
/datum/dynamic_ruleset/proc/get_blacklisted_roles()
|
||||
return get_config_blacklisted_roles() | get_always_blacklisted_roles()
|
||||
|
||||
/// Returns all the jobs the config says this ruleset cannot select
|
||||
/datum/dynamic_ruleset/proc/get_config_blacklisted_roles()
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
var/list/blacklist = blacklisted_roles.Copy()
|
||||
for(var/datum/job/job as anything in SSjob.all_occupations)
|
||||
var/protected = (job.job_flags & JOB_ANTAG_PROTECTED)
|
||||
var/blacklisted = (job.job_flags & JOB_ANTAG_BLACKLISTED)
|
||||
if((CONFIG_GET(flag/protect_roles_from_antagonist) && protected) || blacklisted)
|
||||
blacklist |= job.title
|
||||
if(CONFIG_GET(flag/protect_assistant_from_antagonist))
|
||||
blacklisted_roles |= JOB_ASSISTANT
|
||||
return blacklist
|
||||
|
||||
/// Returns a list of roles that are always blacklisted from this ruleset, for mechanical reasons (an AI can't be a changeling)
|
||||
/datum/dynamic_ruleset/proc/get_always_blacklisted_roles()
|
||||
return list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
|
||||
/// Takes in a list of players and returns a list of players who are valid candidates for this ruleset
|
||||
/// Don't touch this proc if you need to trim candidates further - override is_valid_candidate() instead
|
||||
/datum/dynamic_ruleset/proc/trim_candidates(list/mob/antag_candidates)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
|
||||
var/list/valid_candidates = list()
|
||||
for(var/mob/candidate as anything in antag_candidates)
|
||||
var/client/candidate_client = GET_CLIENT(candidate)
|
||||
if(isnull(candidate_client))
|
||||
continue
|
||||
if(candidate_client.get_remaining_days(minimum_required_age) > 0)
|
||||
continue
|
||||
if(pref_flag && !(pref_flag in candidate_client.prefs.be_special))
|
||||
continue
|
||||
if(is_banned_from(candidate.ckey, list(ROLE_SYNDICATE, jobban_flag || pref_flag)))
|
||||
continue
|
||||
if(!is_valid_candidate(candidate, candidate_client))
|
||||
continue
|
||||
valid_candidates += candidate
|
||||
return valid_candidates
|
||||
|
||||
/// Returns a list of players picked for this ruleset
|
||||
/datum/dynamic_ruleset/proc/select_candidates(list/mob/antag_candidates, num_candidates = 0)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
PRIVATE_PROC(TRUE)
|
||||
|
||||
if(num_candidates <= 0)
|
||||
return list()
|
||||
|
||||
// technically not pure
|
||||
var/list/resulting_candidates = shuffle(trim_candidates(antag_candidates)) || list()
|
||||
if(length(resulting_candidates) <= num_candidates)
|
||||
return resulting_candidates
|
||||
|
||||
resulting_candidates.Cut(num_candidates + 1)
|
||||
return resulting_candidates
|
||||
|
||||
/// Handles loading map templates that this ruleset requires
|
||||
/datum/dynamic_ruleset/proc/load_templates()
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
PRIVATE_PROC(TRUE)
|
||||
|
||||
for(var/template in ruleset_lazy_templates)
|
||||
SSmapping.lazy_load_template(template)
|
||||
|
||||
/**
|
||||
* Any additional checks to see if this player is a valid candidate for this ruleset
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/is_valid_candidate(mob/candidate, client/candidate_client)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Handles any special logic that needs to be done for a player before they are assigned to this ruleset
|
||||
* This is ran before the player is in their job position, and before they even have a player character
|
||||
*
|
||||
* Override this proc to do things like set forced jobs, DON'T assign roles or give out equipments here!
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/prepare_for_role(datum/mind/candidate)
|
||||
PROTECTED_PROC(TRUE)
|
||||
return
|
||||
|
||||
/**
|
||||
* Executes the ruleset, assigning the selected players to their roles.
|
||||
* No backing out now, at this point it's guaranteed to run.
|
||||
*
|
||||
* Prefer to override assign_role() instead of this proc
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/execute()
|
||||
var/list/execute_args = create_execute_args()
|
||||
for(var/datum/mind/mind as anything in selected_minds)
|
||||
assign_role(arglist(list(mind) + execute_args))
|
||||
|
||||
/// Allows you to supply extra arguments to assign_role() if needed
|
||||
/datum/dynamic_ruleset/proc/create_execute_args()
|
||||
return list()
|
||||
|
||||
/**
|
||||
* Used by the ruleset to actually assign the role to the player
|
||||
* This is ran after they have a player character spawned, and after they're in their job (with all their job equipment)
|
||||
*
|
||||
* Override this proc to give out antag datums or special items or whatever
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/assign_role(datum/mind/candidate)
|
||||
PROTECTED_PROC(TRUE)
|
||||
stack_trace("Ruleset [src] does not implement assign_role()")
|
||||
return
|
||||
|
||||
/**
|
||||
* Handles setting SSticker news report / mode result for more impactful rulsets
|
||||
*
|
||||
* Return TRUE if any result was set
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/round_result()
|
||||
return FALSE
|
||||
|
||||
/**
|
||||
* Allows admins to configure rulesets before prepare_execution() is called.
|
||||
*
|
||||
* Only called if RULESET_ADMIN_CONFIGURABLE is set in ruleset_flags.
|
||||
* Also only called by midrounds currently.
|
||||
*/
|
||||
/datum/dynamic_ruleset/proc/configure_ruleset(mob/admin)
|
||||
stack_trace("Ruleset [type] sets flag RULESET_ADMIN_CONFIGURABLE but does not implement configure_ruleset!")
|
||||
@@ -0,0 +1,316 @@
|
||||
/**
|
||||
* ## Dynamic tier datum
|
||||
*
|
||||
* These datums are essentially used to configure the dynamic system
|
||||
* They serve as a very simple way to see at a glance what dynamic is doing and what it is going to do
|
||||
*
|
||||
* For example, a tier will say "we will spawn 1-2 roundstart antags"
|
||||
*/
|
||||
/datum/dynamic_tier
|
||||
/// Tier number - A number which determines the severity of the tier - the higher the number, the more antags
|
||||
var/tier = -1
|
||||
/// The human readable name of the tier
|
||||
var/name
|
||||
/// Tag the tier uses for configuring.
|
||||
/// Don't change this unless you know what you're doing.
|
||||
var/config_tag
|
||||
/// The chance this tier will be selected from all tiers
|
||||
/// Keep all tiers added up to 100 weight, keeps things readable
|
||||
var/weight = 0
|
||||
/// This tier will not be selected if the population is below this number
|
||||
var/min_pop = 0
|
||||
|
||||
/// String which is sent to the players reporting which tier is active
|
||||
var/advisory_report
|
||||
|
||||
/**
|
||||
* How Dynamic will select rulesets based on the tier
|
||||
*
|
||||
* Every tier configures each of the ruleset types - ie, roundstart, light midround, heavy midround, latejoin
|
||||
*
|
||||
* Every type can be configured with the following:
|
||||
* - LOW_END: The lower for how many of this ruleset type can be selected
|
||||
* - HIGH_END: The upper for how many of this ruleset type can be selected
|
||||
* - HALF_RANGE_POP_THRESHOLD: Below this population range, the high end is quartered
|
||||
* - FULL_RANGE_POP_THRESHOLD: Below this population range, the high end is halved
|
||||
*
|
||||
* Non-roundstart ruleset types also have:
|
||||
* - TIME_THRESHOLD: World time must pass this threshold before dynamic starts running this ruleset type
|
||||
* - EXECUTION_COOLDOWN_LOW: The lower end for how long to wait before running this ruleset type again
|
||||
* - EXECUTION_COOLDOWN_HIGH: The upper end for how long to wait before running this ruleset type again
|
||||
*/
|
||||
var/list/ruleset_type_settings = list(
|
||||
ROUNDSTART = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 0,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 50,
|
||||
TIME_THRESHOLD = 0 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 0 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 0 MINUTES,
|
||||
),
|
||||
LIGHT_MIDROUND = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 0,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 30 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
HEAVY_MIDROUND = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 0,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 60 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
LATEJOIN = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 0,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 0 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
)
|
||||
|
||||
/datum/dynamic_tier/New(list/dynamic_config)
|
||||
for(var/new_var in dynamic_config?[config_tag])
|
||||
if(!(new_var in vars))
|
||||
continue
|
||||
set_config_value(new_var, dynamic_config[config_tag][new_var])
|
||||
|
||||
/// Used for parsing config entries to validate them
|
||||
/datum/dynamic_tier/proc/set_config_value(new_var, new_val)
|
||||
switch(new_var)
|
||||
if(NAMEOF(src, tier), NAMEOF(src, config_tag), NAMEOF(src, vars))
|
||||
return FALSE
|
||||
if(NAMEOF(src, ruleset_type_settings))
|
||||
for(var/category in new_val)
|
||||
for(var/rule in new_val[category])
|
||||
if(rule == LOW_END || rule == HIGH_END)
|
||||
ruleset_type_settings[category][rule] = max(0, new_val[category][rule])
|
||||
else if(rule == TIME_THRESHOLD || rule == EXECUTION_COOLDOWN_LOW || rule == EXECUTION_COOLDOWN_HIGH)
|
||||
ruleset_type_settings[category][rule] = new_val[category][rule] * 1 MINUTES
|
||||
else
|
||||
ruleset_type_settings[category][rule] = new_val[category][rule]
|
||||
return TRUE
|
||||
|
||||
vars[new_var] = new_val
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_tier/vv_edit_var(var_name, var_value)
|
||||
switch(var_name)
|
||||
if(NAMEOF(src, tier))
|
||||
return FALSE
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_tier/greenshift
|
||||
tier = DYNAMIC_TIER_GREEN
|
||||
config_tag = "Greenshift"
|
||||
name = "Greenshift"
|
||||
weight = 2
|
||||
|
||||
advisory_report = "Advisory Level: <b>Green Star</b></center><BR>\
|
||||
Your sector's advisory level is Green Star. \
|
||||
Surveillance information shows no credible threats to Nanotrasen assets within the Spinward Sector at this time. \
|
||||
As always, the Department advises maintaining vigilance against potential threats, regardless of a lack of known threats."
|
||||
|
||||
/datum/dynamic_tier/low
|
||||
tier = DYNAMIC_TIER_LOW
|
||||
config_tag = "Low Chaos"
|
||||
name = "Low Chaos"
|
||||
weight = 8
|
||||
|
||||
advisory_report = "Advisory Level: <b>Yellow Star</b></center><BR>\
|
||||
Your sector's advisory level is Yellow Star. \
|
||||
Surveillance shows a credible risk of enemy attack against our assets in the Spinward Sector. \
|
||||
We advise a heightened level of security alongside maintaining vigilance against potential threats."
|
||||
|
||||
ruleset_type_settings = list(
|
||||
ROUNDSTART = list(
|
||||
LOW_END = 1,
|
||||
HIGH_END = 1,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
),
|
||||
LIGHT_MIDROUND = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 2,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 30 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
HEAVY_MIDROUND = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 1,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 60 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
LATEJOIN = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 1,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 5 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
)
|
||||
|
||||
/datum/dynamic_tier/lowmedium
|
||||
tier = DYNAMIC_TIER_LOWMEDIUM
|
||||
config_tag = "Low-Medium Chaos"
|
||||
name = "Low-Medium Chaos"
|
||||
weight = 46
|
||||
|
||||
advisory_report = "Advisory Level: <b>Red Star</b></center><BR>\
|
||||
Your sector's advisory level is Red Star. \
|
||||
The Department of Intelligence has decrypted Cybersun communications suggesting a high likelihood of attacks \
|
||||
on Nanotrasen assets within the Spinward Sector. \
|
||||
Stations in the region are advised to remain highly vigilant for signs of enemy activity and to be on high alert."
|
||||
|
||||
ruleset_type_settings = list(
|
||||
ROUNDSTART = list(
|
||||
LOW_END = 1,
|
||||
HIGH_END = 2,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
),
|
||||
LIGHT_MIDROUND = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 2,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 30 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
HEAVY_MIDROUND = list(
|
||||
LOW_END = 0,
|
||||
HIGH_END = 1,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 60 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
LATEJOIN = list(
|
||||
LOW_END = 1,
|
||||
HIGH_END = 2,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 5 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
)
|
||||
|
||||
/datum/dynamic_tier/mediumhigh
|
||||
tier = DYNAMIC_TIER_MEDIUMHIGH
|
||||
config_tag = "Medium-High Chaos"
|
||||
name = "Medium-High Chaos"
|
||||
weight = 36
|
||||
|
||||
advisory_report = "Advisory Level: <b>Black Orbit</b></center><BR>\
|
||||
Your sector's advisory level is Black Orbit. \
|
||||
Your sector's local communications network is currently undergoing a blackout, \
|
||||
and we are therefore unable to accurately judge enemy movements within the region. \
|
||||
However, information passed to us by GDI suggests a high amount of enemy activity in the sector, \
|
||||
indicative of an impending attack. Remain on high alert and vigilant against any other potential threats."
|
||||
|
||||
ruleset_type_settings = list(
|
||||
ROUNDSTART = list(
|
||||
LOW_END = 2,
|
||||
HIGH_END = 3,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
),
|
||||
LIGHT_MIDROUND = list(
|
||||
LOW_END = 1,
|
||||
HIGH_END = 2,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 30 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
HEAVY_MIDROUND = list(
|
||||
LOW_END = 1,
|
||||
HIGH_END = 2,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 60 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
LATEJOIN = list(
|
||||
LOW_END = 1,
|
||||
HIGH_END = 3,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 5 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
)
|
||||
|
||||
/datum/dynamic_tier/high
|
||||
tier = DYNAMIC_TIER_HIGH
|
||||
config_tag = "High Chaos"
|
||||
name = "High Chaos"
|
||||
weight = 10
|
||||
|
||||
min_pop = 25
|
||||
|
||||
advisory_report = "Advisory Level: <b>Midnight Sun</b></center><BR>\
|
||||
Your sector's advisory level is Midnight Sun. \
|
||||
Credible information passed to us by GDI suggests that the Syndicate \
|
||||
is preparing to mount a major concerted offensive on Nanotrasen assets in the Spinward Sector to cripple our foothold there. \
|
||||
All stations should remain on high alert and prepared to defend themselves."
|
||||
|
||||
ruleset_type_settings = list(
|
||||
ROUNDSTART = list(
|
||||
LOW_END = 3,
|
||||
HIGH_END = 4,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
),
|
||||
LIGHT_MIDROUND = list(
|
||||
LOW_END = 1,
|
||||
HIGH_END = 2,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 20 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
HEAVY_MIDROUND = list(
|
||||
LOW_END = 2,
|
||||
HIGH_END = 4,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 30 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
LATEJOIN = list(
|
||||
LOW_END = 2,
|
||||
HIGH_END = 3,
|
||||
HALF_RANGE_POP_THRESHOLD = 25,
|
||||
FULL_RANGE_POP_THRESHOLD = 40,
|
||||
TIME_THRESHOLD = 5 MINUTES,
|
||||
EXECUTION_COOLDOWN_LOW = 10 MINUTES,
|
||||
EXECUTION_COOLDOWN_HIGH = 20 MINUTES,
|
||||
),
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,254 @@
|
||||
ADMIN_VERB(dynamic_panel, R_ADMIN, "Dynamic Panel", "Mess with dynamic.", ADMIN_CATEGORY_GAME)
|
||||
dynamic_panel(user.mob)
|
||||
|
||||
/proc/dynamic_panel(mob/user)
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
var/datum/dynamic_panel/tgui = new()
|
||||
tgui.ui_interact(user)
|
||||
|
||||
log_admin("[key_name(user)] opened the Dynamic Panel.")
|
||||
if(!isobserver(user))
|
||||
message_admins("[key_name_admin(user)] opened the Dynamic Panel.")
|
||||
BLACKBOX_LOG_ADMIN_VERB("Dynamic Panel")
|
||||
|
||||
/datum/dynamic_panel
|
||||
|
||||
/datum/dynamic_panel/ui_state(mob/user)
|
||||
return ADMIN_STATE(R_ADMIN)
|
||||
|
||||
/datum/dynamic_panel/ui_close()
|
||||
qdel(src)
|
||||
|
||||
/datum/dynamic_panel/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "DynamicAdmin")
|
||||
ui.open()
|
||||
|
||||
/datum/dynamic_panel/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
if(SSdynamic.current_tier)
|
||||
data["current_tier"] = list(
|
||||
"number" = SSdynamic.current_tier.tier,
|
||||
"name" = SSdynamic.current_tier.name,
|
||||
)
|
||||
|
||||
data["ruleset_count"] = list()
|
||||
for(var/category in SSdynamic.rulesets_to_spawn)
|
||||
data["ruleset_count"][category] = max(SSdynamic.rulesets_to_spawn[category], 0)
|
||||
|
||||
data["full_config"] = SSdynamic.get_config()
|
||||
data["config_even_enabled"] = CONFIG_GET(flag/dynamic_config_enabled) && length(data["full_config"])
|
||||
|
||||
data["queued_rulesets"] = list()
|
||||
for(var/i in 1 to length(SSdynamic.queued_rulesets))
|
||||
data["queued_rulesets"] += list(ruleset_to_data(SSdynamic.queued_rulesets[i]) + list("index" = i))
|
||||
|
||||
data["active_rulesets"] = list()
|
||||
for(var/i in 1 to length(SSdynamic.executed_rulesets))
|
||||
data["active_rulesets"] += list(ruleset_to_data(SSdynamic.executed_rulesets[i]) + list("index" = i))
|
||||
|
||||
data["all_rulesets"] = list()
|
||||
for(var/ruleset_type in subtypesof(/datum/dynamic_ruleset/roundstart))
|
||||
data["all_rulesets"][ROUNDSTART] += list(ruleset_to_data(ruleset_type))
|
||||
for(var/ruleset_type in subtypesof(/datum/dynamic_ruleset/midround))
|
||||
var/datum/dynamic_ruleset/midround/midround = ruleset_type
|
||||
switch(initial(midround.midround_type))
|
||||
if(HEAVY_MIDROUND)
|
||||
data["all_rulesets"][HEAVY_MIDROUND] += list(ruleset_to_data(ruleset_type))
|
||||
if(LIGHT_MIDROUND)
|
||||
data["all_rulesets"][LIGHT_MIDROUND] += list(ruleset_to_data(ruleset_type))
|
||||
for(var/ruleset_type in subtypesof(/datum/dynamic_ruleset/latejoin))
|
||||
data["all_rulesets"][LATEJOIN] += list(ruleset_to_data(ruleset_type))
|
||||
|
||||
data["time_until_lights"] = COOLDOWN_TIMELEFT(SSdynamic, light_ruleset_start)
|
||||
data["time_until_heavies"] = COOLDOWN_TIMELEFT(SSdynamic, heavy_ruleset_start)
|
||||
data["time_until_latejoins"] = COOLDOWN_TIMELEFT(SSdynamic, latejoin_ruleset_start)
|
||||
|
||||
data["time_until_next_midround"] = COOLDOWN_TIMELEFT(SSdynamic, midround_cooldown)
|
||||
data["time_until_next_latejoin"] = COOLDOWN_TIMELEFT(SSdynamic, latejoin_cooldown)
|
||||
data["failed_latejoins"] = SSdynamic.failed_latejoins
|
||||
|
||||
data["light_midround_chance"] = SSdynamic.get_midround_chance(LIGHT_MIDROUND)
|
||||
data["heavy_midround_chance"] = SSdynamic.get_midround_chance(HEAVY_MIDROUND)
|
||||
data["latejoin_chance"] = SSdynamic.get_latejoin_chance()
|
||||
|
||||
data["roundstarted"] = SSticker.HasRoundStarted()
|
||||
|
||||
data["light_chance_maxxed"] = SSdynamic.admin_forcing_next_light
|
||||
data["heavy_chance_maxxed"] = SSdynamic.admin_forcing_next_heavy
|
||||
data["latejoin_chance_maxxed"] = SSdynamic.admin_forcing_next_latejoin
|
||||
|
||||
data["next_dynamic_tick"] = SSdynamic.next_fire ? SSdynamic.next_fire - world.time : SSticker.GetTimeLeft()
|
||||
|
||||
data["antag_events_enabled"] = SSdynamic.antag_events_enabled
|
||||
|
||||
return data
|
||||
|
||||
/// Pass a ruleset typepath or a ruleset instance
|
||||
/datum/dynamic_panel/proc/ruleset_to_data(datum/dynamic_ruleset/ruleset)
|
||||
var/list/data = list()
|
||||
var/ruleset_path = isdatum(ruleset) ? ruleset.type : ruleset
|
||||
data["name"] = initial(ruleset.name)
|
||||
data["id"] = initial(ruleset.config_tag)
|
||||
data["typepath"] = ruleset_path
|
||||
data["selected_players"] = list()
|
||||
data["admin_disabled"] = (ruleset_path in SSdynamic.admin_disabled_rulesets)
|
||||
if(isdatum(ruleset))
|
||||
for(var/datum/mind/player as anything in ruleset.selected_minds)
|
||||
data["selected_players"] += list(list(
|
||||
"key" = player.key,
|
||||
))
|
||||
data["hidden"] = (ruleset in SSdynamic.unreported_rulesets)
|
||||
return data
|
||||
|
||||
/datum/dynamic_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
switch(action)
|
||||
if("remove_queued_ruleset")
|
||||
var/index = params["ruleset_index"]
|
||||
if(length(SSdynamic.queued_rulesets) < index)
|
||||
return
|
||||
var/datum/dynamic_ruleset/ruleset = SSdynamic.queued_rulesets[index]
|
||||
if(!ruleset)
|
||||
return
|
||||
SSdynamic.queued_rulesets -= ruleset
|
||||
message_admins("[key_name_admin(ui.user)] removed [ruleset.config_tag] from the dynamic ruleset queue.")
|
||||
log_admin("[key_name_admin(ui.user)] removed [ruleset.config_tag] from the dynamic ruleset queue.")
|
||||
qdel(ruleset)
|
||||
return TRUE
|
||||
if("add_queued_ruleset")
|
||||
var/datum/dynamic_ruleset/ruleset_path = text2path(params["ruleset_type"])
|
||||
if(!ruleset_path)
|
||||
return
|
||||
SSdynamic.queue_ruleset(ruleset_path)
|
||||
message_admins("[key_name_admin(ui.user)] added [initial(ruleset_path.config_tag)] to the dynamic ruleset queue.")
|
||||
log_admin("[key_name_admin(ui.user)] added [initial(ruleset_path.config_tag)] to the dynamic ruleset queue.")
|
||||
return TRUE
|
||||
if("dynamic_vv")
|
||||
ui.user?.client?.debug_variables(SSdynamic)
|
||||
return TRUE
|
||||
if("add_ruleset_category_count")
|
||||
var/category = params["ruleset_category"]
|
||||
if(!category)
|
||||
return
|
||||
SSdynamic.rulesets_to_spawn[category] += 1
|
||||
message_admins("[key_name_admin(ui.user)] added 1 to the [category] ruleset category.")
|
||||
log_admin("[key_name_admin(ui.user)] added 1 to the [category] ruleset category.")
|
||||
return TRUE
|
||||
if("set_ruleset_category_count")
|
||||
var/category = params["ruleset_category"]
|
||||
var/count = params["ruleset_count"]
|
||||
if(!category || !isnum(count))
|
||||
return
|
||||
SSdynamic.rulesets_to_spawn[category] = count
|
||||
message_admins("[key_name_admin(ui.user)] set the [category] ruleset category to [count].")
|
||||
log_admin("[key_name_admin(ui.user)] set the [category] ruleset category to [count].")
|
||||
return TRUE
|
||||
if("execute_ruleset")
|
||||
var/datum/dynamic_ruleset/ruleset_path = text2path(params["ruleset_type"])
|
||||
if(!ruleset_path)
|
||||
return
|
||||
message_admins("[key_name_admin(ui.user)] executed the ruleset [initial(ruleset_path.config_tag)].")
|
||||
log_admin("[key_name_admin(ui.user)] executed the ruleset [initial(ruleset_path.config_tag)].")
|
||||
ASYNC
|
||||
SSdynamic.force_run_midround(ruleset_path, alert_admins_on_fail = TRUE, admin = ui.user)
|
||||
return TRUE
|
||||
if("disable_ruleset")
|
||||
var/ruleset_path = text2path(params["ruleset_type"])
|
||||
if(!ruleset_path)
|
||||
return
|
||||
if(ruleset_path in SSdynamic.admin_disabled_rulesets)
|
||||
SSdynamic.admin_disabled_rulesets -= ruleset_path
|
||||
message_admins("[key_name_admin(ui.user)] enabled [ruleset_path] to be selected.")
|
||||
log_admin("[key_name_admin(ui.user)] enabled [ruleset_path] to be selected.")
|
||||
else
|
||||
SSdynamic.admin_disabled_rulesets += ruleset_path
|
||||
message_admins("[key_name_admin(ui.user)] disabled [ruleset_path] from being selected.")
|
||||
log_admin("[key_name_admin(ui.user)] disabled [ruleset_path] from being selected.")
|
||||
return TRUE
|
||||
if("disable_all")
|
||||
SSdynamic.admin_disabled_rulesets |= subtypesof(/datum/dynamic_ruleset)
|
||||
message_admins("[key_name_admin(ui.user)] disabled all rulesets from being selected.")
|
||||
log_admin("[key_name_admin(ui.user)] disabled all rulesets from being selected.")
|
||||
if("enable_all")
|
||||
SSdynamic.admin_disabled_rulesets.Cut()
|
||||
message_admins("[key_name_admin(ui.user)] re-enabled all rulesets.")
|
||||
log_admin("[key_name_admin(ui.user)] re_enabled all rulesets.")
|
||||
if("set_tier")
|
||||
if(SSdynamic.current_tier && SSticker.HasRoundStarted())
|
||||
return TRUE
|
||||
var/list/tiers = list()
|
||||
for(var/datum/dynamic_tier/tier as anything in subtypesof(/datum/dynamic_tier))
|
||||
tiers[initial(tier.name)] = tier
|
||||
var/datum/dynamic_tier/picked = tgui_input_list(ui.user, "Pick a dynamic tier before the game starts", "Pick tier", tiers, ui_state = ADMIN_STATE(R_ADMIN))
|
||||
if(picked && !SSticker.HasRoundStarted())
|
||||
SSdynamic.set_tier(tiers[picked])
|
||||
message_admins("[key_name_admin(ui.user)] set the dynamic tier to [initial(picked.tier)].")
|
||||
log_admin("[key_name_admin(ui.user)] set the dynamic tier to [initial(picked.tier)].")
|
||||
return TRUE
|
||||
if("max_light_chance")
|
||||
SSdynamic.admin_forcing_next_light = !SSdynamic.admin_forcing_next_light
|
||||
message_admins("[key_name_admin(ui.user)] [SSdynamic.admin_forcing_next_light ? "forced" : "reset"] the next light ruleset chance.")
|
||||
log_admin("[key_name_admin(ui.user)] [SSdynamic.admin_forcing_next_light ? "forced" : "reset"] the next light ruleset chance.")
|
||||
return TRUE
|
||||
if("max_heavy_chance")
|
||||
SSdynamic.admin_forcing_next_heavy = !SSdynamic.admin_forcing_next_heavy
|
||||
message_admins("[key_name_admin(ui.user)] [SSdynamic.admin_forcing_next_heavy ? "forced" : "reset"] the next heavy ruleset chance.")
|
||||
log_admin("[key_name_admin(ui.user)] [SSdynamic.admin_forcing_next_heavy ? "forced" : "reset"] the next heavy ruleset chance.")
|
||||
return TRUE
|
||||
if("max_latejoin_chance")
|
||||
SSdynamic.admin_forcing_next_latejoin = !SSdynamic.admin_forcing_next_latejoin
|
||||
message_admins("[key_name_admin(ui.user)] [SSdynamic.admin_forcing_next_latejoin ? "forced" : "reset"] the next latejoin ruleset chance.")
|
||||
log_admin("[key_name_admin(ui.user)] [SSdynamic.admin_forcing_next_latejoin ? "forced" : "reset"] the next latejoin ruleset chance.")
|
||||
return TRUE
|
||||
if("light_start_now")
|
||||
COOLDOWN_RESET(SSdynamic, light_ruleset_start)
|
||||
message_admins("[key_name_admin(ui.user)] reset the light ruleset start cooldown.")
|
||||
log_admin("[key_name_admin(ui.user)] reset the light ruleset start cooldown.")
|
||||
return TRUE
|
||||
if("heavy_start_now")
|
||||
COOLDOWN_RESET(SSdynamic, heavy_ruleset_start)
|
||||
message_admins("[key_name_admin(ui.user)] reset the heavy ruleset start cooldown.")
|
||||
log_admin("[key_name_admin(ui.user)] reset the heavy ruleset start cooldown.")
|
||||
return TRUE
|
||||
if("latejoin_start_now")
|
||||
COOLDOWN_RESET(SSdynamic, latejoin_ruleset_start)
|
||||
message_admins("[key_name_admin(ui.user)] reset the latejoin ruleset start cooldown.")
|
||||
log_admin("[key_name_admin(ui.user)] reset the latejoin ruleset start cooldown.")
|
||||
return TRUE
|
||||
if("reset_midround_cooldown")
|
||||
COOLDOWN_RESET(SSdynamic, midround_cooldown)
|
||||
message_admins("[key_name_admin(ui.user)] reset the midround cooldown.")
|
||||
log_admin("[key_name_admin(ui.user)] reset the midround cooldown.")
|
||||
return TRUE
|
||||
if("reset_latejoin_cooldown")
|
||||
COOLDOWN_RESET(SSdynamic, latejoin_cooldown)
|
||||
message_admins("[key_name_admin(ui.user)] reset the latejoin cooldown.")
|
||||
log_admin("[key_name_admin(ui.user)] reset the latejoin cooldown.")
|
||||
return TRUE
|
||||
if("hide_ruleset")
|
||||
var/index = params["ruleset_index"]
|
||||
if(length(SSdynamic.executed_rulesets) < index)
|
||||
return
|
||||
var/datum/dynamic_ruleset/ruleset = SSdynamic.executed_rulesets[index]
|
||||
if(!ruleset)
|
||||
return
|
||||
if(ruleset in SSdynamic.unreported_rulesets)
|
||||
SSdynamic.unreported_rulesets -= ruleset
|
||||
message_admins("[key_name_admin(ui.user)] hid [ruleset] from the roundend report.")
|
||||
log_admin("[key_name_admin(ui.user)] hid [ruleset] from the roundend report.")
|
||||
else
|
||||
SSdynamic.unreported_rulesets += ruleset
|
||||
message_admins("[key_name_admin(ui.user)] unhid [ruleset] from the roundend report.")
|
||||
log_admin("[key_name_admin(ui.user)] unhid [ruleset] from the roundend report.")
|
||||
return TRUE
|
||||
if("toggle_antag_events")
|
||||
SSdynamic.antag_events_enabled = !SSdynamic.antag_events_enabled
|
||||
message_admins("[key_name_admin(ui.user)] [SSdynamic.antag_events_enabled ? "enabled" : "disabled"] antag events.")
|
||||
log_admin("[key_name_admin(ui.user)] [SSdynamic.antag_events_enabled ? "enabled" : "disabled"] antag events.")
|
||||
return TRUE
|
||||
@@ -1,25 +0,0 @@
|
||||
/datum/controller/subsystem/dynamic/proc/setup_hijacking()
|
||||
RegisterSignal(SSdcs, COMSIG_GLOB_PRE_RANDOM_EVENT, PROC_REF(on_pre_random_event))
|
||||
|
||||
/datum/controller/subsystem/dynamic/proc/on_pre_random_event(datum/source, datum/round_event_control/round_event_control)
|
||||
SIGNAL_HANDLER
|
||||
if (!round_event_control.dynamic_should_hijack)
|
||||
return
|
||||
|
||||
if (random_event_hijacked != HIJACKED_NOTHING)
|
||||
log_dynamic_and_announce("Random event [round_event_control.name] tried to roll, but Dynamic vetoed it (random event has already ran).")
|
||||
SSevents.spawnEvent()
|
||||
SSevents.reschedule()
|
||||
return CANCEL_PRE_RANDOM_EVENT
|
||||
|
||||
var/time_range = rand(random_event_hijack_minimum, random_event_hijack_maximum)
|
||||
|
||||
if (world.time - last_midround_injection_attempt < time_range)
|
||||
random_event_hijacked = HIJACKED_TOO_RECENT
|
||||
log_dynamic_and_announce("Random event [round_event_control.name] tried to roll, but the last midround injection \
|
||||
was too recent. Heavy injection chance has been raised to [get_heavy_midround_injection_chance(dry_run = TRUE)]%.")
|
||||
return CANCEL_PRE_RANDOM_EVENT
|
||||
|
||||
if (next_midround_injection() - world.time < time_range)
|
||||
log_dynamic_and_announce("Random event [round_event_control.name] tried to roll, but the next midround injection is too soon.")
|
||||
return CANCEL_PRE_RANDOM_EVENT
|
||||
@@ -1,101 +0,0 @@
|
||||
/// A "snapshot" of dynamic at an important point in time.
|
||||
/// Exported to JSON in the dynamic.json log file.
|
||||
/datum/dynamic_snapshot
|
||||
/// The remaining midround threat
|
||||
var/remaining_threat
|
||||
|
||||
/// The world.time when the snapshot was taken
|
||||
var/time
|
||||
|
||||
/// The total number of players in the server
|
||||
var/total_players
|
||||
|
||||
/// The number of alive players
|
||||
var/alive_players
|
||||
|
||||
/// The number of dead players
|
||||
var/dead_players
|
||||
|
||||
/// The number of observers
|
||||
var/observers
|
||||
|
||||
/// The number of alive antags
|
||||
var/alive_antags
|
||||
|
||||
/// The rulesets chosen this snapshot
|
||||
var/datum/dynamic_snapshot_ruleset/ruleset_chosen
|
||||
|
||||
/// The cached serialization of this snapshot
|
||||
var/serialization
|
||||
|
||||
/// A ruleset chosen during a snapshot
|
||||
/datum/dynamic_snapshot_ruleset
|
||||
/// The name of the ruleset chosen
|
||||
var/name
|
||||
|
||||
/// If it is a round start ruleset, how much it was scaled by
|
||||
var/scaled
|
||||
|
||||
/// The number of assigned antags
|
||||
var/assigned
|
||||
|
||||
/datum/dynamic_snapshot_ruleset/New(datum/dynamic_ruleset/ruleset)
|
||||
name = ruleset.name
|
||||
assigned = ruleset.assigned.len
|
||||
|
||||
if (istype(ruleset, /datum/dynamic_ruleset/roundstart))
|
||||
scaled = ruleset.scaled_times
|
||||
|
||||
/// Convert the snapshot to an associative list
|
||||
/datum/dynamic_snapshot/proc/to_list()
|
||||
if (!isnull(serialization))
|
||||
return serialization
|
||||
|
||||
serialization = list(
|
||||
"remaining_threat" = remaining_threat,
|
||||
"time" = time,
|
||||
"total_players" = total_players,
|
||||
"alive_players" = alive_players,
|
||||
"dead_players" = dead_players,
|
||||
"observers" = observers,
|
||||
"alive_antags" = alive_antags,
|
||||
"ruleset_chosen" = list(
|
||||
"name" = ruleset_chosen.name,
|
||||
"scaled" = ruleset_chosen.scaled,
|
||||
"assigned" = ruleset_chosen.assigned,
|
||||
),
|
||||
)
|
||||
|
||||
return serialization
|
||||
|
||||
/// Updates the log for the current snapshots.
|
||||
/datum/controller/subsystem/dynamic/proc/update_log()
|
||||
var/list/serialized = list()
|
||||
serialized["threat_level"] = threat_level
|
||||
serialized["round_start_budget"] = initial_round_start_budget
|
||||
serialized["mid_round_budget"] = threat_level - initial_round_start_budget
|
||||
|
||||
var/list/serialized_snapshots = list()
|
||||
for (var/datum/dynamic_snapshot/snapshot as anything in snapshots)
|
||||
serialized_snapshots += list(snapshot.to_list())
|
||||
serialized["snapshots"] = serialized_snapshots
|
||||
|
||||
rustg_file_write(json_encode(serialized), "[GLOB.log_directory]/dynamic.json")
|
||||
rustg_file_write(json_encode(serialized), "[GLOB.public_log_directory]/dynamic.json") // BUBBER EDIT
|
||||
|
||||
/// Creates a new snapshot with the given rulesets chosen, and writes to the JSON output.
|
||||
/datum/controller/subsystem/dynamic/proc/new_snapshot(datum/dynamic_ruleset/ruleset_chosen)
|
||||
var/datum/dynamic_snapshot/new_snapshot = new
|
||||
|
||||
new_snapshot.remaining_threat = mid_round_budget
|
||||
new_snapshot.time = world.time
|
||||
new_snapshot.alive_players = GLOB.alive_player_list.len
|
||||
new_snapshot.dead_players = GLOB.dead_player_list.len
|
||||
new_snapshot.observers = GLOB.current_observers_list.len
|
||||
new_snapshot.total_players = new_snapshot.alive_players + new_snapshot.dead_players + new_snapshot.observers
|
||||
new_snapshot.alive_antags = GLOB.current_living_antags.len
|
||||
new_snapshot.ruleset_chosen = new /datum/dynamic_snapshot_ruleset(ruleset_chosen)
|
||||
|
||||
LAZYADD(snapshots, new_snapshot)
|
||||
|
||||
update_log()
|
||||
@@ -1,108 +0,0 @@
|
||||
/// Returns the world.time of the next midround injection.
|
||||
/// Will return a cached result from `next_midround_injection`, the variable.
|
||||
/// If that variable is null, will generate a new one.
|
||||
/datum/controller/subsystem/dynamic/proc/next_midround_injection()
|
||||
if (!isnull(next_midround_injection))
|
||||
return next_midround_injection
|
||||
|
||||
// Admins can futz around with the midround threat, and we want to be able to react to that
|
||||
var/midround_threat = threat_level - round_start_budget
|
||||
|
||||
var/rolls = CEILING(midround_threat / threat_per_midround_roll, 1)
|
||||
var/distance = ((1 / (rolls + 1)) * midround_upper_bound) + midround_lower_bound
|
||||
|
||||
if (last_midround_injection_attempt == 0)
|
||||
last_midround_injection_attempt = SSticker.round_start_time
|
||||
|
||||
return last_midround_injection_attempt + distance
|
||||
|
||||
/datum/controller/subsystem/dynamic/proc/try_midround_roll()
|
||||
if (!mid_forced_injection && next_midround_injection() > world.time)
|
||||
return
|
||||
|
||||
if (GLOB.dynamic_forced_extended)
|
||||
return
|
||||
|
||||
if (EMERGENCY_PAST_POINT_OF_NO_RETURN)
|
||||
return
|
||||
|
||||
var/spawn_heavy = prob(get_heavy_midround_injection_chance())
|
||||
|
||||
last_midround_injection_attempt = world.time
|
||||
next_midround_injection = null
|
||||
mid_forced_injection = FALSE
|
||||
|
||||
log_dynamic_and_announce("A midround ruleset is rolling, and will be [spawn_heavy ? "HEAVY" : "LIGHT"].")
|
||||
|
||||
random_event_hijacked = HIJACKED_NOTHING
|
||||
|
||||
var/list/drafted_heavies = list()
|
||||
var/list/drafted_lights = list()
|
||||
|
||||
for (var/datum/dynamic_ruleset/midround/ruleset in midround_rules)
|
||||
if (ruleset.weight == 0)
|
||||
log_dynamic("FAIL: [ruleset] has a weight of 0")
|
||||
continue
|
||||
|
||||
if (!ruleset.acceptable(GLOB.alive_player_list.len, threat_level))
|
||||
var/ruleset_forced = GLOB.dynamic_forced_rulesets[type] || RULESET_NOT_FORCED
|
||||
if (ruleset_forced == RULESET_NOT_FORCED)
|
||||
log_dynamic("FAIL: [ruleset] is not acceptable with the current parameters. Alive players: [GLOB.alive_player_list.len], threat level: [threat_level]")
|
||||
else
|
||||
log_dynamic("FAIL: [ruleset] was disabled.")
|
||||
continue
|
||||
|
||||
if (mid_round_budget < ruleset.cost)
|
||||
log_dynamic("FAIL: [ruleset] is too expensive, and cannot be bought. Midround budget: [mid_round_budget], ruleset cost: [ruleset.cost]")
|
||||
continue
|
||||
|
||||
if (ruleset.minimum_round_time > world.time - SSticker.round_start_time)
|
||||
log_dynamic("FAIL: [ruleset] is trying to run too early. Minimum round time: [ruleset.minimum_round_time], current round time: [world.time - SSticker.round_start_time]")
|
||||
continue
|
||||
|
||||
// If admins have disabled dynamic from picking from the ghost pool
|
||||
if(istype(ruleset, /datum/dynamic_ruleset/midround/from_ghosts) && !(GLOB.ghost_role_flags & GHOSTROLE_MIDROUND_EVENT))
|
||||
log_dynamic("FAIL: [ruleset] is a from_ghosts ruleset, but ghost roles are disabled")
|
||||
continue
|
||||
|
||||
ruleset.trim_candidates()
|
||||
ruleset.load_templates()
|
||||
if (!ruleset.ready())
|
||||
log_dynamic("FAIL: [ruleset] is not ready()")
|
||||
continue
|
||||
|
||||
var/ruleset_is_heavy = (ruleset.midround_ruleset_style == MIDROUND_RULESET_STYLE_HEAVY)
|
||||
if (ruleset_is_heavy)
|
||||
drafted_heavies[ruleset] = ruleset.get_weight()
|
||||
else
|
||||
drafted_lights[ruleset] = ruleset.get_weight()
|
||||
|
||||
var/heavy_light_log_count = "[drafted_heavies.len] heavies / [drafted_lights.len] lights"
|
||||
|
||||
log_dynamic("Rolling [spawn_heavy ? "HEAVY" : "LIGHT"]... [heavy_light_log_count]")
|
||||
|
||||
if (spawn_heavy && drafted_heavies.len > 0 && pick_midround_rule(drafted_heavies, "heavy rulesets"))
|
||||
return
|
||||
else if (drafted_lights.len > 0 && pick_midround_rule(drafted_lights, "light rulesets"))
|
||||
if (spawn_heavy)
|
||||
log_dynamic_and_announce("A heavy ruleset was intended to roll, but there weren't any available. [heavy_light_log_count]")
|
||||
else
|
||||
log_dynamic_and_announce("No midround rulesets could be drafted. ([heavy_light_log_count])")
|
||||
|
||||
/// Gets the chance for a heavy ruleset midround injection, the dry_run argument is only used for forced injection.
|
||||
/datum/controller/subsystem/dynamic/proc/get_heavy_midround_injection_chance(dry_run)
|
||||
var/chance_modifier = 1
|
||||
var/next_midround_roll = next_midround_injection() - SSticker.round_start_time
|
||||
|
||||
if (random_event_hijacked != HIJACKED_NOTHING)
|
||||
chance_modifier += (hijacked_random_event_injection_chance_modifier / 100)
|
||||
|
||||
if (GLOB.current_living_antags.len == 0)
|
||||
chance_modifier += 0.5
|
||||
|
||||
if (GLOB.dead_player_list.len > GLOB.alive_player_list.len)
|
||||
chance_modifier -= 0.3
|
||||
|
||||
var/heavy_coefficient = CLAMP01((next_midround_roll - midround_light_upper_bound) / (midround_heavy_lower_bound - midround_light_upper_bound))
|
||||
|
||||
return 100 * (heavy_coefficient * max(1, chance_modifier))
|
||||
@@ -0,0 +1,128 @@
|
||||
/datum/dynamic_ruleset/latejoin
|
||||
min_antag_cap = 1
|
||||
max_antag_cap = 1
|
||||
repeatable = TRUE
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/set_config_value(nvar, nval)
|
||||
if(nvar == NAMEOF(src, min_antag_cap) || nvar == NAMEOF(src, max_antag_cap))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/vv_edit_var(var_name, var_value)
|
||||
if(var_name == NAMEOF(src, min_antag_cap) || var_name == NAMEOF(src, max_antag_cap))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/is_valid_candidate(mob/candidate, client/candidate_client)
|
||||
if(isnull(candidate.mind))
|
||||
return FALSE
|
||||
if(candidate.mind.assigned_role.title in get_blacklisted_roles())
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/traitor
|
||||
name = "Traitor"
|
||||
config_tag = "Latejoin Traitor"
|
||||
preview_antag_datum = /datum/antagonist/traitor
|
||||
pref_flag = ROLE_SYNDICATE_INFILTRATOR
|
||||
jobban_flag = ROLE_TRAITOR
|
||||
weight = 10
|
||||
min_pop = 3
|
||||
blacklisted_roles = list(
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
)
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/traitor/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/traitor)
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/heretic
|
||||
name = "Heretic"
|
||||
config_tag = "Latejoin Heretic"
|
||||
preview_antag_datum = /datum/antagonist/heretic
|
||||
pref_flag = ROLE_HERETIC_SMUGGLER
|
||||
jobban_flag = ROLE_HERETIC
|
||||
weight = 3
|
||||
min_pop = 30 // Ensures good spread of sacrifice targets
|
||||
ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_HERETIC_SACRIFICE)
|
||||
blacklisted_roles = list(
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
)
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/heretic/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/heretic)
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/changeling
|
||||
name = "Changeling"
|
||||
config_tag = "Latejoin Changeling"
|
||||
preview_antag_datum = /datum/antagonist/changeling
|
||||
pref_flag = ROLE_STOWAWAY_CHANGELING
|
||||
jobban_flag = ROLE_CHANGELING
|
||||
weight = 3
|
||||
min_pop = 15
|
||||
blacklisted_roles = list(
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
)
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/changeling/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/changeling)
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/revolution
|
||||
name = "Revolution"
|
||||
config_tag = "Latejoin Revolution"
|
||||
preview_antag_datum = /datum/antagonist/rev/head
|
||||
pref_flag = ROLE_PROVOCATEUR
|
||||
jobban_flag = ROLE_REV_HEAD
|
||||
ruleset_flags = RULESET_HIGH_IMPACT
|
||||
weight = 1
|
||||
min_pop = 30
|
||||
repeatable = FALSE
|
||||
/// How many heads of staff are required to be on the station for this to be selected
|
||||
var/heads_necessary = 3
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/revolution/can_be_selected()
|
||||
if(GLOB.revolution_handler)
|
||||
return FALSE
|
||||
var/head_check = 0
|
||||
for(var/mob/player as anything in get_active_player_list(alive_check = TRUE, afk_check = TRUE))
|
||||
if (player.mind.assigned_role.job_flags & JOB_HEAD_OF_STAFF)
|
||||
head_check++
|
||||
return head_check >= heads_necessary
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/revolution/get_always_blacklisted_roles()
|
||||
. = ..()
|
||||
for(var/datum/job/job as anything in SSjob.all_occupations)
|
||||
if(job.job_flags & JOB_HEAD_OF_STAFF)
|
||||
. |= job.title
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/revolution/assign_role(datum/mind/candidate)
|
||||
LAZYADD(candidate.special_roles, "Dormant Head Revolutionary")
|
||||
addtimer(CALLBACK(src, PROC_REF(reveal_head), candidate), 1 MINUTES, TIMER_DELETE_ME)
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/revolution/proc/reveal_head(datum/mind/candidate)
|
||||
LAZYREMOVE(candidate.special_roles, "Dormant Head Revolutionary")
|
||||
|
||||
var/head_check = 0
|
||||
for(var/mob/player as anything in get_active_player_list(alive_check = TRUE, afk_check = TRUE))
|
||||
if(player.mind?.assigned_role.job_flags & JOB_HEAD_OF_STAFF)
|
||||
head_check++
|
||||
|
||||
if(head_check < heads_necessary - 1) // little bit of leeway
|
||||
SSdynamic.unreported_rulesets += src
|
||||
name += " (Canceled)"
|
||||
log_dynamic("[config_tag]: Not enough heads of staff were present to start a revolution.")
|
||||
return
|
||||
|
||||
if(!can_be_headrev(candidate))
|
||||
SSdynamic.unreported_rulesets += src
|
||||
name += " (Canceled)"
|
||||
log_dynamic("[config_tag]: [key_name(candidate)] was ineligible after the timer expired. Ruleset canceled.")
|
||||
message_admins("[config_tag]: [key_name(candidate)] was ineligible after the timer expired. Ruleset canceled.")
|
||||
return
|
||||
|
||||
GLOB.revolution_handler ||= new()
|
||||
var/datum/antagonist/rev/head/new_head = new()
|
||||
new_head.give_flash = TRUE
|
||||
new_head.give_hud = TRUE
|
||||
new_head.remove_clumsy = TRUE
|
||||
candidate.add_antag_datum(new_head, GLOB.revolution_handler.revs)
|
||||
GLOB.revolution_handler.start_revolution()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,433 @@
|
||||
/datum/dynamic_ruleset/roundstart
|
||||
// We can pick multiple of a roundstart ruleset to "scale up" (spawn more of the same type of antag)
|
||||
// Set this to FALSE if you DON'T want this ruleset to "scale up"
|
||||
repeatable = TRUE
|
||||
/// If TRUE, the ruleset will be the only one selected for roundstart
|
||||
var/solo = FALSE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/is_valid_candidate(mob/candidate, client/candidate_client)
|
||||
if(isnull(candidate.mind))
|
||||
return FALSE
|
||||
// Checks that any other roundstart ruleset hasn't already picked this guy
|
||||
for(var/datum/dynamic_ruleset/roundstart/ruleset as anything in SSdynamic.queued_rulesets)
|
||||
if(candidate.mind in ruleset.selected_minds)
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/// Helpful proc - to use if your ruleset forces a job - which ensures a candidate can play the passed job typepath
|
||||
/datum/dynamic_ruleset/roundstart/proc/ruleset_forced_job_check(mob/candidate, client/candidate_client, datum/job/job_typepath)
|
||||
// Malf AI can only go to people who want to be AI
|
||||
if(!candidate_client.prefs.job_preferences[job_typepath::title])
|
||||
return FALSE
|
||||
// And only to people who can actually be AI this round
|
||||
if(SSjob.check_job_eligibility(candidate, SSjob.get_job_type(job_typepath), "[name] Candidacy") != JOB_AVAILABLE)
|
||||
return FALSE
|
||||
// (Something else forced us to play a job that isn't AI)
|
||||
var/forced_job = LAZYACCESS(SSjob.forced_occupations, candidate)
|
||||
if(forced_job && forced_job != job_typepath)
|
||||
return FALSE
|
||||
// (Something else forced us NOT to play AI)
|
||||
if(job_typepath::title in LAZYACCESS(SSjob.prevented_occupations, candidate))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/traitor
|
||||
name = "Traitors"
|
||||
config_tag = "Roundstart Traitor"
|
||||
preview_antag_datum = /datum/antagonist/traitor
|
||||
pref_flag = ROLE_TRAITOR
|
||||
weight = 10
|
||||
min_pop = 3
|
||||
max_antag_cap = list("denominator" = 38)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/traitor/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/traitor)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai
|
||||
name = "Malfunctioning AI"
|
||||
config_tag = "Roundstart Malfunctioning AI"
|
||||
pref_flag = ROLE_MALF
|
||||
preview_antag_datum = /datum/antagonist/malf_ai
|
||||
ruleset_flags = RULESET_HIGH_IMPACT
|
||||
weight = list(
|
||||
DYNAMIC_TIER_LOW = 0,
|
||||
DYNAMIC_TIER_LOWMEDIUM = 1,
|
||||
DYNAMIC_TIER_MEDIUMHIGH = 3,
|
||||
DYNAMIC_TIER_HIGH = 3,
|
||||
)
|
||||
min_pop = 30
|
||||
max_antag_cap = 1
|
||||
repeatable = FALSE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai/get_always_blacklisted_roles()
|
||||
return list()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai/is_valid_candidate(mob/candidate, client/candidate_client)
|
||||
return ..() && ruleset_forced_job_check(candidate, candidate_client, /datum/job/ai)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai/prepare_for_role(datum/mind/candidate)
|
||||
LAZYSET(SSjob.forced_occupations, candidate, /datum/job/ai)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/malf_ai)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai/can_be_selected()
|
||||
return ..() && !HAS_TRAIT(SSstation, STATION_TRAIT_HUMAN_AI)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/blood_brother
|
||||
name = "Blood Brothers"
|
||||
config_tag = "Roundstart Blood Brothers"
|
||||
preview_antag_datum = /datum/antagonist/brother
|
||||
pref_flag = ROLE_BROTHER
|
||||
weight = 5
|
||||
max_antag_cap = list("denominator" = 29)
|
||||
min_pop = 10
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/blood_brother/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/brother)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/changeling
|
||||
name = "Changelings"
|
||||
config_tag = "Roundstart Changeling"
|
||||
preview_antag_datum = /datum/antagonist/changeling
|
||||
pref_flag = ROLE_CHANGELING
|
||||
weight = 3
|
||||
min_pop = 15
|
||||
max_antag_cap = list("denominator" = 29)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/changeling/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/changeling)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/heretic
|
||||
name = "Heretics"
|
||||
config_tag = "Roundstart Heretics"
|
||||
preview_antag_datum = /datum/antagonist/heretic
|
||||
pref_flag = ROLE_HERETIC
|
||||
weight = 3
|
||||
max_antag_cap = list("denominator" = 24)
|
||||
min_pop = 30 // Ensures good spread of sacrifice targets
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/heretic/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/heretic)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/wizard
|
||||
name = "Wizard"
|
||||
config_tag = "Roundstart Wizard"
|
||||
preview_antag_datum = /datum/antagonist/wizard
|
||||
pref_flag = ROLE_WIZARD
|
||||
ruleset_flags = RULESET_INVADER|RULESET_HIGH_IMPACT
|
||||
weight = list(
|
||||
DYNAMIC_TIER_LOW = 0,
|
||||
DYNAMIC_TIER_LOWMEDIUM = 0,
|
||||
DYNAMIC_TIER_MEDIUMHIGH = 1,
|
||||
DYNAMIC_TIER_HIGH = 2,
|
||||
)
|
||||
max_antag_cap = 1
|
||||
min_pop = 30
|
||||
ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_WIZARDDEN)
|
||||
repeatable = FALSE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/wizard/prepare_for_role(datum/mind/candidate)
|
||||
LAZYSET(SSjob.forced_occupations, candidate, /datum/job/space_wizard)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/wizard/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/wizard) // moves to lair for us
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/wizard/round_result()
|
||||
for(var/datum/mind/wiz as anything in selected_minds)
|
||||
if(considered_alive(wiz) && !considered_exiled(wiz))
|
||||
return FALSE
|
||||
|
||||
SSticker.news_report = WIZARD_KILLED
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/blood_cult
|
||||
name = "Blood Cult"
|
||||
config_tag = "Roundstart Blood Cult"
|
||||
preview_antag_datum = /datum/antagonist/cult
|
||||
pref_flag = ROLE_CULTIST
|
||||
ruleset_flags = RULESET_HIGH_IMPACT
|
||||
weight = list(
|
||||
DYNAMIC_TIER_LOW = 0,
|
||||
DYNAMIC_TIER_LOWMEDIUM = 1,
|
||||
DYNAMIC_TIER_MEDIUMHIGH = 3,
|
||||
DYNAMIC_TIER_HIGH = 3,
|
||||
)
|
||||
min_pop = 30
|
||||
blacklisted_roles = list(
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
)
|
||||
min_antag_cap = list("denominator" = 20, "offset" = 1)
|
||||
repeatable = FALSE
|
||||
/// Ratio of cultists getting on the shuttle to be considered a minor win
|
||||
var/ratio_to_be_considered_escaped = 0.5
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/blood_cult/get_always_blacklisted_roles()
|
||||
return ..() | JOB_CHAPLAIN
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/blood_cult/create_execute_args()
|
||||
return list(
|
||||
new /datum/team/cult(),
|
||||
get_most_experienced(selected_minds, pref_flag),
|
||||
)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/blood_cult/execute()
|
||||
. = ..()
|
||||
// future todo, find a cleaner way to get this from execute args
|
||||
var/datum/team/cult/main_cult = locate() in GLOB.antagonist_teams
|
||||
main_cult.setup_objectives()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/blood_cult/assign_role(datum/mind/candidate, datum/team/cult/cult, datum/mind/most_experienced)
|
||||
var/datum/antagonist/cult/cultist = new()
|
||||
cultist.give_equipment = TRUE
|
||||
candidate.add_antag_datum(cultist, cult)
|
||||
if(most_experienced == candidate)
|
||||
cultist.make_cult_leader()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/blood_cult/round_result()
|
||||
var/datum/team/cult/main_cult = locate() in GLOB.antagonist_teams
|
||||
if(main_cult.check_cult_victory())
|
||||
SSticker.mode_result = "win - cult win"
|
||||
SSticker.news_report = CULT_SUMMON
|
||||
return TRUE
|
||||
|
||||
var/num_cultists = main_cult.size_at_maximum || 100
|
||||
var/ratio_to_be_considered_escaped = 0.5
|
||||
var/escaped_cultists = 0
|
||||
for(var/datum/mind/escapee as anything in main_cult.members)
|
||||
if(considered_escaped(escapee))
|
||||
escaped_cultists++
|
||||
|
||||
SSticker.mode_result = "loss - staff stopped the cult"
|
||||
SSticker.news_report = (escaped_cultists / num_cultists) >= ratio_to_be_considered_escaped ? CULT_ESCAPE : CULT_FAILURE
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nukies
|
||||
name = "Nuclear Operatives"
|
||||
config_tag = "Roundstart Nukeops"
|
||||
preview_antag_datum = /datum/antagonist/nukeop
|
||||
pref_flag = ROLE_OPERATIVE
|
||||
ruleset_flags = RULESET_INVADER|RULESET_HIGH_IMPACT
|
||||
weight = list(
|
||||
DYNAMIC_TIER_LOW = 0,
|
||||
DYNAMIC_TIER_LOWMEDIUM = 1,
|
||||
DYNAMIC_TIER_MEDIUMHIGH = 3,
|
||||
DYNAMIC_TIER_HIGH = 3,
|
||||
)
|
||||
min_pop = 30
|
||||
min_antag_cap = list("denominator" = 18, "offset" = 1)
|
||||
ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_NUKIEBASE)
|
||||
repeatable = FALSE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nukies/prepare_for_role(datum/mind/candidate)
|
||||
LAZYSET(SSjob.forced_occupations, candidate, /datum/job/nuclear_operative)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nukies/create_execute_args()
|
||||
return list(
|
||||
new /datum/team/nuclear(),
|
||||
get_most_experienced(selected_minds, pref_flag),
|
||||
)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nukies/assign_role(datum/mind/candidate, datum/team/nuke_team, datum/mind/most_experienced)
|
||||
if(most_experienced == candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/nukeop/leader, nuke_team)
|
||||
else
|
||||
candidate.add_antag_datum(/datum/antagonist/nukeop, nuke_team)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nukies/round_result()
|
||||
var/datum/antagonist/nukeop/nukie = selected_minds[1].has_antag_datum(/datum/antagonist/nukeop)
|
||||
var/datum/team/nuclear/nuke_team = nukie.get_team()
|
||||
var/result = nuke_team.get_result()
|
||||
switch(result)
|
||||
if(NUKE_RESULT_FLUKE)
|
||||
SSticker.mode_result = "loss - syndicate nuked - disk secured"
|
||||
SSticker.news_report = NUKE_SYNDICATE_BASE
|
||||
if(NUKE_RESULT_NUKE_WIN)
|
||||
SSticker.mode_result = "win - syndicate nuke"
|
||||
SSticker.news_report = STATION_DESTROYED_NUKE
|
||||
if(NUKE_RESULT_NOSURVIVORS)
|
||||
SSticker.mode_result = "halfwin - syndicate nuke - did not evacuate in time"
|
||||
SSticker.news_report = STATION_DESTROYED_NUKE
|
||||
if(NUKE_RESULT_WRONG_STATION)
|
||||
SSticker.mode_result = "halfwin - blew wrong station"
|
||||
SSticker.news_report = NUKE_MISS
|
||||
if(NUKE_RESULT_WRONG_STATION_DEAD)
|
||||
SSticker.mode_result = "halfwin - blew wrong station - did not evacuate in time"
|
||||
SSticker.news_report = NUKE_MISS
|
||||
if(NUKE_RESULT_CREW_WIN_SYNDIES_DEAD)
|
||||
SSticker.mode_result = "loss - evacuation - disk secured - syndi team dead"
|
||||
SSticker.news_report = OPERATIVES_KILLED
|
||||
if(NUKE_RESULT_CREW_WIN)
|
||||
SSticker.mode_result = "loss - evacuation - disk secured"
|
||||
SSticker.news_report = OPERATIVES_KILLED
|
||||
if(NUKE_RESULT_DISK_LOST)
|
||||
SSticker.mode_result = "halfwin - evacuation - disk not secured"
|
||||
SSticker.news_report = OPERATIVE_SKIRMISH
|
||||
if(NUKE_RESULT_DISK_STOLEN)
|
||||
SSticker.mode_result = "halfwin - detonation averted"
|
||||
SSticker.news_report = OPERATIVE_SKIRMISH
|
||||
else
|
||||
SSticker.mode_result = "halfwin - interrupted"
|
||||
SSticker.news_report = OPERATIVE_SKIRMISH
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nukies/clown
|
||||
name = "Clown Operatives"
|
||||
config_tag = "Roundstart Clownops"
|
||||
preview_antag_datum = /datum/antagonist/nukeop/clownop
|
||||
pref_flag = ROLE_CLOWN_OPERATIVE
|
||||
weight = 0
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nukies/clown/prepare_for_role(datum/mind/candidate)
|
||||
LAZYSET(SSjob.forced_occupations, candidate, /datum/job/nuclear_operative/clown_operative)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nukies/clown/assign_role(datum/mind/candidate, datum/team/nuke_team, datum/mind/most_experienced)
|
||||
if(most_experienced == candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/nukeop/leader/clownop)
|
||||
else
|
||||
candidate.add_antag_datum(/datum/antagonist/nukeop/clownop)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revolution
|
||||
name = "Revolution"
|
||||
config_tag = "Roundstart Revolution"
|
||||
preview_antag_datum = /datum/antagonist/rev/head
|
||||
pref_flag = ROLE_REV_HEAD
|
||||
ruleset_flags = RULESET_HIGH_IMPACT
|
||||
weight = list(
|
||||
DYNAMIC_TIER_LOW = 0,
|
||||
DYNAMIC_TIER_LOWMEDIUM = 1,
|
||||
DYNAMIC_TIER_MEDIUMHIGH = 3,
|
||||
DYNAMIC_TIER_HIGH = 3,
|
||||
)
|
||||
min_pop = 30
|
||||
min_antag_cap = 1
|
||||
max_antag_cap = 3
|
||||
repeatable = FALSE
|
||||
/// If we have fewer heads of staff than this 7 minutes into the round, we'll cancel the revolution
|
||||
var/heads_necessary = 2
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revolution/get_always_blacklisted_roles()
|
||||
. = ..()
|
||||
for(var/datum/job/job as anything in SSjob.all_occupations)
|
||||
if(job.job_flags & JOB_HEAD_OF_STAFF)
|
||||
. |= job.title
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revolution/assign_role(datum/mind/candidate)
|
||||
LAZYADD(candidate.special_roles, "Dormant Head Revolutionary")
|
||||
addtimer(CALLBACK(src, PROC_REF(reveal_head), candidate), 7 MINUTES, TIMER_DELETE_ME)
|
||||
|
||||
/// Reveals the headrev after a set amount of time
|
||||
/datum/dynamic_ruleset/roundstart/revolution/proc/reveal_head(datum/mind/candidate)
|
||||
LAZYREMOVE(candidate.special_roles, "Dormant Head Revolutionary")
|
||||
|
||||
var/head_check = 0
|
||||
for(var/mob/player as anything in get_active_player_list(alive_check = TRUE, afk_check = TRUE))
|
||||
if(player.mind?.assigned_role.job_flags & JOB_HEAD_OF_STAFF)
|
||||
head_check++
|
||||
|
||||
if(head_check < heads_necessary)
|
||||
log_dynamic("[config_tag]: Not enough heads of staff were present to start a revolution.")
|
||||
addtimer(CALLBACK(src, PROC_REF(revs_execution_failed)), 1 MINUTES, TIMER_UNIQUE|TIMER_DELETE_ME)
|
||||
return
|
||||
|
||||
if(!can_be_headrev(candidate))
|
||||
log_dynamic("[config_tag]: [key_name(candidate)] was not eligible to be a headrev after the timer expired - finding a replacement.")
|
||||
find_another_headrev()
|
||||
return
|
||||
|
||||
GLOB.revolution_handler ||= new()
|
||||
var/datum/antagonist/rev/head/new_head = new()
|
||||
new_head.give_flash = TRUE
|
||||
new_head.give_hud = TRUE
|
||||
new_head.remove_clumsy = TRUE
|
||||
candidate.add_antag_datum(new_head, GLOB.revolution_handler.revs)
|
||||
GLOB.revolution_handler.start_revolution()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revolution/proc/find_another_headrev()
|
||||
for(var/mob/living/carbon/human/upstanding_citizen in GLOB.player_list)
|
||||
if(!can_be_headrev(upstanding_citizen.mind))
|
||||
continue
|
||||
reveal_head(upstanding_citizen.mind)
|
||||
log_dynamic("[config_tag]: [key_name(upstanding_citizen)] was selected as a replacement headrev.")
|
||||
return
|
||||
|
||||
log_dynamic("[config_tag]: Failed to find a replacement headrev.")
|
||||
addtimer(CALLBACK(src, PROC_REF(revs_execution_failed)), 1 MINUTES, TIMER_UNIQUE|TIMER_DELETE_ME)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revolution/proc/revs_execution_failed()
|
||||
if(GLOB.revolution_handler)
|
||||
return
|
||||
// Execution is effectively cancelled by this point, but it's not like we can go back and refund it
|
||||
SSdynamic.unreported_rulesets += src
|
||||
name += " (Canceled)"
|
||||
log_dynamic("[config_tag]: All headrevs were ineligible after the timer expired, and no replacements could be found. Ruleset canceled.")
|
||||
message_admins("[config_tag]: All headrevs were ineligible after the timer expired, and no replacements could be found. Ruleset canceled.")
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/spies
|
||||
name = "Spies"
|
||||
config_tag = "Roundstart Spies"
|
||||
preview_antag_datum = /datum/antagonist/spy
|
||||
pref_flag = ROLE_SPY
|
||||
weight = list(
|
||||
DYNAMIC_TIER_LOW = 0,
|
||||
DYNAMIC_TIER_LOWMEDIUM = 1,
|
||||
DYNAMIC_TIER_MEDIUMHIGH = 3,
|
||||
DYNAMIC_TIER_HIGH = 3,
|
||||
)
|
||||
min_pop = 10
|
||||
min_antag_cap = list("denominator" = 20, "offset" = 1)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/spies/assign_role(datum/mind/candidate)
|
||||
candidate.add_antag_datum(/datum/antagonist/spy)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/extended
|
||||
name = "Extended"
|
||||
config_tag = "Extended"
|
||||
weight = 0
|
||||
min_antag_cap = 0
|
||||
repeatable = FALSE
|
||||
solo = TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/extended/execute()
|
||||
// No midrounds no latejoins
|
||||
for(var/category in SSdynamic.rulesets_to_spawn)
|
||||
SSdynamic.rulesets_to_spawn[category] = 0
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/meteor
|
||||
name = "Meteor"
|
||||
config_tag = "Meteor"
|
||||
weight = 0
|
||||
min_antag_cap = 0
|
||||
repeatable = FALSE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/meteor/execute()
|
||||
GLOB.meteor_mode ||= new()
|
||||
GLOB.meteor_mode.start_meteor()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nations
|
||||
name = "Nations"
|
||||
config_tag = "Nations"
|
||||
weight = 0
|
||||
min_antag_cap = 0
|
||||
repeatable = FALSE
|
||||
solo = TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nations/execute()
|
||||
// No midrounds no latejoins
|
||||
for(var/category in SSdynamic.rulesets_to_spawn)
|
||||
SSdynamic.rulesets_to_spawn[category] = 0
|
||||
|
||||
//notably assistant is not in this list to prevent the round turning into BARBARISM instantly, and silicon is in this list for UN
|
||||
var/list/department_types = list(
|
||||
/datum/job_department/silicon, //united nations
|
||||
/datum/job_department/cargo,
|
||||
/datum/job_department/engineering,
|
||||
/datum/job_department/medical,
|
||||
/datum/job_department/science,
|
||||
/datum/job_department/security,
|
||||
/datum/job_department/service,
|
||||
)
|
||||
|
||||
for(var/department_type in department_types)
|
||||
create_separatist_nation(department_type, announcement = FALSE, dangerous = FALSE, message_admins = FALSE)
|
||||
|
||||
GLOB.round_default_lawset = /datum/ai_laws/united_nations
|
||||
@@ -1,310 +0,0 @@
|
||||
/datum/dynamic_ruleset
|
||||
/// For admin logging and round end screen.
|
||||
// If you want to change this variable name, the force latejoin/midround rulesets
|
||||
// to not use sort_names.
|
||||
var/name = ""
|
||||
/// For admin logging and round end screen, do not change this unless making a new rule type.
|
||||
var/ruletype = ""
|
||||
/// If set to TRUE, the rule won't be discarded after being executed, and dynamic will call rule_process() every time it ticks.
|
||||
var/persistent = FALSE
|
||||
/// If set to TRUE, dynamic will be able to draft this ruleset again later on. (doesn't apply for roundstart rules)
|
||||
var/repeatable = FALSE
|
||||
/// If set higher than 0 decreases weight by itself causing the ruleset to appear less often the more it is repeated.
|
||||
var/repeatable_weight_decrease = 2
|
||||
/// List of players that are being drafted for this rule
|
||||
var/list/mob/candidates = list()
|
||||
/// List of players that were selected for this rule. This can be minds, or mobs.
|
||||
var/list/assigned = list()
|
||||
/// Preferences flag such as ROLE_WIZARD that need to be turned on for players to be antag.
|
||||
var/antag_flag = null
|
||||
/// The antagonist datum that is assigned to the mobs mind on ruleset execution.
|
||||
var/datum/antagonist/antag_datum = null
|
||||
/// The required minimum account age for this ruleset.
|
||||
var/minimum_required_age = 7
|
||||
/// If set, and config flag protect_roles_from_antagonist is false, then the rule will not pick players from these roles.
|
||||
var/list/protected_roles = list()
|
||||
/// If set, rule will deny candidates from those roles always.
|
||||
var/list/restricted_roles = list()
|
||||
/// If set, rule will only accept candidates from those roles. If on a roundstart ruleset, requires the player to have the correct antag pref enabled and any of the possible roles enabled.
|
||||
var/list/exclusive_roles = list()
|
||||
/// If set, there needs to be a certain amount of players doing those roles (among the players who won't be drafted) for the rule to be drafted IMPORTANT: DOES NOT WORK ON ROUNDSTART RULESETS.
|
||||
var/list/enemy_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
/// If enemy_roles was set, this is the amount of enemy job workers needed per threat_level range (0-10,10-20,etc) IMPORTANT: DOES NOT WORK ON ROUNDSTART RULESETS.
|
||||
var/required_enemies = list(1,1,0,0,0,0,0,0,0,0)
|
||||
/// The rule needs this many candidates (post-trimming) to be executed (example: Cult needs 4 players at round start)
|
||||
var/required_candidates = 0
|
||||
/// 0 -> 9, probability for this rule to be picked against other rules. If zero this will effectively disable the rule.
|
||||
var/weight = 5
|
||||
/// Threat cost for this rule, this is decreased from the threat level when the rule is executed.
|
||||
var/cost = 0
|
||||
/// Cost per level the rule scales up.
|
||||
var/scaling_cost = 0
|
||||
/// How many times a rule has scaled up upon getting picked.
|
||||
var/scaled_times = 0
|
||||
/// Used for the roundend report
|
||||
var/total_cost = 0
|
||||
/// A flag that determines how the ruleset is handled. Check __DEFINES/dynamic.dm for an explanation of the accepted values.
|
||||
var/flags = NONE
|
||||
/// Pop range per requirement. If zero defaults to dynamic's pop_per_requirement.
|
||||
var/pop_per_requirement = 0
|
||||
/// Requirements are the threat level requirements per pop range.
|
||||
/// With the default values, The rule will never get drafted below 10 threat level (aka: "peaceful extended"), and it requires a higher threat level at lower pops.
|
||||
var/list/requirements = list(40,30,20,10,10,10,10,10,10,10)
|
||||
/// If a role is to be considered another for the purpose of banning.
|
||||
var/antag_flag_override = null
|
||||
/// If set, will check this preference instead of antag_flag.
|
||||
var/antag_preference = null
|
||||
/// If a ruleset type which is in this list has been executed, then the ruleset will not be executed.
|
||||
var/list/blocking_rules = list()
|
||||
/// The minimum amount of players required for the rule to be considered.
|
||||
var/minimum_players = 0
|
||||
/// The maximum amount of players required for the rule to be considered.
|
||||
/// Anything below zero or exactly zero is ignored.
|
||||
var/maximum_players = 0
|
||||
/// Calculated during acceptable(), used in scaling and team sizes.
|
||||
var/indice_pop = 0
|
||||
/// Base probability used in scaling. The higher it is, the more likely to scale. Kept as a var to allow for config editing._SendSignal(sigtype, list/arguments)
|
||||
var/base_prob = 60
|
||||
/// Delay for when execute will get called from the time of post_setup (roundstart) or process (midround/latejoin).
|
||||
/// Make sure your ruleset works with execute being called during the game when using this, and that the clean_up proc reverts it properly in case of faliure.
|
||||
var/delay = 0
|
||||
|
||||
/// Judges the amount of antagonists to apply, for both solo and teams.
|
||||
/// Note that some antagonists (such as traitors, lings, heretics, etc) will add more based on how many times they've been scaled.
|
||||
/// Written as a linear equation--ceil(x/denominator) + offset, or as a fixed constant.
|
||||
/// If written as a linear equation, will be in the form of `list("denominator" = denominator, "offset" = offset).
|
||||
var/antag_cap = 0
|
||||
|
||||
/// A list, or null, of templates that the ruleset depends on to function correctly
|
||||
var/list/ruleset_lazy_templates
|
||||
/// In what categories is this ruleset allowed to run? Used by station traits
|
||||
var/ruleset_category = RULESET_CATEGORY_DEFAULT
|
||||
|
||||
/datum/dynamic_ruleset/New()
|
||||
// Rulesets can be instantiated more than once, such as when an admin clicks
|
||||
// "Execute Midround Ruleset". Thus, it would be wrong to perform any
|
||||
// side effects here. Dynamic rulesets should be stateless anyway.
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
|
||||
..()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart // One or more of those drafted at roundstart
|
||||
ruletype = ROUNDSTART_RULESET
|
||||
|
||||
// Can be drafted when a player joins the server
|
||||
/datum/dynamic_ruleset/latejoin
|
||||
ruletype = LATEJOIN_RULESET
|
||||
|
||||
/// By default, a rule is acceptable if it satisfies the threat level/population requirements.
|
||||
/// If your rule has extra checks, such as counting security officers, do that in ready() instead
|
||||
/datum/dynamic_ruleset/proc/acceptable(population = 0, threat_level = 0)
|
||||
var/ruleset_forced = GLOB.dynamic_forced_rulesets[type] || RULESET_NOT_FORCED
|
||||
if (ruleset_forced != RULESET_NOT_FORCED)
|
||||
if (ruleset_forced == RULESET_FORCE_ENABLED)
|
||||
return TRUE
|
||||
else
|
||||
log_dynamic("FAIL: [src] was disabled in admin panel.")
|
||||
return FALSE
|
||||
|
||||
if(!is_valid_population(population))
|
||||
var/range = maximum_players > 0 ? "([minimum_players] - [maximum_players])" : "(minimum: [minimum_players])"
|
||||
log_dynamic("FAIL: [src] failed acceptable: min/max players out of range [range] vs population ([population])")
|
||||
return FALSE
|
||||
|
||||
if (!is_valid_threat(population, threat_level))
|
||||
log_dynamic("FAIL: [src] failed acceptable: threat_level ([threat_level]) < requirement ([requirements[indice_pop]])")
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
/// Returns true if we have enough players to run
|
||||
/datum/dynamic_ruleset/proc/is_valid_population(population)
|
||||
if(minimum_players > population)
|
||||
return FALSE
|
||||
if(maximum_players > 0 && population > maximum_players)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/// Sets the current threat indices and returns true if we're inside of them
|
||||
/datum/dynamic_ruleset/proc/is_valid_threat(population, threat_level)
|
||||
pop_per_requirement = pop_per_requirement > 0 ? pop_per_requirement : SSdynamic.pop_per_requirement
|
||||
indice_pop = min(requirements.len,round(population/pop_per_requirement)+1)
|
||||
return threat_level >= requirements[indice_pop]
|
||||
|
||||
/// When picking rulesets, if dynamic picks the same one multiple times, it will "scale up".
|
||||
/// However, doing this blindly would result in lowpop rounds (think under 10 people) where over 80% of the crew is antags!
|
||||
/// This function is here to ensure the antag ratio is kept under control while scaling up.
|
||||
/// Returns how much threat to actually spend in the end.
|
||||
/datum/dynamic_ruleset/proc/scale_up(population, max_scale)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
if (!scaling_cost)
|
||||
return 0
|
||||
|
||||
var/antag_fraction = 0
|
||||
for(var/datum/dynamic_ruleset/ruleset as anything in (SSdynamic.executed_rules + list(src))) // we care about the antags we *will* assign, too
|
||||
antag_fraction += ruleset.get_antag_cap_scaling_included(population) / SSdynamic.roundstart_pop_ready
|
||||
|
||||
for(var/i in 1 to max_scale)
|
||||
if(antag_fraction < 0.25)
|
||||
scaled_times += 1
|
||||
antag_fraction += get_scaling_antag_cap(population) / SSdynamic.roundstart_pop_ready // we added new antags, gotta update the %
|
||||
|
||||
return scaled_times * scaling_cost
|
||||
|
||||
/// Returns how many more antags to add while scaling with a given population.
|
||||
/// By default rulesets scale linearly, but you can override this to make them scale differently.
|
||||
/datum/dynamic_ruleset/proc/get_scaling_antag_cap(population)
|
||||
return get_antag_cap(population)
|
||||
|
||||
/// Returns what the antag cap with the given population is.
|
||||
/datum/dynamic_ruleset/proc/get_antag_cap(population)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
if (isnum(antag_cap))
|
||||
return antag_cap
|
||||
|
||||
return CEILING(population / antag_cap["denominator"], 1) + (antag_cap["offset"] || 0)
|
||||
|
||||
/// Gets the 'final' antag cap for this ruleset, which is the base cap plus the scaled cap.
|
||||
/datum/dynamic_ruleset/proc/get_antag_cap_scaling_included(population)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
var/base_cap = get_antag_cap(population)
|
||||
var/modded_cap = scaled_times * get_scaling_antag_cap(population)
|
||||
return base_cap + modded_cap
|
||||
|
||||
/// This is called if persistent variable is true everytime SSTicker ticks.
|
||||
/datum/dynamic_ruleset/proc/rule_process()
|
||||
return
|
||||
|
||||
/// Called on pre_setup for roundstart rulesets.
|
||||
/// Do everything you need to do before job is assigned here.
|
||||
/// IMPORTANT: ASSIGN special_role HERE
|
||||
/datum/dynamic_ruleset/proc/pre_execute()
|
||||
return TRUE
|
||||
|
||||
/// Called on post_setup on roundstart and when the rule executes on midround and latejoin.
|
||||
/// Give your candidates or assignees equipment and antag datum here.
|
||||
/datum/dynamic_ruleset/proc/execute()
|
||||
for(var/datum/mind/M in assigned)
|
||||
M.add_antag_datum(antag_datum)
|
||||
GLOB.pre_setup_antags -= M
|
||||
return TRUE
|
||||
|
||||
/// Rulesets can be reused, so when we're done setting one up we want to wipe its memory of the people it was selecting over
|
||||
/// This isn't Destroy we aren't deleting it here, rulesets free when nothing holds a ref. This is just to prevent hung refs.
|
||||
/datum/dynamic_ruleset/proc/forget_startup()
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
candidates = list()
|
||||
assigned = list()
|
||||
antag_datum = null
|
||||
|
||||
/// Here you can perform any additional checks you want. (such as checking the map etc)
|
||||
/// Remember that on roundstart no one knows what their job is at this point.
|
||||
/// IMPORTANT: If ready() returns TRUE, that means pre_execute() or execute() should never fail!
|
||||
/datum/dynamic_ruleset/proc/ready(forced = 0)
|
||||
return check_candidates()
|
||||
|
||||
/// This should always be called before ready is, to ensure that the ruleset can locate map/template based landmarks as needed
|
||||
/datum/dynamic_ruleset/proc/load_templates()
|
||||
for(var/template in ruleset_lazy_templates)
|
||||
SSmapping.lazy_load_template(template)
|
||||
|
||||
/// Runs from gamemode process() if ruleset fails to start, like delayed rulesets not getting valid candidates.
|
||||
/// This one only handles refunding the threat, override in ruleset to clean up the rest.
|
||||
/datum/dynamic_ruleset/proc/clean_up()
|
||||
SSdynamic.refund_threat(cost + (scaled_times * scaling_cost))
|
||||
SSdynamic.threat_log += "[gameTimestamp()]: [ruletype] [name] refunded [cost + (scaled_times * scaling_cost)]. Failed to execute."
|
||||
|
||||
/// Gets weight of the ruleset
|
||||
/// Note that this decreases weight if repeatable is TRUE and repeatable_weight_decrease is higher than 0
|
||||
/// Note: If you don't want repeatable rulesets to decrease their weight use the weight variable directly
|
||||
/datum/dynamic_ruleset/proc/get_weight()
|
||||
if(repeatable && weight > 1 && repeatable_weight_decrease > 0)
|
||||
for(var/datum/dynamic_ruleset/DR in SSdynamic.executed_rules)
|
||||
if(istype(DR, type))
|
||||
weight = max(weight-repeatable_weight_decrease,1)
|
||||
return weight
|
||||
|
||||
/// Checks if there are enough candidates to run, and logs otherwise
|
||||
/datum/dynamic_ruleset/proc/check_candidates()
|
||||
if (required_candidates <= candidates.len)
|
||||
return TRUE
|
||||
|
||||
log_dynamic("FAIL: [src] does not have enough candidates ([required_candidates] needed, [candidates.len] found)")
|
||||
return FALSE
|
||||
|
||||
/// Here you can remove candidates that do not meet your requirements.
|
||||
/// This means if their job is not correct or they have disconnected you can remove them from candidates here.
|
||||
/// Usually this does not need to be changed unless you need some specific requirements from your candidates.
|
||||
/datum/dynamic_ruleset/proc/trim_candidates()
|
||||
return
|
||||
|
||||
/// Set mode_result and news report here.
|
||||
/// Only called if ruleset is flagged as HIGH_IMPACT_RULESET
|
||||
/datum/dynamic_ruleset/proc/round_result()
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// ROUNDSTART RULESETS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/// Checks if candidates are connected and if they are banned or don't want to be the antagonist.
|
||||
/datum/dynamic_ruleset/roundstart/trim_candidates()
|
||||
for(var/mob/dead/new_player/candidate_player in candidates)
|
||||
var/client/candidate_client = GET_CLIENT(candidate_player)
|
||||
if (!candidate_client || !candidate_player.mind) // Are they connected?
|
||||
candidates.Remove(candidate_player)
|
||||
continue
|
||||
|
||||
//SKYRAT EDIT ADDITION
|
||||
if(!candidate_client.prefs?.read_preference(/datum/preference/toggle/be_antag))
|
||||
candidates.Remove(candidate_player)
|
||||
continue
|
||||
|
||||
if(is_banned_from(candidate_client.ckey, BAN_ANTAGONIST))
|
||||
candidates.Remove(candidate_player)
|
||||
continue
|
||||
//SKYRAT EDIT END
|
||||
|
||||
if(candidate_client.get_remaining_days(minimum_required_age) > 0)
|
||||
candidates.Remove(candidate_player)
|
||||
continue
|
||||
|
||||
if(candidate_player.mind.special_role) // We really don't want to give antag to an antag.
|
||||
candidates.Remove(candidate_player)
|
||||
continue
|
||||
|
||||
if (!((antag_preference || antag_flag) in candidate_client.prefs.be_special))
|
||||
candidates.Remove(candidate_player)
|
||||
continue
|
||||
|
||||
if (is_banned_from(candidate_player.ckey, list(antag_flag_override || antag_flag, ROLE_SYNDICATE)))
|
||||
candidates.Remove(candidate_player)
|
||||
continue
|
||||
|
||||
// If this ruleset has exclusive_roles set, we want to only consider players who have those
|
||||
// job prefs enabled and are eligible to play that job. Otherwise, continue as before.
|
||||
if(length(exclusive_roles))
|
||||
var/exclusive_candidate = FALSE
|
||||
for(var/role in exclusive_roles)
|
||||
var/datum/job/job = SSjob.get_job(role)
|
||||
|
||||
if((role in candidate_client.prefs.job_preferences) && SSjob.check_job_eligibility(candidate_player, job, "Dynamic Roundstart TC", add_job_to_log = TRUE) == JOB_AVAILABLE)
|
||||
exclusive_candidate = TRUE
|
||||
break
|
||||
|
||||
// If they didn't have any of the required job prefs enabled or were banned from all enabled prefs,
|
||||
// they're not eligible for this antag type.
|
||||
if(!exclusive_candidate)
|
||||
candidates.Remove(candidate_player)
|
||||
|
||||
/// Do your checks if the ruleset is ready to be executed here.
|
||||
/// Should ignore certain checks if forced is TRUE
|
||||
/datum/dynamic_ruleset/roundstart/ready(population, forced = FALSE)
|
||||
return ..()
|
||||
@@ -1,263 +0,0 @@
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// LATEJOIN RULESETS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/trim_candidates()
|
||||
for(var/mob/P in candidates)
|
||||
if(!P.client || !P.mind || is_unassigned_job(P.mind.assigned_role)) // Are they connected?
|
||||
candidates.Remove(P)
|
||||
else if (P.client.get_remaining_days(minimum_required_age) > 0)
|
||||
candidates.Remove(P)
|
||||
else if(P.mind.assigned_role.title in restricted_roles) // Does their job allow for it?
|
||||
candidates.Remove(P)
|
||||
else if((exclusive_roles.len > 0) && !(P.mind.assigned_role.title in exclusive_roles)) // Is the rule exclusive to their job?
|
||||
candidates.Remove(P)
|
||||
else if (!((antag_preference || antag_flag) in P.client.prefs.be_special) || is_banned_from(P.ckey, list(antag_flag_override || antag_flag, ROLE_SYNDICATE)))
|
||||
candidates.Remove(P)
|
||||
// SKYRAT EDIT ADDITION - PROTECTED JOBS
|
||||
else if(P.client?.prefs && !P.client.prefs.read_preference(/datum/preference/toggle/be_antag))
|
||||
candidates.Remove(P)
|
||||
continue
|
||||
else if(is_banned_from(P.client?.ckey, BAN_ANTAGONIST))
|
||||
candidates.Remove(P)
|
||||
continue
|
||||
// SKYRAT EDIT END
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/ready(forced = 0)
|
||||
if (forced)
|
||||
return ..()
|
||||
|
||||
var/job_check = 0
|
||||
if (enemy_roles.len > 0)
|
||||
for (var/mob/M in GLOB.alive_player_list)
|
||||
if (M.stat == DEAD)
|
||||
continue // Dead players cannot count as opponents
|
||||
if (M.mind && (M.mind.assigned_role.title in enemy_roles) && (!(M in candidates) || (M.mind.assigned_role.title in restricted_roles)))
|
||||
job_check++ // Checking for "enemies" (such as sec officers). To be counters, they must either not be candidates to that rule, or have a job that restricts them from it
|
||||
|
||||
var/threat = round(SSdynamic.threat_level/10)
|
||||
var/ruleset_forced = (GLOB.dynamic_forced_rulesets[type] || RULESET_NOT_FORCED) == RULESET_FORCE_ENABLED
|
||||
if (!ruleset_forced && job_check < required_enemies[threat])
|
||||
log_dynamic("FAIL: [src] is not ready, because there are not enough enemies: [required_enemies[threat]] needed, [job_check] found")
|
||||
return FALSE
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/execute()
|
||||
var/mob/M = pick(candidates)
|
||||
assigned += M.mind
|
||||
M.mind.special_role = antag_flag
|
||||
M.mind.add_antag_datum(antag_datum)
|
||||
return TRUE
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// SYNDICATE TRAITORS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/infiltrator
|
||||
name = "Syndicate Infiltrator"
|
||||
antag_datum = /datum/antagonist/traitor
|
||||
antag_flag = ROLE_SYNDICATE_INFILTRATOR
|
||||
antag_flag_override = ROLE_TRAITOR
|
||||
protected_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
required_candidates = 1
|
||||
weight = 11
|
||||
cost = 5
|
||||
requirements = list(5,5,5,5,5,5,5,5,5,5)
|
||||
repeatable = TRUE
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// REVOLUTIONARY PROVOCATEUR //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/provocateur
|
||||
name = "Provocateur"
|
||||
persistent = TRUE
|
||||
antag_datum = /datum/antagonist/rev/head
|
||||
antag_flag = ROLE_PROVOCATEUR
|
||||
antag_flag_override = ROLE_REV_HEAD
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CAPTAIN,
|
||||
JOB_CHIEF_ENGINEER,
|
||||
JOB_CHIEF_MEDICAL_OFFICER,
|
||||
JOB_CYBORG,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_QUARTERMASTER,
|
||||
JOB_RESEARCH_DIRECTOR,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
enemy_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
required_enemies = list(2,2,1,1,1,1,1,0,0,0)
|
||||
required_candidates = 1
|
||||
weight = 1
|
||||
delay = 1 MINUTES // Prevents rule start while head is offstation.
|
||||
cost = 10
|
||||
requirements = list(101,101,70,40,30,20,20,20,20,20)
|
||||
flags = HIGH_IMPACT_RULESET
|
||||
blocking_rules = list(/datum/dynamic_ruleset/roundstart/revs)
|
||||
var/required_heads_of_staff = 3
|
||||
var/finished = FALSE
|
||||
var/datum/team/revolution/revolution
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/provocateur/ready(forced=FALSE)
|
||||
if (forced)
|
||||
required_heads_of_staff = 1
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/head_check = 0
|
||||
for(var/mob/player in GLOB.alive_player_list)
|
||||
if (player.mind.assigned_role.job_flags & JOB_HEAD_OF_STAFF)
|
||||
head_check++
|
||||
return (head_check >= required_heads_of_staff)
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/provocateur/execute()
|
||||
var/mob/M = pick(candidates) // This should contain a single player, but in case.
|
||||
if(check_eligible(M.mind)) // Didnt die/run off z-level/get implanted since leaving shuttle.
|
||||
assigned += M.mind
|
||||
M.mind.special_role = antag_flag
|
||||
revolution = new()
|
||||
var/datum/antagonist/rev/head/new_head = new()
|
||||
new_head.give_flash = TRUE
|
||||
new_head.give_hud = TRUE
|
||||
new_head.remove_clumsy = TRUE
|
||||
new_head = M.mind.add_antag_datum(new_head, revolution)
|
||||
revolution.update_objectives()
|
||||
revolution.update_rev_heads()
|
||||
SSshuttle.registerHostileEnvironment(revolution)
|
||||
return TRUE
|
||||
else
|
||||
log_dynamic("[ruletype] [name] discarded [M.name] from head revolutionary due to ineligibility.")
|
||||
log_dynamic("[ruletype] [name] failed to get any eligible headrevs. Refunding [cost] threat.")
|
||||
return FALSE
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/provocateur/rule_process()
|
||||
var/winner = revolution.process_victory()
|
||||
if (isnull(winner))
|
||||
return
|
||||
|
||||
finished = winner
|
||||
|
||||
if(winner == REVOLUTION_VICTORY)
|
||||
GLOB.revolutionary_win = TRUE
|
||||
|
||||
return RULESET_STOP_PROCESSING
|
||||
|
||||
/// Checks for revhead loss conditions and other antag datums.
|
||||
/datum/dynamic_ruleset/latejoin/provocateur/proc/check_eligible(datum/mind/M)
|
||||
var/turf/T = get_turf(M.current)
|
||||
if(!considered_afk(M) && considered_alive(M) && is_station_level(T.z) && !M.antag_datums?.len && !HAS_MIND_TRAIT(M.current, TRAIT_UNCONVERTABLE))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/provocateur/round_result()
|
||||
revolution.round_result(finished)
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// HERETIC SMUGGLER //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/heretic_smuggler
|
||||
name = "Heretic Smuggler"
|
||||
antag_datum = /datum/antagonist/heretic
|
||||
antag_flag = ROLE_HERETIC_SMUGGLER
|
||||
antag_flag_override = ROLE_HERETIC
|
||||
protected_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
JOB_CHAPLAIN, // BUBBER EDIT - Chaplains can't heretic
|
||||
)
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
required_candidates = 1
|
||||
weight = 4
|
||||
cost = 12
|
||||
requirements = list(101,101,50,10,10,10,10,10,10,10)
|
||||
repeatable = TRUE
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/heretic_smuggler/execute()
|
||||
var/mob/picked_mob = pick(candidates)
|
||||
assigned += picked_mob.mind
|
||||
picked_mob.mind.special_role = antag_flag
|
||||
var/datum/antagonist/heretic/new_heretic = picked_mob.mind.add_antag_datum(antag_datum)
|
||||
|
||||
// Heretics passively gain influence over time.
|
||||
// As a consequence, latejoin heretics start out at a massive
|
||||
// disadvantage if the round's been going on for a while.
|
||||
// Let's give them some influence points when they arrive.
|
||||
new_heretic.knowledge_points += round((world.time - SSticker.round_start_time) / new_heretic.passive_gain_timer)
|
||||
// BUT let's not give smugglers a million points on arrival.
|
||||
// Limit it to four missed passive gain cycles (4 points).
|
||||
new_heretic.knowledge_points = min(new_heretic.knowledge_points, 5)
|
||||
|
||||
return TRUE
|
||||
|
||||
/// Ruleset for latejoin changelings
|
||||
/datum/dynamic_ruleset/latejoin/stowaway_changeling
|
||||
name = "Stowaway Changeling"
|
||||
antag_datum = /datum/antagonist/changeling
|
||||
antag_flag = ROLE_STOWAWAY_CHANGELING
|
||||
antag_flag_override = ROLE_CHANGELING
|
||||
protected_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
required_candidates = 1
|
||||
weight = 2
|
||||
cost = 12
|
||||
requirements = list(101,101,60,50,40,20,20,10,10,10)
|
||||
repeatable = TRUE
|
||||
|
||||
/datum/dynamic_ruleset/latejoin/stowaway_changeling/execute()
|
||||
var/mob/picked_mob = pick(candidates)
|
||||
assigned += picked_mob.mind
|
||||
picked_mob.mind.special_role = antag_flag
|
||||
picked_mob.mind.add_antag_datum(antag_datum)
|
||||
return TRUE
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,747 +0,0 @@
|
||||
GLOBAL_VAR_INIT(revolutionary_win, FALSE)
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// SYNDICATE TRAITORS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/traitor
|
||||
name = "Traitors"
|
||||
antag_flag = ROLE_TRAITOR
|
||||
antag_datum = /datum/antagonist/traitor
|
||||
minimum_required_age = 0
|
||||
protected_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
required_candidates = 1
|
||||
weight = 5
|
||||
cost = 8 // Avoid raising traitor threat above this, as it is the default low cost ruleset.
|
||||
scaling_cost = 9
|
||||
requirements = list(8,8,8,8,8,8,8,8,8,8)
|
||||
antag_cap = list("denominator" = 38)
|
||||
var/autotraitor_cooldown = (15 MINUTES)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/traitor/pre_execute(population)
|
||||
. = ..()
|
||||
for (var/i in 1 to get_antag_cap_scaling_included(population))
|
||||
if(candidates.len <= 0)
|
||||
break
|
||||
var/mob/M = pick_n_take(candidates)
|
||||
assigned += M.mind
|
||||
M.mind.special_role = ROLE_TRAITOR
|
||||
M.mind.restricted_roles = restricted_roles
|
||||
GLOB.pre_setup_antags += M.mind
|
||||
return TRUE
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// MALFUNCTIONING AI //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai
|
||||
name = "Malfunctioning AI"
|
||||
antag_flag = ROLE_MALF
|
||||
antag_datum = /datum/antagonist/malf_ai
|
||||
minimum_required_age = 14
|
||||
exclusive_roles = list(JOB_AI)
|
||||
required_candidates = 1
|
||||
weight = 3
|
||||
cost = 18
|
||||
requirements = list(101,101,101,80,60,50,30,20,10,10)
|
||||
antag_cap = 1
|
||||
flags = HIGH_IMPACT_RULESET
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai/ready(forced)
|
||||
var/datum/job/ai_job = SSjob.get_job_type(/datum/job/ai)
|
||||
|
||||
// If we're not forced, we're going to make sure we can actually have an AI in this shift,
|
||||
if(!forced && min(ai_job.total_positions - ai_job.current_positions, ai_job.spawn_positions) <= 0)
|
||||
log_dynamic("FAIL: [src] could not run, because there is nobody who wants to be an AI")
|
||||
return FALSE
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/malf_ai/pre_execute(population)
|
||||
. = ..()
|
||||
|
||||
var/datum/job/ai_job = SSjob.get_job_type(/datum/job/ai)
|
||||
// Maybe a bit too pedantic, but there should never be more malf AIs than there are available positions, spawn positions or antag cap allocations.
|
||||
var/num_malf = min(get_antag_cap(population), min(ai_job.total_positions - ai_job.current_positions, ai_job.spawn_positions))
|
||||
for (var/i in 1 to num_malf)
|
||||
if(candidates.len <= 0)
|
||||
break
|
||||
var/mob/new_malf = pick_n_take(candidates)
|
||||
assigned += new_malf.mind
|
||||
new_malf.mind.special_role = ROLE_MALF
|
||||
GLOB.pre_setup_antags += new_malf.mind
|
||||
// We need an AI for the malf roundstart ruleset to execute. This means that players who get selected as malf AI get priority, because antag selection comes before role selection.
|
||||
LAZYADDASSOC(SSjob.dynamic_forced_occupations, new_malf, "AI")
|
||||
return TRUE
|
||||
|
||||
//////////////////////////////////////////
|
||||
// //
|
||||
// BLOOD BROTHERS //
|
||||
// //
|
||||
//////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/traitorbro
|
||||
name = "Blood Brothers"
|
||||
antag_flag = ROLE_BROTHER
|
||||
antag_datum = /datum/antagonist/brother
|
||||
protected_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
weight = 5
|
||||
cost = 8
|
||||
scaling_cost = 15
|
||||
requirements = list(40,30,30,20,20,15,15,15,10,10)
|
||||
antag_cap = 1
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/traitorbro/pre_execute(population)
|
||||
. = ..()
|
||||
|
||||
for (var/i in 1 to get_antag_cap_scaling_included(population))
|
||||
var/mob/candidate = pick_n_take(candidates)
|
||||
if (isnull(candidate))
|
||||
break
|
||||
|
||||
assigned += candidate.mind
|
||||
candidate.mind.restricted_roles = restricted_roles
|
||||
candidate.mind.special_role = ROLE_BROTHER
|
||||
GLOB.pre_setup_antags += candidate.mind
|
||||
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/traitorbro/execute()
|
||||
for (var/datum/mind/mind in assigned)
|
||||
new /datum/team/brother_team(mind)
|
||||
GLOB.pre_setup_antags -= mind
|
||||
|
||||
return TRUE
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// CHANGELINGS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/changeling
|
||||
name = "Changelings"
|
||||
antag_flag = ROLE_CHANGELING
|
||||
antag_datum = /datum/antagonist/changeling
|
||||
protected_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
required_candidates = 1
|
||||
weight = 3
|
||||
cost = 16
|
||||
scaling_cost = 10
|
||||
requirements = list(70,70,60,50,40,20,20,10,10,10)
|
||||
antag_cap = list("denominator" = 29)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/changeling/pre_execute(population)
|
||||
. = ..()
|
||||
for (var/i in 1 to get_antag_cap_scaling_included(population))
|
||||
if(candidates.len <= 0)
|
||||
break
|
||||
var/mob/M = pick_n_take(candidates)
|
||||
assigned += M.mind
|
||||
M.mind.restricted_roles = restricted_roles
|
||||
M.mind.special_role = ROLE_CHANGELING
|
||||
GLOB.pre_setup_antags += M.mind
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/changeling/execute()
|
||||
for(var/datum/mind/changeling in assigned)
|
||||
var/datum/antagonist/changeling/new_antag = new antag_datum()
|
||||
changeling.add_antag_datum(new_antag)
|
||||
GLOB.pre_setup_antags -= changeling
|
||||
return TRUE
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// HERETICS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/heretics
|
||||
name = "Heretics"
|
||||
antag_flag = ROLE_HERETIC
|
||||
antag_datum = /datum/antagonist/heretic
|
||||
protected_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
JOB_CHAPLAIN, // BUBBER EDIT - Chaplains can't heretic
|
||||
)
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
required_candidates = 1
|
||||
weight = 3
|
||||
cost = 16
|
||||
scaling_cost = 9
|
||||
requirements = list(101,101,60,30,30,25,20,15,10,10)
|
||||
antag_cap = list("denominator" = 24)
|
||||
ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_HERETIC_SACRIFICE)
|
||||
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/heretics/pre_execute(population)
|
||||
. = ..()
|
||||
var/num_ecult = get_antag_cap(population) * (scaled_times + 1)
|
||||
|
||||
for (var/i = 1 to num_ecult)
|
||||
if(candidates.len <= 0)
|
||||
break
|
||||
var/mob/picked_candidate = pick_n_take(candidates)
|
||||
assigned += picked_candidate.mind
|
||||
picked_candidate.mind.restricted_roles = restricted_roles
|
||||
picked_candidate.mind.special_role = ROLE_HERETIC
|
||||
GLOB.pre_setup_antags += picked_candidate.mind
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/heretics/execute()
|
||||
|
||||
for(var/c in assigned)
|
||||
var/datum/mind/cultie = c
|
||||
var/datum/antagonist/heretic/new_antag = new antag_datum()
|
||||
cultie.add_antag_datum(new_antag)
|
||||
GLOB.pre_setup_antags -= cultie
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// WIZARDS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
// Dynamic is a wonderful thing that adds wizards to every round and then adds even more wizards during the round.
|
||||
/datum/dynamic_ruleset/roundstart/wizard
|
||||
name = "Wizard"
|
||||
antag_flag = ROLE_WIZARD
|
||||
antag_datum = /datum/antagonist/wizard
|
||||
ruleset_category = parent_type::ruleset_category | RULESET_CATEGORY_NO_WITTING_CREW_ANTAGONISTS
|
||||
flags = HIGH_IMPACT_RULESET
|
||||
minimum_required_age = 14
|
||||
restricted_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
) // Just to be sure that a wizard getting picked won't ever imply a Captain or HoS not getting drafted
|
||||
required_candidates = 1
|
||||
weight = 2
|
||||
cost = 20
|
||||
requirements = list(90,90,90,80,60,40,30,20,10,10)
|
||||
ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_WIZARDDEN)
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/wizard/ready(forced = FALSE)
|
||||
if(!check_candidates())
|
||||
return FALSE
|
||||
if(!length(GLOB.wizardstart))
|
||||
log_admin("Cannot accept Wizard ruleset. Couldn't find any wizard spawn points.")
|
||||
message_admins("Cannot accept Wizard ruleset. Couldn't find any wizard spawn points.")
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/wizard/round_result()
|
||||
for(var/datum/antagonist/wizard/wiz in GLOB.antagonists)
|
||||
var/mob/living/real_wiz = wiz.owner?.current
|
||||
if(isnull(real_wiz))
|
||||
continue
|
||||
|
||||
var/turf/wiz_location = get_turf(real_wiz)
|
||||
// If this wiz is alive AND not in an away level, then we know not all wizards are dead and can leave entirely
|
||||
if(considered_alive(wiz.owner) && wiz_location && !is_away_level(wiz_location.z))
|
||||
return
|
||||
|
||||
SSticker.news_report = WIZARD_KILLED
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/wizard/pre_execute()
|
||||
. = ..()
|
||||
if(GLOB.wizardstart.len == 0)
|
||||
return FALSE
|
||||
var/mob/M = pick_n_take(candidates)
|
||||
if (M)
|
||||
assigned += M.mind
|
||||
M.mind.set_assigned_role(SSjob.get_job_type(/datum/job/space_wizard))
|
||||
M.mind.special_role = ROLE_WIZARD
|
||||
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/wizard/execute()
|
||||
for(var/datum/mind/M in assigned)
|
||||
M.current.forceMove(pick(GLOB.wizardstart))
|
||||
M.add_antag_datum(new antag_datum())
|
||||
return TRUE
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// BLOOD CULT //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/bloodcult
|
||||
name = "Blood Cult"
|
||||
antag_flag = ROLE_CULTIST
|
||||
antag_datum = /datum/antagonist/cult
|
||||
minimum_required_age = 14
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CAPTAIN,
|
||||
JOB_CHAPLAIN,
|
||||
JOB_CYBORG,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
required_candidates = 2
|
||||
weight = 3
|
||||
cost = 20
|
||||
requirements = list(100,90,80,60,40,30,10,10,10,10)
|
||||
flags = HIGH_IMPACT_RULESET
|
||||
antag_cap = list("denominator" = 20, "offset" = 1)
|
||||
var/datum/team/cult/main_cult
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/bloodcult/ready(population, forced = FALSE)
|
||||
required_candidates = get_antag_cap(population)
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/bloodcult/pre_execute(population)
|
||||
. = ..()
|
||||
var/cultists = get_antag_cap(population)
|
||||
for(var/cultists_number = 1 to cultists)
|
||||
if(candidates.len <= 0)
|
||||
break
|
||||
var/mob/M = pick_n_take(candidates)
|
||||
assigned += M.mind
|
||||
M.mind.special_role = ROLE_CULTIST
|
||||
M.mind.restricted_roles = restricted_roles
|
||||
GLOB.pre_setup_antags += M.mind
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/bloodcult/execute()
|
||||
main_cult = new
|
||||
for(var/datum/mind/M in assigned)
|
||||
var/datum/antagonist/cult/new_cultist = new antag_datum()
|
||||
new_cultist.cult_team = main_cult
|
||||
new_cultist.give_equipment = TRUE
|
||||
M.add_antag_datum(new_cultist)
|
||||
GLOB.pre_setup_antags -= M
|
||||
main_cult.setup_objectives()
|
||||
var/datum/mind/most_experienced = get_most_experienced(assigned, antag_flag)
|
||||
if(!most_experienced)
|
||||
most_experienced = assigned[1]
|
||||
var/datum/antagonist/cult/leader = most_experienced.has_antag_datum(/datum/antagonist/cult)
|
||||
leader.make_cult_leader()
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/bloodcult/round_result()
|
||||
if(main_cult.check_cult_victory())
|
||||
SSticker.mode_result = "win - cult win"
|
||||
SSticker.news_report = CULT_SUMMON
|
||||
return
|
||||
|
||||
SSticker.mode_result = "loss - staff stopped the cult"
|
||||
|
||||
if(main_cult.size_at_maximum == 0)
|
||||
CRASH("Cult team existed with a size_at_maximum of 0 at round end!")
|
||||
|
||||
// If more than a certain ratio of our cultists have escaped, give the "cult escape" resport.
|
||||
// Otherwise, give the "cult failure" report.
|
||||
var/ratio_to_be_considered_escaped = 0.5
|
||||
var/escaped_cultists = 0
|
||||
for(var/datum/mind/escapee as anything in main_cult.members)
|
||||
if(considered_escaped(escapee))
|
||||
escaped_cultists++
|
||||
|
||||
SSticker.news_report = (escaped_cultists / main_cult.size_at_maximum) >= ratio_to_be_considered_escaped ? CULT_ESCAPE : CULT_FAILURE
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// NUCLEAR OPERATIVES //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nuclear
|
||||
name = "Nuclear Emergency"
|
||||
antag_flag = ROLE_OPERATIVE
|
||||
ruleset_category = parent_type::ruleset_category | RULESET_CATEGORY_NO_WITTING_CREW_ANTAGONISTS
|
||||
antag_datum = /datum/antagonist/nukeop
|
||||
var/datum/antagonist/antag_leader_datum = /datum/antagonist/nukeop/leader
|
||||
minimum_required_age = 14
|
||||
restricted_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
) // Just to be sure that a nukie getting picked won't ever imply a Captain or HoS not getting drafted
|
||||
required_candidates = 5
|
||||
weight = 3
|
||||
cost = 20
|
||||
requirements = list(90,90,90,80,60,40,30,20,10,10)
|
||||
flags = HIGH_IMPACT_RULESET
|
||||
antag_cap = list("denominator" = 18, "offset" = 1)
|
||||
ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_NUKIEBASE)
|
||||
var/required_role = ROLE_NUCLEAR_OPERATIVE
|
||||
var/datum/team/nuclear/nuke_team
|
||||
///The job type to dress up our nuclear operative as.
|
||||
var/datum/job/job_type = /datum/job/nuclear_operative
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nuclear/ready(population, forced = FALSE)
|
||||
required_candidates = get_antag_cap(population)
|
||||
return ..()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nuclear/pre_execute(population)
|
||||
. = ..()
|
||||
// If ready() did its job, candidates should have 5 or more members in it
|
||||
var/operatives = get_antag_cap(population)
|
||||
for(var/operatives_number = 1 to operatives)
|
||||
if(candidates.len <= 0)
|
||||
break
|
||||
var/mob/M = pick_n_take(candidates)
|
||||
assigned += M.mind
|
||||
M.mind.set_assigned_role(SSjob.get_job_type(job_type))
|
||||
M.mind.special_role = required_role
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nuclear/execute()
|
||||
var/datum/mind/most_experienced = get_most_experienced(assigned, required_role)
|
||||
if(!most_experienced)
|
||||
most_experienced = assigned[1]
|
||||
var/datum/antagonist/nukeop/leader/leader = most_experienced.add_antag_datum(antag_leader_datum)
|
||||
nuke_team = leader.nuke_team
|
||||
for(var/datum/mind/assigned_player in assigned)
|
||||
if(assigned_player == most_experienced)
|
||||
continue
|
||||
var/datum/antagonist/nukeop/new_op = new antag_datum()
|
||||
assigned_player.add_antag_datum(new_op)
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nuclear/round_result()
|
||||
var/result = nuke_team.get_result()
|
||||
switch(result)
|
||||
if(NUKE_RESULT_FLUKE)
|
||||
SSticker.mode_result = "loss - syndicate nuked - disk secured"
|
||||
SSticker.news_report = NUKE_SYNDICATE_BASE
|
||||
if(NUKE_RESULT_NUKE_WIN)
|
||||
SSticker.mode_result = "win - syndicate nuke"
|
||||
SSticker.news_report = STATION_DESTROYED_NUKE
|
||||
if(NUKE_RESULT_NOSURVIVORS)
|
||||
SSticker.mode_result = "halfwin - syndicate nuke - did not evacuate in time"
|
||||
SSticker.news_report = STATION_DESTROYED_NUKE
|
||||
if(NUKE_RESULT_WRONG_STATION)
|
||||
SSticker.mode_result = "halfwin - blew wrong station"
|
||||
SSticker.news_report = NUKE_MISS
|
||||
if(NUKE_RESULT_WRONG_STATION_DEAD)
|
||||
SSticker.mode_result = "halfwin - blew wrong station - did not evacuate in time"
|
||||
SSticker.news_report = NUKE_MISS
|
||||
if(NUKE_RESULT_CREW_WIN_SYNDIES_DEAD)
|
||||
SSticker.mode_result = "loss - evacuation - disk secured - syndi team dead"
|
||||
SSticker.news_report = OPERATIVES_KILLED
|
||||
if(NUKE_RESULT_CREW_WIN)
|
||||
SSticker.mode_result = "loss - evacuation - disk secured"
|
||||
SSticker.news_report = OPERATIVES_KILLED
|
||||
if(NUKE_RESULT_DISK_LOST)
|
||||
SSticker.mode_result = "halfwin - evacuation - disk not secured"
|
||||
SSticker.news_report = OPERATIVE_SKIRMISH
|
||||
if(NUKE_RESULT_DISK_STOLEN)
|
||||
SSticker.mode_result = "halfwin - detonation averted"
|
||||
SSticker.news_report = OPERATIVE_SKIRMISH
|
||||
else
|
||||
SSticker.mode_result = "halfwin - interrupted"
|
||||
SSticker.news_report = OPERATIVE_SKIRMISH
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// REVS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revs
|
||||
name = "Revolution"
|
||||
persistent = TRUE
|
||||
antag_flag = ROLE_REV_HEAD
|
||||
antag_flag_override = ROLE_REV_HEAD
|
||||
antag_datum = /datum/antagonist/rev/head
|
||||
minimum_required_age = 14
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CAPTAIN,
|
||||
JOB_CHIEF_ENGINEER,
|
||||
JOB_CHIEF_MEDICAL_OFFICER,
|
||||
JOB_CYBORG,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_PERSONNEL,
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_QUARTERMASTER,
|
||||
JOB_RESEARCH_DIRECTOR,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
required_candidates = 3
|
||||
weight = 3
|
||||
delay = 7 MINUTES
|
||||
cost = 20
|
||||
requirements = list(101,101,70,40,30,20,10,10,10,10)
|
||||
antag_cap = 3
|
||||
flags = HIGH_IMPACT_RULESET
|
||||
blocking_rules = list(/datum/dynamic_ruleset/latejoin/provocateur)
|
||||
// I give up, just there should be enough heads with 35 players...
|
||||
minimum_players = 35
|
||||
var/datum/team/revolution/revolution
|
||||
var/finished = FALSE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revs/pre_execute(population)
|
||||
. = ..()
|
||||
var/max_candidates = get_antag_cap(population)
|
||||
for(var/i = 1 to max_candidates)
|
||||
if(candidates.len <= 0)
|
||||
break
|
||||
var/mob/M = pick_n_take(candidates)
|
||||
assigned += M.mind
|
||||
M.mind.restricted_roles = restricted_roles
|
||||
M.mind.special_role = antag_flag
|
||||
GLOB.pre_setup_antags += M.mind
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revs/execute()
|
||||
revolution = new()
|
||||
for(var/datum/mind/M in assigned)
|
||||
GLOB.pre_setup_antags -= M
|
||||
if(check_eligible(M))
|
||||
var/datum/antagonist/rev/head/new_head = new antag_datum()
|
||||
new_head.give_flash = TRUE
|
||||
new_head.give_hud = TRUE
|
||||
new_head.remove_clumsy = TRUE
|
||||
M.add_antag_datum(new_head,revolution)
|
||||
else
|
||||
assigned -= M
|
||||
log_dynamic("[ruletype] [name] discarded [M.name] from head revolutionary due to ineligibility.")
|
||||
if(revolution.members.len)
|
||||
revolution.update_objectives()
|
||||
revolution.update_rev_heads()
|
||||
SSshuttle.registerHostileEnvironment(revolution)
|
||||
return TRUE
|
||||
log_dynamic("[ruletype] [name] failed to get any eligible headrevs. Refunding [cost] threat.")
|
||||
return FALSE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revs/clean_up()
|
||||
qdel(revolution)
|
||||
..()
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revs/rule_process()
|
||||
var/winner = revolution.process_victory()
|
||||
if (isnull(winner))
|
||||
return
|
||||
|
||||
finished = winner
|
||||
|
||||
if(winner == REVOLUTION_VICTORY)
|
||||
GLOB.revolutionary_win = TRUE
|
||||
|
||||
return RULESET_STOP_PROCESSING
|
||||
|
||||
/// Checks for revhead loss conditions and other antag datums.
|
||||
/datum/dynamic_ruleset/roundstart/revs/proc/check_eligible(datum/mind/M)
|
||||
var/turf/T = get_turf(M.current)
|
||||
if(!considered_afk(M) && considered_alive(M) && is_station_level(T.z) && !M.antag_datums?.len && !HAS_MIND_TRAIT(M.current, TRAIT_UNCONVERTABLE))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/revs/round_result()
|
||||
revolution.round_result(finished)
|
||||
|
||||
// Admin only rulesets. The threat requirement is 101 so it is not possible to roll them.
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// EXTENDED //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/extended
|
||||
name = "Extended"
|
||||
antag_flag = null
|
||||
antag_datum = null
|
||||
restricted_roles = list()
|
||||
required_candidates = 0
|
||||
weight = 3
|
||||
cost = 0
|
||||
requirements = list(101,101,101,101,101,101,101,101,101,101)
|
||||
flags = LONE_RULESET
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/extended/pre_execute()
|
||||
. = ..()
|
||||
message_admins("Starting a round of extended.")
|
||||
log_game("Starting a round of extended.")
|
||||
SSdynamic.spend_roundstart_budget(SSdynamic.round_start_budget)
|
||||
SSdynamic.spend_midround_budget(SSdynamic.mid_round_budget)
|
||||
SSdynamic.threat_log += "[gameTimestamp()]: Extended ruleset set threat to 0."
|
||||
return TRUE
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// CLOWN OPS //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nuclear/clown_ops
|
||||
name = "Clown Operatives"
|
||||
antag_datum = /datum/antagonist/nukeop/clownop
|
||||
antag_flag = ROLE_CLOWN_OPERATIVE
|
||||
antag_flag_override = ROLE_OPERATIVE
|
||||
ruleset_category = parent_type::ruleset_category | RULESET_CATEGORY_NO_WITTING_CREW_ANTAGONISTS
|
||||
antag_leader_datum = /datum/antagonist/nukeop/leader/clownop
|
||||
requirements = list(101,101,101,101,101,101,101,101,101,101)
|
||||
required_role = ROLE_CLOWN_OPERATIVE
|
||||
job_type = /datum/job/clown_operative
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nuclear/clown_ops/pre_execute()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
|
||||
var/list/nukes = SSmachines.get_machines_by_type(/obj/machinery/nuclearbomb/syndicate)
|
||||
for(var/obj/machinery/nuclearbomb/syndicate/nuke as anything in nukes)
|
||||
new /obj/machinery/nuclearbomb/syndicate/bananium(nuke.loc)
|
||||
qdel(nuke)
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// //
|
||||
// METEOR //
|
||||
// //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/meteor
|
||||
name = "Meteor"
|
||||
persistent = TRUE
|
||||
required_candidates = 0
|
||||
weight = 3
|
||||
cost = 0
|
||||
requirements = list(101,101,101,101,101,101,101,101,101,101)
|
||||
flags = LONE_RULESET
|
||||
var/meteordelay = 2000
|
||||
var/nometeors = FALSE
|
||||
var/rampupdelta = 5
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/meteor/rule_process()
|
||||
if(nometeors || meteordelay > world.time - SSticker.round_start_time)
|
||||
return
|
||||
|
||||
var/list/wavetype = GLOB.meteors_normal
|
||||
var/meteorminutes = (world.time - SSticker.round_start_time - meteordelay) / 10 / 60
|
||||
|
||||
if (prob(meteorminutes))
|
||||
wavetype = GLOB.meteors_threatening
|
||||
|
||||
if (prob(meteorminutes/2))
|
||||
wavetype = GLOB.meteors_catastrophic
|
||||
|
||||
var/ramp_up_final = clamp(round(meteorminutes/rampupdelta), 1, 10)
|
||||
|
||||
spawn_meteors(ramp_up_final, wavetype)
|
||||
|
||||
/// Ruleset for Nations
|
||||
/datum/dynamic_ruleset/roundstart/nations
|
||||
name = "Nations"
|
||||
required_candidates = 0
|
||||
weight = 0 //admin only (and for good reason)
|
||||
cost = 0
|
||||
flags = LONE_RULESET | ONLY_RULESET
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/nations/execute()
|
||||
. = ..()
|
||||
//notably assistant is not in this list to prevent the round turning into BARBARISM instantly, and silicon is in this list for UN
|
||||
var/list/department_types = list(
|
||||
/datum/job_department/silicon, //united nations
|
||||
/datum/job_department/cargo,
|
||||
/datum/job_department/engineering,
|
||||
/datum/job_department/medical,
|
||||
/datum/job_department/science,
|
||||
/datum/job_department/security,
|
||||
/datum/job_department/service,
|
||||
)
|
||||
|
||||
for(var/department_type in department_types)
|
||||
create_separatist_nation(department_type, announcement = FALSE, dangerous = FALSE, message_admins = FALSE)
|
||||
|
||||
GLOB.round_default_lawset = /datum/ai_laws/united_nations
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/spies
|
||||
name = "Spies"
|
||||
antag_flag = ROLE_SPY
|
||||
antag_datum = /datum/antagonist/spy
|
||||
minimum_required_age = 0
|
||||
protected_roles = list(
|
||||
JOB_CAPTAIN,
|
||||
JOB_DETECTIVE,
|
||||
JOB_HEAD_OF_PERSONNEL, // AA = bad
|
||||
JOB_HEAD_OF_SECURITY,
|
||||
JOB_PRISONER,
|
||||
JOB_SECURITY_OFFICER,
|
||||
JOB_WARDEN,
|
||||
)
|
||||
restricted_roles = list(
|
||||
JOB_AI,
|
||||
JOB_CYBORG,
|
||||
)
|
||||
required_candidates = 3 // lives or dies by there being a few spies
|
||||
weight = 5
|
||||
cost = 8
|
||||
scaling_cost = 4
|
||||
minimum_players = 10
|
||||
antag_cap = list("denominator" = 20, "offset" = 1)
|
||||
requirements = list(8, 8, 8, 8, 8, 8, 8, 8, 8, 8)
|
||||
/// What fraction is added to the antag cap for each additional scale
|
||||
var/fraction_per_scale = 0.2
|
||||
|
||||
/datum/dynamic_ruleset/roundstart/spies/pre_execute(population)
|
||||
for(var/i in 1 to get_antag_cap_scaling_included(population))
|
||||
if(length(candidates) <= 0)
|
||||
break
|
||||
var/mob/picked_player = pick_n_take(candidates)
|
||||
assigned += picked_player.mind
|
||||
picked_player.mind.special_role = ROLE_SPY
|
||||
picked_player.mind.restricted_roles = restricted_roles
|
||||
GLOB.pre_setup_antags += picked_player.mind
|
||||
return TRUE
|
||||
|
||||
// Scaling adds a fraction of the amount of additional spies rather than the full amount.
|
||||
/datum/dynamic_ruleset/roundstart/spies/get_scaling_antag_cap(population)
|
||||
return ceil(..() * fraction_per_scale)
|
||||
@@ -0,0 +1,111 @@
|
||||
|
||||
/// Verb to open the create command report window and send command reports.
|
||||
ADMIN_VERB(dynamic_tester, R_DEBUG, "Dynamic Tester", "See dynamic probabilities.", ADMIN_CATEGORY_DEBUG)
|
||||
BLACKBOX_LOG_ADMIN_VERB("Dynamic Tester")
|
||||
var/datum/dynamic_tester/tgui = new()
|
||||
tgui.ui_interact(user.mob)
|
||||
|
||||
/datum/dynamic_tester
|
||||
/// Instances of every roundstart ruleset
|
||||
var/list/roundstart_rulesets = list()
|
||||
/// Instances of every midround ruleset
|
||||
var/list/midround_rulesets = list()
|
||||
|
||||
/// A formatted report of the weights of each roundstart ruleset, refreshed occasionally and sent to the UI.
|
||||
var/list/roundstart_ruleset_report = list()
|
||||
/// A formatted report of the weights of each midround ruleset, refreshed occasionally and sent to the UI.
|
||||
var/list/midround_ruleset_report = list()
|
||||
|
||||
/// What is the tier we are testing?
|
||||
var/tier = 1
|
||||
/// How many players are we testing with?
|
||||
var/num_players = 10
|
||||
|
||||
/datum/dynamic_tester/New()
|
||||
for(var/datum/dynamic_ruleset/rtype as anything in subtypesof(/datum/dynamic_ruleset/roundstart))
|
||||
if(!initial(rtype.config_tag))
|
||||
continue
|
||||
var/datum/dynamic_ruleset/roundstart/created = new rtype(SSdynamic.get_config())
|
||||
roundstart_rulesets += created
|
||||
// snowflake so we can see headrev stats
|
||||
if(istype(created, /datum/dynamic_ruleset/roundstart/revolution))
|
||||
var/datum/dynamic_ruleset/roundstart/revolution/revs = created
|
||||
revs.heads_necessary = 0
|
||||
|
||||
for(var/datum/dynamic_ruleset/rtype as anything in subtypesof(/datum/dynamic_ruleset/midround))
|
||||
if(!initial(rtype.config_tag))
|
||||
continue
|
||||
var/datum/dynamic_ruleset/midround/created = new rtype(SSdynamic.get_config())
|
||||
midround_rulesets += created
|
||||
|
||||
update_reports()
|
||||
|
||||
/datum/dynamic_tester/ui_state(mob/user)
|
||||
return ADMIN_STATE(R_DEBUG)
|
||||
|
||||
/datum/dynamic_tester/ui_close()
|
||||
qdel(src)
|
||||
|
||||
/datum/dynamic_tester/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "DynamicTester")
|
||||
ui.open()
|
||||
|
||||
/datum/dynamic_tester/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["tier"] = tier
|
||||
data["num_players"] = num_players
|
||||
data["roundstart_ruleset_report"] = flatten_list(roundstart_ruleset_report)
|
||||
data["midround_ruleset_report"] = flatten_list(midround_ruleset_report)
|
||||
|
||||
return data
|
||||
|
||||
/datum/dynamic_tester/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("set_num_players")
|
||||
var/old_num = num_players
|
||||
num_players = text2num(params["num_players"])
|
||||
if(old_num != num_players)
|
||||
update_reports()
|
||||
return TRUE
|
||||
|
||||
if("set_tier")
|
||||
var/old_tier = tier
|
||||
tier = text2num(params["tier"])
|
||||
if(old_tier != tier)
|
||||
update_reports()
|
||||
return TRUE
|
||||
|
||||
/datum/dynamic_tester/proc/update_reports()
|
||||
roundstart_ruleset_report.Cut()
|
||||
for(var/datum/dynamic_ruleset/roundstart/ruleset as anything in roundstart_rulesets)
|
||||
var/comment = ""
|
||||
if(istype(ruleset, /datum/dynamic_ruleset/roundstart/revolution))
|
||||
var/datum/dynamic_ruleset/roundstart/revolution/revs = ruleset
|
||||
comment = " (Assuming [initial(revs.heads_necessary)] heads of staff)"
|
||||
|
||||
roundstart_ruleset_report[ruleset] = list(
|
||||
"name" = ruleset.name,
|
||||
"weight" = ruleset.get_weight(num_players, tier),
|
||||
"max_candidates" = ruleset.get_antag_cap(num_players, ruleset.max_antag_cap || ruleset.min_antag_cap),
|
||||
"min_candidates" = ruleset.get_antag_cap(num_players, ruleset.min_antag_cap),
|
||||
"comment" = comment,
|
||||
)
|
||||
|
||||
midround_ruleset_report.Cut()
|
||||
for(var/datum/dynamic_ruleset/midround/ruleset as anything in midround_rulesets)
|
||||
midround_ruleset_report[ruleset] = list(
|
||||
"name" = ruleset.name,
|
||||
"weight" = ruleset.get_weight(num_players, tier),
|
||||
"max_candidates" = ruleset.get_antag_cap(num_players, ruleset.max_antag_cap || ruleset.min_antag_cap),
|
||||
"min_candidates" = ruleset.get_antag_cap(num_players, ruleset.min_antag_cap),
|
||||
"comment" = ruleset.midround_type,
|
||||
)
|
||||
|
||||
update_static_data_for_all_viewers()
|
||||
@@ -1,74 +0,0 @@
|
||||
/// An easy interface to make...*waves hands* bad things happen.
|
||||
/// This is used for impactful events like traitors hacking and creating more threat, or a revolutions victory.
|
||||
/// It tries to spawn a heavy midround if possible, otherwise it will trigger a "bad" random event after a short period.
|
||||
/// Calling this function will not use up any threat.
|
||||
/datum/controller/subsystem/dynamic/proc/unfavorable_situation()
|
||||
SHOULD_NOT_SLEEP(TRUE)
|
||||
|
||||
INVOKE_ASYNC(src, PROC_REF(_unfavorable_situation))
|
||||
|
||||
/datum/controller/subsystem/dynamic/proc/_unfavorable_situation()
|
||||
var/static/list/unfavorable_random_events = list()
|
||||
if (!length(unfavorable_random_events))
|
||||
unfavorable_random_events = generate_unfavourable_events()
|
||||
var/list/possible_heavies = generate_unfavourable_heavy_rulesets()
|
||||
if (!length(possible_heavies))
|
||||
var/datum/round_event_control/round_event_control_type = pick(unfavorable_random_events)
|
||||
var/delay = rand(20 SECONDS, 1 MINUTES)
|
||||
|
||||
log_dynamic_and_announce("An unfavorable situation was requested, but no heavy rulesets could be drafted. Spawning [initial(round_event_control_type.name)] in [DisplayTimeText(delay)] instead.")
|
||||
force_event_after(round_event_control_type, "an unfavorable situation", delay)
|
||||
else
|
||||
var/datum/dynamic_ruleset/midround/heavy_ruleset = pick_weight(possible_heavies)
|
||||
log_dynamic_and_announce("An unfavorable situation was requested, spawning [initial(heavy_ruleset.name)]")
|
||||
picking_specific_rule(heavy_ruleset, forced = TRUE, ignore_cost = TRUE)
|
||||
|
||||
/// Return a valid heavy dynamic ruleset, or an empty list if there's no time to run any rulesets
|
||||
/datum/controller/subsystem/dynamic/proc/generate_unfavourable_heavy_rulesets()
|
||||
if (EMERGENCY_PAST_POINT_OF_NO_RETURN)
|
||||
return list()
|
||||
|
||||
var/list/possible_heavies = list()
|
||||
for (var/datum/dynamic_ruleset/midround/ruleset as anything in midround_rules)
|
||||
if (ruleset.midround_ruleset_style != MIDROUND_RULESET_STYLE_HEAVY)
|
||||
continue
|
||||
|
||||
if (ruleset.weight == 0)
|
||||
continue
|
||||
|
||||
if (ruleset.cost > max_threat_level)
|
||||
continue
|
||||
|
||||
if (!ruleset.acceptable(GLOB.alive_player_list.len, threat_level))
|
||||
continue
|
||||
|
||||
if (ruleset.minimum_round_time > world.time - SSticker.round_start_time)
|
||||
continue
|
||||
|
||||
if(istype(ruleset, /datum/dynamic_ruleset/midround/from_ghosts) && !(GLOB.ghost_role_flags & GHOSTROLE_MIDROUND_EVENT))
|
||||
continue
|
||||
|
||||
ruleset.trim_candidates()
|
||||
|
||||
ruleset.load_templates()
|
||||
if (!ruleset.ready())
|
||||
continue
|
||||
|
||||
possible_heavies[ruleset] = ruleset.get_weight()
|
||||
return possible_heavies
|
||||
|
||||
/// Filter the below list by which events can actually run on this map
|
||||
/datum/controller/subsystem/dynamic/proc/generate_unfavourable_events()
|
||||
var/static/list/unfavorable_random_events = list(
|
||||
/datum/round_event_control/earthquake,
|
||||
/datum/round_event_control/immovable_rod,
|
||||
/datum/round_event_control/meteor_wave,
|
||||
/datum/round_event_control/portal_storm_syndicate,
|
||||
)
|
||||
var/list/picked_events = list()
|
||||
for(var/type in unfavorable_random_events)
|
||||
var/datum/round_event_control/event = new type()
|
||||
if(!event.valid_for_map())
|
||||
continue
|
||||
picked_events += type
|
||||
return picked_events
|
||||
@@ -1,202 +0,0 @@
|
||||
# Dynamic Mode
|
||||
|
||||
## Roundstart
|
||||
|
||||
Dynamic rolls threat based on a special sauce formula:
|
||||
|
||||
> [dynamic_curve_width][/datum/controller/global_vars/var/dynamic_curve_width] \* tan((3.1416 \* (rand() - 0.5) \* 57.2957795)) + [dynamic_curve_centre][/datum/controller/global_vars/var/dynamic_curve_centre]
|
||||
|
||||
This threat is split into two separate budgets--`round_start_budget` and `mid_round_budget`. For example, a round with 50 threat might be split into a 30 roundstart budget, and a 20 midround budget. The roundstart budget is used to apply antagonists applied on readied players when the roundstarts (`/datum/dynamic_ruleset/roundstart`). The midround budget is used for two types of rulesets:
|
||||
|
||||
- `/datum/dynamic_ruleset/midround` - Rulesets that apply to either existing alive players, or to ghosts. Think Blob or Space Ninja, which poll ghosts asking if they want to play as these roles.
|
||||
- `/datum/dynamic_ruleset/latejoin` - Rulesets that apply to the next player that joins. Think Syndicate Infiltrator, which converts a player just joining an existing round into traitor.
|
||||
|
||||
This split is done with a similar method, known as the ["lorentz distribution"](https://en.wikipedia.org/wiki/Cauchy_distribution), exists to create a bell curve that ensures that while most rounds will have a threat level around ~50, chaotic and tame rounds still exist for variety.
|
||||
|
||||
The process of creating these numbers occurs in `/datum/controller/subsystem/dynamic/proc/generate_threat` (for creating the threat level) and `/datum/controller/subsystem/dynamic/proc/generate_budgets` (for splitting the threat level into budgets).
|
||||
|
||||
## Deciding roundstart threats
|
||||
|
||||
In `/datum/controller/subsystem/dynamic/proc/roundstart()` (called when no admin chooses the rulesets explicitly), Dynamic uses the available roundstart budget to pick threats. This is done through the following system:
|
||||
|
||||
- All roundstart rulesets (remember, `/datum/dynamic_ruleset/roundstart`) are put into an associative list with their weight as the values (`drafted_rules`).
|
||||
- Until there is either no roundstart budget left, or until there is no ruleset we can choose from with the available threat, a `pickweight` is done based on the drafted_rules. If the same threat is picked twice, it will "scale up". The meaning of this depends on the ruleset itself, using the `scaled_times` variable; traitors for instance will create more the higher they scale.
|
||||
- If a ruleset is chosen with the `HIGH_IMPACT_RULESET` in its `flags`, then all other `HIGH_IMPACT_RULESET`s will be removed from `drafted_rules`. This is so that only one can ever be chosen.
|
||||
- If a ruleset has `LONE_RULESET` in its `flags`, then it will be removed from `drafted_rules`. This is to ensure it will only ever be picked once. An example of this in use is Wizard, to avoid creating multiple wizards.
|
||||
- After all roundstart threats are chosen, `/datum/dynamic_ruleset/proc/picking_roundstart_rule` is called for each, passing in the ruleset and the number of times it is scaled.
|
||||
- In this stage, `pre_execute` is called, which is the function that will determine what players get what antagonists. If this function returns FALSE for whatever reason (in the case of an error), then its threat is refunded.
|
||||
|
||||
After this process is done, any leftover roundstart threat will be given to the existing midround budget (done in `/datum/controller/subsystem/dynamic/pre_setup()`).
|
||||
|
||||
## Deciding midround threats
|
||||
|
||||
### Frequency
|
||||
|
||||
The frequency of midround threats is based on the midround threat of the round. The number of midround threats that will roll is `threat_level` / `threat_per_midround_roll` (configurable), rounded up. For example, if `threat_per_midround_roll` is set to 5, then for every 5 threat, one midround roll will be added. If you have 6 threat, with this configuration, you will get 2 midround rolls.
|
||||
|
||||
These midround roll points are then equidistantly spaced across the round, starting from `midround_lower_bound` (configurable) to `midround_upper_bound` (configurable), with a +/- of `midround_roll_distance` (configurable).
|
||||
|
||||
For example, if:
|
||||
|
||||
1. `midround_lower_bound` is `10 MINUTES`
|
||||
2. `midround_upper_bound` is `100 MINUTES`
|
||||
3. `midround_roll_distance` is `3 MINUTES`
|
||||
4. You have 5 midround rolls for the round
|
||||
|
||||
...then those 5 midround rolls will be placed equidistantly (meaning equally apart) across the first 10-100 minutes of the round. Every individual roll will then be adjusted to either be 3 minutes earlier, or 3 minutes later.
|
||||
|
||||
### Threat variety
|
||||
|
||||
Threats are split between **heavy** rulesets and **light** rulesets. A heavy ruleset includes major threats like space dragons or blobs, while light rulesets are ones that don't often cause shuttle calls when rolled, such as revenants or traitors (sleeper agents).
|
||||
|
||||
When a midround roll occurs, the decision to choose between light or heavy depends on the current round time. If it is less than `midround_light_upper_bound` (configurable), then it is guaranteed to be a light ruleset. If it is more than `midround_heavy_lower_bound`, then it is guaranteed to be a heavy ruleset. If it is any point in between, it will interpolate the value between those. This means that the longer the round goes on, the more likely you are to get a heavy ruleset.
|
||||
|
||||
If no heavy ruleset can run, such as not having enough threat, then a light ruleset is guaranteed to run.
|
||||
|
||||
## Rule Processing
|
||||
|
||||
Calls [rule_process][/datum/dynamic_ruleset/proc/rule_process] on every rule which is in the current_rules list.
|
||||
Every sixty seconds, update_playercounts()
|
||||
Midround injection time is checked against world.time to see if an injection should happen.
|
||||
If midround injection time is lower than world.time, it updates playercounts again, then tries to inject and generates a new cooldown regardless of whether a rule is picked.
|
||||
|
||||
## Latejoin
|
||||
|
||||
make_antag_chance(newPlayer) -> (For each latespawn rule...)
|
||||
-> acceptable(living players, threat_level) -> trim_candidates() -> ready(forced=FALSE)
|
||||
**If true, add to drafted rules
|
||||
**NOTE that acceptable uses threat_level not threat!
|
||||
**NOTE Latejoin timer is ONLY reset if at least one rule was drafted.
|
||||
**NOTE the new_player.dm AttemptLateSpawn() calls OnPostSetup for all roles (unless assigned role is MODE)
|
||||
|
||||
(After collecting all draftble rules...)
|
||||
-> picking_latejoin_ruleset(drafted_rules) -> spend threat -> ruleset.execute()
|
||||
|
||||
## Midround
|
||||
|
||||
process() -> (For each midround rule...
|
||||
-> acceptable(living players, threat_level) -> trim_candidates() -> ready(forced=FALSE)
|
||||
(After collecting all draftble rules...)
|
||||
-> picking_midround_ruleset(drafted_rules) -> spend threat -> ruleset.execute()
|
||||
|
||||
## Forced
|
||||
|
||||
For latejoin, it simply sets forced_latejoin_rule
|
||||
make_antag_chance(newPlayer) -> trim_candidates() -> ready(forced=TRUE) \*\*NOTE no acceptable() call
|
||||
|
||||
For midround, calls the below proc with forced = TRUE
|
||||
picking_specific_rule(ruletype,forced) -> forced OR acceptable(living_players, threat_level) -> trim_candidates() -> ready(forced) -> spend threat -> execute()
|
||||
**NOTE specific rule can be called by RS traitor->MR autotraitor w/ forced=FALSE
|
||||
**NOTE that due to short circuiting acceptable() need not be called if forced.
|
||||
|
||||
## Ruleset
|
||||
|
||||
acceptable(population,threat) just checks if enough threat_level for population indice.
|
||||
\*\*NOTE that we currently only send threat_level as the second arg, not threat.
|
||||
ready(forced) checks if enough candidates and calls the map's map_ruleset(dynamic_ruleset) at the parent level
|
||||
|
||||
trim_candidates() varies significantly according to the ruleset type
|
||||
Roundstart: All candidates are new_player mobs. Check them for standard stuff: connected, desire role, not banned, etc.
|
||||
\*\*NOTE Roundstart deals with both candidates (trimmed list of valid players) and mode.candidates (everyone readied up). Don't confuse them!
|
||||
Latejoin: Only one candidate, the latejoiner. Standard checks.
|
||||
Midround: Instead of building a single list candidates, candidates contains four lists: living, dead, observing, and living antags. Standard checks in trim_list(list).
|
||||
|
||||
Midround - Rulesets have additional types
|
||||
/from_ghosts: execute() -> send_applications() -> review_applications() -> finish_applications() -> finish_setup(mob/newcharacter, index) -> setup_role(role)
|
||||
\*\*NOTE: execute() here adds dead players and observers to candidates list
|
||||
|
||||
## Configuration and variables
|
||||
|
||||
### Configuration
|
||||
|
||||
Configuration can be done through a `config/dynamic.json` file. One is provided as example in the codebase. This config file, loaded in `/datum/controller/subsystem/dynamic/pre_setup()`, directly overrides the values in the codebase, and so is perfect for making some rulesets harder/easier to get, turning them off completely, changing how much they cost, etc.
|
||||
|
||||
The format of this file is:
|
||||
|
||||
```json
|
||||
{
|
||||
"Dynamic": {
|
||||
/* Configuration in here will directly override `/datum/controller/subsystem/dynamic` itself. */
|
||||
/* Keys are variable names, values are their new values. */
|
||||
},
|
||||
|
||||
"Roundstart": {
|
||||
/* Configuration in here will apply to `/datum/dynamic_ruleset/roundstart` instances. */
|
||||
/* Keys are the ruleset names, values are another associative list with keys being variable names and values being new values. */
|
||||
"Wizard": {
|
||||
/* I, a head admin, have died to wizard, and so I made it cost a lot more threat than it does in the codebase. */
|
||||
"cost": 80
|
||||
}
|
||||
},
|
||||
|
||||
"Midround": {
|
||||
/* Same as "Roundstart", but for `/datum/dynamic_ruleset/midround` instead. */
|
||||
},
|
||||
|
||||
"Latejoin": {
|
||||
/* Same as "Roundstart", but for `/datum/dynamic_ruleset/latejoin` instead. */
|
||||
},
|
||||
|
||||
"Station": {
|
||||
/* Special threat reductions for dangerous station traits. Traits are selected before dynamic, so traits will always */
|
||||
/* reduce threat even if there's no threat for it available. Only "cost" can be modified */
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note: Comments are not possible in this format, and are just in this document for the sake of readability.
|
||||
|
||||
### Rulesets
|
||||
|
||||
Rulesets have the following variables notable to developers and those interested in tuning.
|
||||
|
||||
- `required_candidates` - The number of people that _must be willing_ (in their preferences) to be an antagonist with this ruleset. If the candidates do not meet this requirement, then the ruleset will not bother to be drafted.
|
||||
- `antag_cap` - Judges the amount of antagonists to apply, for both solo and teams. Note that some antagonists (such as traitors, lings, heretics, etc) will add more based on how many times they've been scaled. Written as a linear equation--ceil(x/denominator) + offset, or as a fixed constant. If written as a linear equation, will be in the form of `list("denominator" = denominator, "offset" = offset)`.
|
||||
- Examples include:
|
||||
- Traitor: `antag_cap = list("denominator" = 24)`. This means that for every 24 players, 1 traitor will be added (assuming no scaling).
|
||||
- Nuclear Emergency: `antag_cap = list("denominator" = 18, "offset" = 1)`. For every 18 players, 1 nuke op will be added. Starts at 1, meaning at 30 players, 3 nuke ops will be created, rather than 2.
|
||||
- Revolution: `antag_cap = 3`. There will always be 3 rev-heads, no matter what.
|
||||
- `minimum_required_age` - The minimum age in order to apply for the ruleset.
|
||||
- `weight` - How likely this ruleset is to be picked. A higher weight results in a higher chance of drafting.
|
||||
- `cost` - The initial cost of the ruleset. This cost is taken from either the roundstart or midround budget, depending on the ruleset.
|
||||
- `scaling_cost` - Cost for every _additional_ application of this ruleset.
|
||||
- Suppose traitors has a `cost` of 8, and a `scaling_cost` of 5. This means that buying 1 application of the traitor ruleset costs 8 threat, but buying two costs 13 (8 + 5). Buying it a third time is 18 (8 + 5 + 5), etc.
|
||||
- `pop_per_requirement` - The range of population each value in `requirements` represents. By default, this is 6.
|
||||
- If the value is five the range is 0-4, 5-9, 10-14, 15-19, 20-24, 25-29, 30-34, 35-39, 40-54, 45+.
|
||||
- If it is six the range is 0-5, 6-11, 12-17, 18-23, 24-29, 30-35, 36-41, 42-47, 48-53, 54+.
|
||||
- If it is seven the range is 0-6, 7-13, 14-20, 21-27, 28-34, 35-41, 42-48, 49-55, 56-62, 63+.
|
||||
- `requirements` - A list that represents, per population range (see: `pop_per_requirement`), how much threat is required to _consider_ this ruleset. This is independent of how much it'll actually cost. This uses _threat level_, not the budget--meaning if a round has 50 threat level, but only 10 points of round start threat, a ruleset with a requirement of 40 can still be picked if it can be bought.
|
||||
- Suppose wizard has a `requirements` of `list(90,90,70,40,30,20,10,10,10,10)`. This means that, at 0-5 and 6-11 players, A station must have 90 threat in order for a wizard to be possible. At 12-17, 70 threat is required instead, etc.
|
||||
- `restricted_roles` - A list of jobs that _can't_ be drafted by this ruleset. For example, cyborgs cannot be changelings, and so are in the `restricted_roles`.
|
||||
- `protected_roles` - Serves the same purpose of `restricted_roles`, except it can be turned off through configuration (`protect_roles_from_antagonist`). For example, security officers _shouldn't_ be made traitor, so they are in Traitor's `protected_roles`.
|
||||
- When considering putting a role in `protected_roles` or `restricted_roles`, the rule of thumb is if it is _technically infeasible_ to support that job in that role. There's no _technical_ reason a security officer can't be a traitor, and so they are simply in `protected_roles`. There _are_ technical reasons a cyborg can't be a changeling, so they are in `restricted_roles` instead.
|
||||
|
||||
This is not a complete list--search "configurable" in this README to learn more.
|
||||
|
||||
### Dynamic
|
||||
|
||||
The "Dynamic" key has the following configurable values:
|
||||
|
||||
- `pop_per_requirement` - The default value of `pop_per_requirement` for any ruleset that does not explicitly set it. Defaults to 6.
|
||||
- `latejoin_delay_min`, `latejoin_delay_max` - The time range, in deciseconds (take your seconds, and multiply by 10), for a latejoin to attempt rolling. Once this timer is finished, a new one will be created within the same range.
|
||||
- Suppose you have a `latejoin_delay_min` of 600 (60 seconds, 1 minute) and a `latejoin_delay_max` of 1800 (180 seconds, 3 minutes). Once the round starts, a random number in this range will be picked--let's suppose 1.5 minutes. After 1.5 minutes, Dynamic will decide if a latejoin threat should be created (a probability of `/datum/controller/subsystem/dynamic/proc/get_injection_chance()`). Regardless of its decision, a new timer will be started within the range of 1 to 3 minutes, repeatedly.
|
||||
- `threat_curve_centre` - A number between -5 and +5. A negative value will give a more peaceful round and a positive value will give a round with higher threat.
|
||||
- `threat_curve_width` - A number between 0.5 and 4. Higher value will favour extreme rounds and lower value rounds closer to the average.
|
||||
- `roundstart_split_curve_centre` - A number between -5 and +5. Equivalent to threat_curve_centre, but for the budget split. A negative value will weigh towards midround rulesets, and a positive value will weight towards roundstart ones.
|
||||
- `roundstart_split_curve_width` - A number between 0.5 and 4. Equivalent to threat_curve_width, but for the budget split. Higher value will favour more variance in splits and lower value rounds closer to the average.
|
||||
- `random_event_hijack_minimum` - The minimum amount of time for antag random events to be hijacked. (See [Random Event Hijacking](#random-event-hijacking))
|
||||
- `random_event_hijack_maximum` - The maximum amount of time for antag random events to be hijacked. (See [Random Event Hijacking](#random-event-hijacking))
|
||||
- `hijacked_random_event_injection_chance` - The amount of injection chance to give to Dynamic when a random event is hijacked. (See [Random Event Hijacking](#random-event-hijacking))
|
||||
- `max_threat_level` - Sets the maximum amount of threat that can be rolled. Defaults to 100. You should only use this to _lower_ the maximum threat, as raising it higher will not do anything.
|
||||
|
||||
## Random Event "Hijacking"
|
||||
|
||||
Random events have the potential to be hijacked by Dynamic to keep the pace of midround injections, while also allowing greenshifts to contain some antagonists.
|
||||
|
||||
`/datum/round_event_control/dynamic_should_hijack` is a variable to random events to allow Dynamic to hijack them, and defaults to FALSE. This is set to TRUE for random events that spawn antagonists.
|
||||
|
||||
In `/datum/controller/subsystem/dynamic/on_pre_random_event` (in `dynamic_hijacking.dm`), Dynamic hooks to random events. If the `dynamic_should_hijack` variable is TRUE, the following sequence of events occurs:
|
||||
|
||||

|
||||
|
||||
`n` is a random value between `random_event_hijack_minimum` and `random_event_hijack_maximum`. Heavy injection chance, should it need to be raised, is increased by `hijacked_random_event_injection_chance_modifier`.
|
||||
@@ -1,159 +0,0 @@
|
||||
#define ADMIN_CANCEL_MIDROUND_TIME (120 SECONDS) // BUBBER EDIT
|
||||
|
||||
///
|
||||
///
|
||||
/**
|
||||
* From a list of rulesets, returns one based on weight and availability.
|
||||
* Mutates the list that is passed into it to remove invalid rules.
|
||||
*
|
||||
* * max_allowed_attempts - Allows you to configure how many times the proc will attempt to pick a ruleset before giving up.
|
||||
*/
|
||||
/datum/controller/subsystem/dynamic/proc/pick_ruleset(list/drafted_rules, max_allowed_attempts = INFINITY)
|
||||
if (only_ruleset_executed)
|
||||
log_dynamic("FAIL: only_ruleset_executed")
|
||||
return null
|
||||
|
||||
if(!length(drafted_rules))
|
||||
log_dynamic("FAIL: pick ruleset supplied with an empty list of drafted rules.")
|
||||
return null
|
||||
|
||||
var/attempts = 0
|
||||
while (attempts < max_allowed_attempts)
|
||||
attempts++
|
||||
var/datum/dynamic_ruleset/rule = pick_weight(drafted_rules)
|
||||
if (!rule)
|
||||
var/list/leftover_rules = list()
|
||||
for (var/leftover_rule in drafted_rules)
|
||||
leftover_rules += "[leftover_rule]"
|
||||
|
||||
log_dynamic("FAIL: No rulesets left to pick. Leftover rules: [leftover_rules.Join(", ")]")
|
||||
return null
|
||||
|
||||
if (check_blocking(rule.blocking_rules, executed_rules))
|
||||
log_dynamic("FAIL: [rule] can't execute as another rulset is blocking it.")
|
||||
drafted_rules -= rule
|
||||
if(drafted_rules.len <= 0)
|
||||
return null
|
||||
continue
|
||||
else if (
|
||||
rule.flags & HIGH_IMPACT_RULESET \
|
||||
&& threat_level < GLOB.dynamic_stacking_limit \
|
||||
&& GLOB.dynamic_no_stacking \
|
||||
&& high_impact_ruleset_executed \
|
||||
)
|
||||
log_dynamic("FAIL: [rule] can't execute as a high impact ruleset was already executed.")
|
||||
drafted_rules -= rule
|
||||
if(drafted_rules.len <= 0)
|
||||
return null
|
||||
continue
|
||||
|
||||
return rule
|
||||
|
||||
return null
|
||||
|
||||
/// Executes a random midround ruleset from the list of drafted rules.
|
||||
/datum/controller/subsystem/dynamic/proc/pick_midround_rule(list/drafted_rules, description)
|
||||
log_dynamic("Rolling [drafted_rules.len] [description]")
|
||||
|
||||
var/datum/dynamic_ruleset/rule = pick_ruleset(drafted_rules)
|
||||
if (isnull(rule))
|
||||
return null
|
||||
|
||||
current_midround_rulesets = drafted_rules - rule
|
||||
|
||||
midround_injection_timer_id = addtimer(
|
||||
CALLBACK(src, PROC_REF(execute_midround_rule), rule), \
|
||||
ADMIN_CANCEL_MIDROUND_TIME, \
|
||||
TIMER_STOPPABLE, \
|
||||
)
|
||||
// SKYRAT EDIT REMOVAL BEGIN - Event notification
|
||||
/**
|
||||
log_dynamic("[rule] ruleset executing...")
|
||||
message_admins("DYNAMIC: Executing midround ruleset [rule] in [DisplayTimeText(ADMIN_CANCEL_MIDROUND_TIME)]. \
|
||||
<a href='byond://?src=[REF(src)];cancelmidround=[midround_injection_timer_id]'>CANCEL</a> | \
|
||||
<a href='byond://?src=[REF(src)];differentmidround=[midround_injection_timer_id]'>SOMETHING ELSE</a>")
|
||||
|
||||
return rule
|
||||
*/
|
||||
// SKYRAT EDIT REMOVAL END - Event notification
|
||||
|
||||
// SKYRAT EDIT ADDITION BEGIN - Event notification
|
||||
message_admins("<font color='[COLOR_ADMIN_PINK]'>Dynamic Event triggering in [DisplayTimeText(ADMIN_CANCEL_MIDROUND_TIME)]: [rule]. (\
|
||||
<a href='byond://?src=[REF(src)];cancelmidround=[midround_injection_timer_id]'>CANCEL</a> | \
|
||||
<a href='byond://?src=[REF(src)];differentmidround=[midround_injection_timer_id]'>SOMETHING ELSE</a>)</font>")
|
||||
for(var/client/staff as anything in GLOB.admins)
|
||||
if(staff?.prefs.read_preference(/datum/preference/toggle/comms_notification))
|
||||
SEND_SOUND(staff, sound('sound/misc/server-ready.ogg'))
|
||||
sleep(ADMIN_CANCEL_MIDROUND_TIME * 0.5)
|
||||
|
||||
if(!midround_injection_timer_id == null)
|
||||
message_admins("<font color='[COLOR_ADMIN_PINK]'>Dynamic Event triggering in [DisplayTimeText(ADMIN_CANCEL_MIDROUND_TIME * 0.5)]: [rule]. (\
|
||||
<a href='byond://?src=[REF(src)];cancelmidround=[midround_injection_timer_id]'>CANCEL</a> | \
|
||||
<a href='byond://?src=[REF(src)];differentmidround=[midround_injection_timer_id]'>SOMETHING ELSE</a>)</font>")
|
||||
|
||||
return rule
|
||||
// SKYRAT EDIT ADDITION END - Event notification
|
||||
|
||||
/// Fired after admins do not cancel a midround injection.
|
||||
/datum/controller/subsystem/dynamic/proc/execute_midround_rule(datum/dynamic_ruleset/rule)
|
||||
current_midround_rulesets = null
|
||||
midround_injection_timer_id = null
|
||||
if (!rule.repeatable)
|
||||
midround_rules = remove_from_list(midround_rules, rule.type)
|
||||
addtimer(CALLBACK(src, PROC_REF(execute_midround_latejoin_rule), rule), rule.delay)
|
||||
|
||||
/// Mainly here to facilitate delayed rulesets. All midround/latejoin rulesets are executed with a timered callback to this proc.
|
||||
/datum/controller/subsystem/dynamic/proc/execute_midround_latejoin_rule(sent_rule)
|
||||
var/datum/dynamic_ruleset/rule = sent_rule
|
||||
spend_midround_budget(rule.cost, threat_log, "[gameTimestamp()]: [rule.ruletype] [rule.name]")
|
||||
rule.pre_execute(GLOB.alive_player_list.len)
|
||||
if (rule.execute())
|
||||
log_dynamic("Injected a [rule.ruletype] ruleset [rule.name].")
|
||||
if(rule.flags & HIGH_IMPACT_RULESET)
|
||||
high_impact_ruleset_executed = TRUE
|
||||
else if(rule.flags & ONLY_RULESET)
|
||||
only_ruleset_executed = TRUE
|
||||
if(rule.ruletype == LATEJOIN_RULESET)
|
||||
var/mob/M = pick(rule.candidates)
|
||||
message_admins("[key_name(M)] joined the station, and was selected by the [rule.name] ruleset.")
|
||||
log_dynamic("[key_name(M)] joined the station, and was selected by the [rule.name] ruleset.")
|
||||
executed_rules += rule
|
||||
if (rule.persistent)
|
||||
current_rules += rule
|
||||
new_snapshot(rule)
|
||||
rule.forget_startup()
|
||||
return TRUE
|
||||
rule.forget_startup()
|
||||
rule.clean_up()
|
||||
stack_trace("The [rule.ruletype] rule \"[rule.name]\" failed to execute.")
|
||||
return FALSE
|
||||
|
||||
/// Fired when an admin cancels the current midround injection.
|
||||
/datum/controller/subsystem/dynamic/proc/admin_cancel_midround(mob/user, timer_id)
|
||||
if (midround_injection_timer_id != timer_id || !deltimer(midround_injection_timer_id))
|
||||
to_chat(user, span_notice("Too late!"))
|
||||
return
|
||||
|
||||
log_admin("[key_name(user)] cancelled the next midround injection.")
|
||||
message_admins("[key_name(user)] cancelled the next midround injection.")
|
||||
midround_injection_timer_id = null
|
||||
current_midround_rulesets = null
|
||||
|
||||
/// Fired when an admin requests a different midround injection.
|
||||
/datum/controller/subsystem/dynamic/proc/admin_different_midround(mob/user, timer_id)
|
||||
if (midround_injection_timer_id != timer_id || !deltimer(midround_injection_timer_id))
|
||||
to_chat(user, span_notice("Too late!"))
|
||||
return
|
||||
|
||||
midround_injection_timer_id = null
|
||||
|
||||
if (isnull(current_midround_rulesets) || current_midround_rulesets.len == 0)
|
||||
log_admin("[key_name(user)] asked for a different midround injection, but there were none left.")
|
||||
message_admins("[key_name(user)] asked for a different midround injection, but there were none left.")
|
||||
return
|
||||
|
||||
log_admin("[key_name(user)] asked for a different midround injection.")
|
||||
message_admins("[key_name(user)] asked for a different midround injection.")
|
||||
pick_midround_rule(current_midround_rulesets, "different midround rulesets")
|
||||
|
||||
#undef ADMIN_CANCEL_MIDROUND_TIME
|
||||
@@ -35,8 +35,10 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
var/list/level_order = list(JP_HIGH, JP_MEDIUM, JP_LOW)
|
||||
|
||||
/// Lazylist of mob:occupation_string pairs.
|
||||
var/list/dynamic_forced_occupations
|
||||
/// Lazylist of mob:occupation_string pairs. Forces mobs into certain occupations with highest priority.
|
||||
var/list/forced_occupations
|
||||
/// Lazylist of mob:list(occupation_string) pairs. Prevents mobs from taking certain occupations at all.
|
||||
var/list/prevented_occupations
|
||||
|
||||
/**
|
||||
* Keys should be assigned job roles. Values should be >= 1.
|
||||
@@ -322,7 +324,6 @@ SUBSYSTEM_DEF(job)
|
||||
if(!player?.mind)
|
||||
continue
|
||||
player.mind.set_assigned_role(get_job_type(/datum/job/unassigned))
|
||||
player.mind.special_role = null
|
||||
setup_occupations()
|
||||
unassigned = list()
|
||||
if(CONFIG_GET(flag/load_jobs_from_txt))
|
||||
@@ -415,9 +416,8 @@ SUBSYSTEM_DEF(job)
|
||||
SEND_SIGNAL(src, COMSIG_OCCUPATIONS_DIVIDED, pure, allow_all)
|
||||
|
||||
//Get the players who are ready
|
||||
for(var/i in GLOB.new_player_list)
|
||||
var/mob/dead/new_player/player = i
|
||||
if(player.ready == PLAYER_READY_TO_PLAY && player.check_preferences() && player.mind && is_unassigned_job(player.mind.assigned_role))
|
||||
for(var/mob/dead/new_player/player as anything in GLOB.new_player_list)
|
||||
if(player.ready == PLAYER_READY_TO_PLAY && player.check_job_preferences(!pure) && player.mind && is_unassigned_job(player.mind.assigned_role))
|
||||
unassigned += player
|
||||
|
||||
initial_players_to_assign = length(unassigned)
|
||||
@@ -710,9 +710,10 @@ SUBSYSTEM_DEF(job)
|
||||
return 0
|
||||
|
||||
/datum/controller/subsystem/job/proc/try_reject_player(mob/dead/new_player/player)
|
||||
if(player.mind && player.mind.special_role)
|
||||
job_debug("RJCT: Player unable to be rejected due to special_role, Player: [player], SpecialRole: [player.mind.special_role]")
|
||||
return FALSE
|
||||
for(var/datum/dynamic_ruleset/roundstart/ruleset in SSdynamic.queued_rulesets)
|
||||
if(player.mind in ruleset.selected_minds)
|
||||
job_debug("RJCT: Player unable to be rejected due to being selected by dynamic, Player: [player], Ruleset: [ruleset]")
|
||||
return FALSE
|
||||
|
||||
job_debug("RJCT: Player rejected, Player: [player]")
|
||||
unassigned -= player
|
||||
@@ -884,11 +885,12 @@ SUBSYSTEM_DEF(job)
|
||||
/// Assigns roles that are considered high priority, either due to dynamic needing to force a specific role for a specific ruleset
|
||||
/// or making sure roles critical to round progression exist where possible every shift.
|
||||
/datum/controller/subsystem/job/proc/assign_priority_positions()
|
||||
job_debug("APP: Assigning Dynamic ruleset forced occupations: [length(dynamic_forced_occupations)]")
|
||||
for(var/mob/new_player in dynamic_forced_occupations)
|
||||
job_debug("APP: Assigning Dynamic ruleset forced occupations: [LAZYLEN(forced_occupations)]")
|
||||
for(var/datum/mind/mind as anything in forced_occupations)
|
||||
var/mob/dead/new_player = mind.current
|
||||
// Eligibility checks already carried out as part of the dynamic ruleset trim_candidates proc.
|
||||
// However no guarantee of game state between then and now, so don't skip eligibility checks on assign_role.
|
||||
assign_role(new_player, get_job(dynamic_forced_occupations[new_player]))
|
||||
assign_role(new_player, get_job_type(LAZYACCESS(forced_occupations, mind)))
|
||||
|
||||
// Get JP_HIGH department Heads of Staff in place. Indirectly useful for the Revolution ruleset to have as many Heads as possible.
|
||||
job_debug("APP: Assigning all JP_HIGH head of staff roles.")
|
||||
@@ -953,7 +955,7 @@ SUBSYSTEM_DEF(job)
|
||||
job_debug("[debug_prefix]: Player has no mind, Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]")
|
||||
return JOB_UNAVAILABLE_GENERIC
|
||||
|
||||
if(possible_job.title in player.mind.restricted_roles)
|
||||
if(possible_job.title in LAZYACCESS(prevented_occupations, player.mind))
|
||||
job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_ANTAG_INCOMPAT, possible_job.title)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]")
|
||||
return JOB_UNAVAILABLE_ANTAG_INCOMPAT
|
||||
|
||||
@@ -972,7 +974,8 @@ SUBSYSTEM_DEF(job)
|
||||
return JOB_UNAVAILABLE_BANNED
|
||||
|
||||
// Check for character age
|
||||
if(possible_job.required_character_age > player.client.prefs.read_preference(/datum/preference/numeric/age) && possible_job.required_character_age != null)
|
||||
var/client/player_client = GET_CLIENT(player)
|
||||
if(isnum(possible_job.required_character_age) && possible_job.required_character_age > player_client.prefs.read_preference(/datum/preference/numeric/age))
|
||||
job_debug("[debug_prefix] Error: [get_job_unavailable_error_message(JOB_UNAVAILABLE_AGE)], Player: [player][add_job_to_log ? ", Job: [possible_job]" : ""]")
|
||||
return JOB_UNAVAILABLE_AGE
|
||||
|
||||
|
||||
@@ -285,11 +285,10 @@ SUBSYSTEM_DEF(polling)
|
||||
if(the_ignore_category)
|
||||
if(potential_candidate.ckey in GLOB.poll_ignore[the_ignore_category])
|
||||
return FALSE
|
||||
if(role)
|
||||
if(role && potential_candidate.client)
|
||||
if(!(role in potential_candidate.client.prefs.be_special))
|
||||
return FALSE
|
||||
var/required_time = GLOB.special_roles[role] || 0
|
||||
if(potential_candidate.client && potential_candidate.client.get_remaining_days(required_time) > 0)
|
||||
if(potential_candidate.client.get_days_to_play_antag(role) > 0)
|
||||
return FALSE
|
||||
|
||||
if(check_jobban)
|
||||
|
||||
@@ -241,7 +241,7 @@ SUBSYSTEM_DEF(ticker)
|
||||
return TRUE
|
||||
if(GLOB.station_was_nuked)
|
||||
return TRUE
|
||||
if(GLOB.revolutionary_win)
|
||||
if(GLOB.revolution_handler?.result == REVOLUTION_VICTORY)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -252,7 +252,7 @@ SUBSYSTEM_DEF(ticker)
|
||||
CHECK_TICK
|
||||
//Configure mode and assign player to antagonists
|
||||
var/can_continue = FALSE
|
||||
// can_continue = SSdynamic.pre_setup() //Choose antagonists // BUBBER EDIT - STORYTELLER (note: maybe disable)
|
||||
// can_continue = SSdynamic.select_roundstart_antagonists() //Choose antagonists // BUBBER EDIT - STORYTELLER (note: maybe disable)
|
||||
//BUBBER EDIT BEGIN - STORYTELLER
|
||||
SSgamemode.init_storyteller()
|
||||
can_continue = SSgamemode.pre_setup()
|
||||
@@ -325,7 +325,37 @@ SUBSYSTEM_DEF(ticker)
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/PostSetup()
|
||||
set waitfor = FALSE
|
||||
SSdynamic.post_setup()
|
||||
|
||||
// Spawn traitors and stuff
|
||||
for(var/datum/dynamic_ruleset/roundstart/ruleset in SSdynamic.queued_rulesets)
|
||||
ruleset.execute()
|
||||
SSdynamic.queued_rulesets -= ruleset
|
||||
SSdynamic.executed_rulesets += ruleset
|
||||
// Queue roundstart intercept report
|
||||
if(!CONFIG_GET(flag/no_intercept_report))
|
||||
GLOB.communications_controller.queue_roundstart_report()
|
||||
// Queue admin logout report
|
||||
addtimer(CALLBACK(src, PROC_REF(display_roundstart_logout_report)), ROUNDSTART_LOGOUT_REPORT_TIME)
|
||||
// Queue suicide slot handling
|
||||
if(CONFIG_GET(flag/reopen_roundstart_suicide_roles))
|
||||
var/delay = (CONFIG_GET(number/reopen_roundstart_suicide_roles_delay) * 1 SECONDS) || 4 MINUTES
|
||||
addtimer(CALLBACK(src, PROC_REF(reopen_roundstart_suicide_roles)), delay)
|
||||
// Handle database
|
||||
if(SSdbcore.Connect())
|
||||
var/list/to_set = list()
|
||||
var/arguments = list()
|
||||
if(GLOB.revdata.originmastercommit)
|
||||
to_set += "commit_hash = :commit_hash"
|
||||
arguments["commit_hash"] = GLOB.revdata.originmastercommit
|
||||
if(to_set.len)
|
||||
arguments["round_id"] = GLOB.round_id
|
||||
var/datum/db_query/query_round_game_mode = SSdbcore.NewQuery(
|
||||
"UPDATE [format_table_name("round")] SET [to_set.Join(", ")] WHERE id = :round_id",
|
||||
arguments
|
||||
)
|
||||
query_round_game_mode.Execute()
|
||||
qdel(query_round_game_mode)
|
||||
|
||||
SSgamemode.post_setup() // BUBBER EDIT - Storyteller
|
||||
GLOB.start_state = new /datum/station_state()
|
||||
GLOB.start_state.count()
|
||||
@@ -355,11 +385,97 @@ SUBSYSTEM_DEF(ticker)
|
||||
|
||||
if(!iter_human.hardcore_survival_score)
|
||||
continue
|
||||
if(iter_human.mind?.special_role)
|
||||
if(iter_human.is_antag())
|
||||
to_chat(iter_human, span_notice("You will gain [round(iter_human.hardcore_survival_score) * 2] hardcore random points if you greentext this round!"))
|
||||
else
|
||||
to_chat(iter_human, span_notice("You will gain [round(iter_human.hardcore_survival_score)] hardcore random points if you survive this round!"))
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/display_roundstart_logout_report()
|
||||
var/list/msg = list("[span_boldnotice("Roundstart logout report")]\n\n")
|
||||
for(var/i in GLOB.mob_living_list)
|
||||
var/mob/living/L = i
|
||||
var/mob/living/carbon/C = L
|
||||
if (istype(C) && !C.last_mind)
|
||||
continue // never had a client
|
||||
|
||||
if(L.ckey && !GLOB.directory[L.ckey])
|
||||
msg += "<b>[L.name]</b> ([L.key]), the [L.job] (<font color='#ffcc00'><b>Disconnected</b></font>)\n"
|
||||
|
||||
|
||||
if(L.ckey && L.client)
|
||||
var/failed = FALSE
|
||||
if(L.client.inactivity >= ROUNDSTART_LOGOUT_AFK_THRESHOLD) //Connected, but inactive (alt+tabbed or something)
|
||||
msg += "<b>[L.name]</b> ([L.key]), the [L.job] (<font color='#ffcc00'><b>Connected, Inactive</b></font>)\n"
|
||||
failed = TRUE //AFK client
|
||||
if(!failed && L.stat)
|
||||
if(HAS_TRAIT(L, TRAIT_SUICIDED)) //Suicider
|
||||
msg += "<b>[L.name]</b> ([L.key]), the [L.job] ([span_bolddanger("Suicide")])\n"
|
||||
failed = TRUE //Disconnected client
|
||||
if(!failed && (L.stat == UNCONSCIOUS || L.stat == HARD_CRIT))
|
||||
msg += "<b>[L.name]</b> ([L.key]), the [L.job] (Dying)\n"
|
||||
failed = TRUE //Unconscious
|
||||
if(!failed && L.stat == DEAD)
|
||||
msg += "<b>[L.name]</b> ([L.key]), the [L.job] (Dead)\n"
|
||||
failed = TRUE //Dead
|
||||
|
||||
continue //Happy connected client
|
||||
for(var/mob/dead/observer/D in GLOB.dead_mob_list)
|
||||
if(D.mind && D.mind.current == L)
|
||||
if(L.stat == DEAD)
|
||||
if(HAS_TRAIT(L, TRAIT_SUICIDED)) //Suicider
|
||||
msg += "<b>[L.name]</b> ([ckey(D.mind.key)]), the [L.job] ([span_bolddanger("Suicide")])\n"
|
||||
continue //Disconnected client
|
||||
else
|
||||
msg += "<b>[L.name]</b> ([ckey(D.mind.key)]), the [L.job] (Dead)\n"
|
||||
continue //Dead mob, ghost abandoned
|
||||
else
|
||||
if(D.can_reenter_corpse)
|
||||
continue //Adminghost, or cult/wizard ghost
|
||||
else
|
||||
msg += "<b>[L.name]</b> ([ckey(D.mind.key)]), the [L.job] ([span_bolddanger("Ghosted")])\n"
|
||||
continue //Ghosted while alive
|
||||
|
||||
var/concatenated_message = msg.Join()
|
||||
log_admin(concatenated_message)
|
||||
to_chat(GLOB.admins, concatenated_message)
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/reopen_roundstart_suicide_roles()
|
||||
var/include_command = CONFIG_GET(flag/reopen_roundstart_suicide_roles_command_positions)
|
||||
var/list/reopened_jobs = list()
|
||||
|
||||
for(var/mob/living/quitter in GLOB.suicided_mob_list)
|
||||
var/datum/job/job = SSjob.get_job(quitter.job)
|
||||
if(!job || !(job.job_flags & JOB_REOPEN_ON_ROUNDSTART_LOSS))
|
||||
continue
|
||||
if(!include_command && job.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND)
|
||||
continue
|
||||
job.current_positions = max(job.current_positions - 1, 0)
|
||||
reopened_jobs += quitter.job
|
||||
|
||||
if(CONFIG_GET(flag/reopen_roundstart_suicide_roles_command_report))
|
||||
if(reopened_jobs.len)
|
||||
var/reopened_job_report_positions
|
||||
for(var/dead_dudes_job in reopened_jobs)
|
||||
reopened_job_report_positions = "[reopened_job_report_positions ? "[reopened_job_report_positions]\n":""][dead_dudes_job]"
|
||||
|
||||
var/suicide_command_report = {"
|
||||
<font size = 3><b>[command_name()] Human Resources Board</b><br>
|
||||
Notice of Personnel Change</font><hr>
|
||||
To personnel management staff aboard [station_name()]:<br><br>
|
||||
Our medical staff have detected a series of anomalies in the vital sensors
|
||||
of some of the staff aboard your station.<br><br>
|
||||
Further investigation into the situation on our end resulted in us discovering
|
||||
a series of rather... unforturnate decisions that were made on the part of said staff.<br><br>
|
||||
As such, we have taken the liberty to automatically reopen employment opportunities for the positions of the crew members
|
||||
who have decided not to partake in our research. We will be forwarding their cases to our employment review board
|
||||
to determine their eligibility for continued service with the company (and of course the
|
||||
continued storage of cloning records within the central medical backup server.)<br><br>
|
||||
<i>The following positions have been reopened on our behalf:<br><br>
|
||||
[reopened_job_report_positions]</i>
|
||||
"}
|
||||
|
||||
print_command_report(suicide_command_report, "Central Command Personnel Update")
|
||||
|
||||
//These callbacks will fire after roundstart key transfer
|
||||
/datum/controller/subsystem/ticker/proc/OnRoundstart(datum/callback/cb)
|
||||
if(!HasRoundStarted())
|
||||
|
||||
Reference in New Issue
Block a user