Skip to content

Commit

Permalink
Adds a dynamic config to cap the maximum threat level, max_threat_lev…
Browse files Browse the repository at this point in the history
…el (#61869)

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
  • Loading branch information
Iamgoofball and Mothblocks committed Oct 4, 2021
1 parent 62370b2 commit 963df50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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
1 change: 1 addition & 0 deletions code/game/gamemodes/dynamic/readme.md
Expand Up @@ -171,6 +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. 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.
Expand Down

0 comments on commit 963df50

Please sign in to comment.