/tg/ Station 13 - Modules - TypesVar Details - Proc Details

dynamic_ruleset

Vars

antag_capJudges 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).
antag_datumThe antagonist datum that is assigned to the mobs mind on ruleset execution.
antag_flagPreferences flag such as ROLE_WIZARD that need to be turned on for players to be antag.
antag_flag_overrideIf a role is to be considered another for the purpose of banning.
antag_preferenceIf set, will check this preference instead of antag_flag.
assignedList of players that were selected for this rule. This can be minds, or mobs.
base_probBase 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)
blocking_rulesIf a ruleset type which is in this list has been executed, then the ruleset will not be executed.
candidatesList of players that are being drafted for this rule
costThreat cost for this rule, this is decreased from the threat level when the rule is executed.
delayDelay 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.
enemy_rolesIf 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.
exclusive_rolesIf 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.
flagsA flag that determines how the ruleset is handled. Check __DEFINES/dynamic.dm for an explanation of the accepted values.
indice_popCalculated during acceptable(), used in scaling and team sizes.
maximum_playersThe maximum amount of players required for the rule to be considered. Anything below zero or exactly zero is ignored.
minimum_playersThe minimum amount of players required for the rule to be considered.
minimum_required_ageThe required minimum account age for this ruleset.
nameFor admin logging and round end screen.
persistentIf set to TRUE, the rule won't be discarded after being executed, and dynamic will call rule_process() every time it ticks.
pop_per_requirementPop range per requirement. If zero defaults to dynamic's pop_per_requirement.
protected_rolesIf set, and config flag protect_roles_from_antagonist is false, then the rule will not pick players from these roles.
repeatableIf set to TRUE, dynamic will be able to draft this ruleset again later on. (doesn't apply for roundstart rules)
repeatable_weight_decreaseIf set higher than 0 decreases weight by itself causing the ruleset to appear less often the more it is repeated.
required_candidatesThe rule needs this many candidates (post-trimming) to be executed (example: Cult needs 4 players at round start)
required_enemiesIf 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.
requirementsRequirements 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.
restricted_rolesIf set, rule will deny candidates from those roles always.
ruleset_categoryIn what categories is this ruleset allowed to run? Used by station traits
ruleset_lazy_templatesA list, or null, of templates that the ruleset depends on to function correctly
ruletypeFor admin logging and round end screen, do not change this unless making a new rule type.
scaled_timesHow many times a rule has scaled up upon getting picked.
scaling_costCost per level the rule scales up.
total_costUsed for the roundend report
weight0 -> 9, probability for this rule to be picked against other rules. If zero this will effectively disable the rule.

Procs

acceptableBy 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
check_candidatesChecks if there are enough candidates to run, and logs otherwise
clean_upRuns 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.
executeCalled on post_setup on roundstart and when the rule executes on midround and latejoin. Give your candidates or assignees equipment and antag datum here.
forget_startupRulesets 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.
get_antag_capReturns what the antag cap with the given population is.
get_antag_cap_scaling_includedGets the 'final' antag cap for this ruleset, which is the base cap plus the scaled cap.
get_scaling_antag_capReturns 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.
get_weightGets 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
is_valid_populationReturns true if we have enough players to run
is_valid_threatSets the current threat indices and returns true if we're inside of them
load_templatesThis should always be called before ready is, to ensure that the ruleset can locate map/template based landmarks as needed
pre_executeCalled on pre_setup for roundstart rulesets. Do everything you need to do before job is assigned here. IMPORTANT: ASSIGN special_role HERE
readyHere 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!
round_resultSet mode_result and news report here. Only called if ruleset is flagged as HIGH_IMPACT_RULESET
rule_processThis is called if persistent variable is true everytime SSTicker ticks.
scale_upWhen 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.
trim_candidatesHere 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.

Var Details

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).

antag_datum

The antagonist datum that is assigned to the mobs mind on ruleset execution.

antag_flag

Preferences flag such as ROLE_WIZARD that need to be turned on for players to be antag.

antag_flag_override

If a role is to be considered another for the purpose of banning.

antag_preference

If set, will check this preference instead of antag_flag.

assigned

List of players that were selected for this rule. This can be minds, or mobs.

base_prob

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)

blocking_rules

If a ruleset type which is in this list has been executed, then the ruleset will not be executed.

candidates

List of players that are being drafted for this rule

cost

Threat cost for this rule, this is decreased from the threat level when the rule is executed.

delay

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.

enemy_roles

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.

exclusive_roles

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.

flags

A flag that determines how the ruleset is handled. Check __DEFINES/dynamic.dm for an explanation of the accepted values.

indice_pop

Calculated during acceptable(), used in scaling and team sizes.

maximum_players

The maximum amount of players required for the rule to be considered. Anything below zero or exactly zero is ignored.

minimum_players

The minimum amount of players required for the rule to be considered.

minimum_required_age

The required minimum account age for this ruleset.

name

For admin logging and round end screen.

persistent

If set to TRUE, the rule won't be discarded after being executed, and dynamic will call rule_process() every time it ticks.

pop_per_requirement

Pop range per requirement. If zero defaults to dynamic's pop_per_requirement.

protected_roles

If set, and config flag protect_roles_from_antagonist is false, then the rule will not pick players from these roles.

repeatable

If set to TRUE, dynamic will be able to draft this ruleset again later on. (doesn't apply for roundstart rules)

repeatable_weight_decrease

If set higher than 0 decreases weight by itself causing the ruleset to appear less often the more it is repeated.

required_candidates

The rule needs this many candidates (post-trimming) to be executed (example: Cult needs 4 players at round start)

required_enemies

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.

requirements

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.

restricted_roles

If set, rule will deny candidates from those roles always.

ruleset_category

In what categories is this ruleset allowed to run? Used by station traits

ruleset_lazy_templates

A list, or null, of templates that the ruleset depends on to function correctly

ruletype

For admin logging and round end screen, do not change this unless making a new rule type.

scaled_times

How many times a rule has scaled up upon getting picked.

scaling_cost

Cost per level the rule scales up.

total_cost

Used for the roundend report

weight

0 -> 9, probability for this rule to be picked against other rules. If zero this will effectively disable the rule.

Proc Details

acceptable

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

check_candidates

Checks if there are enough candidates to run, and logs otherwise

clean_up

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.

execute

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.

forget_startup

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.

get_antag_cap

Returns what the antag cap with the given population is.

get_antag_cap_scaling_included

Gets the 'final' antag cap for this ruleset, which is the base cap plus the scaled cap.

get_scaling_antag_cap

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.

get_weight

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

is_valid_population

Returns true if we have enough players to run

is_valid_threat

Sets the current threat indices and returns true if we're inside of them

load_templates

This should always be called before ready is, to ensure that the ruleset can locate map/template based landmarks as needed

pre_execute

Called on pre_setup for roundstart rulesets. Do everything you need to do before job is assigned here. IMPORTANT: ASSIGN special_role HERE

ready

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!

round_result

Set mode_result and news report here. Only called if ruleset is flagged as HIGH_IMPACT_RULESET

rule_process

This is called if persistent variable is true everytime SSTicker ticks.

scale_up

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.

trim_candidates

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.