Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a dynamic config to cap the maximum threat level, max_threat_level #61869

Merged
merged 3 commits into from Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion code/game/gamemodes/dynamic/dynamic.dm
Expand Up @@ -151,6 +151,10 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
var/waittime_l = 600
/// What is the higher bound of when the roundstart annoucement is sent out?
var/waittime_h = 1800

/// Maximum amount of threat allowed to generate.
var/max_threat_level = 100


/datum/game_mode/dynamic/admin_panel()
var/list/dat = list("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Game Mode Panel</title></head><body><h1><B>Game Mode Panel</B></h1>")
Expand Down Expand Up @@ -308,7 +312,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
/// Generates the threat level using lorentz distribution and assigns peaceful_percentage.
/datum/game_mode/dynamic/proc/generate_threat()
var/relative_threat = LORENTZ_DISTRIBUTION(threat_curve_centre, threat_curve_width)
threat_level = round(lorentz_to_amount(relative_threat), 0.1)
threat_level = clamp(round(lorentz_to_amount(relative_threat), 0.1), 0, max_threat_level)

peaceful_percentage = round(LORENTZ_CUMULATIVE_DISTRIBUTION(relative_threat, threat_curve_centre, threat_curve_width), 0.01)*100

Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/dynamic/readme.md
Expand Up @@ -171,7 +171,7 @@ The "Dynamic" key has the following configurable values:
- `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.
Mothblocks marked this conversation as resolved.
Show resolved Hide resolved
## 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.

Expand Down