/datum/dynamic_ruleset
Vars | |
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. |
assigned | List of players that were selected for this rule |
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 mode's threat 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, IMPORTANT: DOES NOT WORK ON ROUNDSTART RULESETS. |
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. |
mode | Reference to the mode, use this instead of SSticker.mode. |
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 mode'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 mode 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_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. |
Procs | |
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_finished | Checks if round is finished, return true to end the round. Only called if ruleset is flagged as HIGH_IMPACT_RULESET |
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. |
get_antag_cap | Returns what the antag cap with the given population is. |
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 |
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 game mode 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. |
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.
assigned
List of players that were selected for this rule
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 mode's threat 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, IMPORTANT: DOES NOT WORK ON ROUNDSTART RULESETS.
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.
mode
Reference to the mode, use this instead of SSticker.mode.
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 mode'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 mode 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_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_finished
Checks if round is finished, return true to end the round. Only called if ruleset is flagged as HIGH_IMPACT_RULESET
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.
get_antag_cap
Returns what the antag cap with the given population is.
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
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 game mode 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.