From 428ea5e5e14ad44913d425c63225637174b438b6 Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 9 Nov 2019 03:12:36 -0800 Subject: [PATCH] Nuke disk being still now generates threat --- code/__HELPERS/roundend.dm | 2 + code/game/gamemodes/dynamic/dynamic.dm | 7 ++- .../nukeop/equipment/nuclearbomb.dm | 47 ++++++++++++++----- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 233ea22631..46b36e429d 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -315,6 +315,8 @@ parts += "[FOURSPACES]Executed rules:" for(var/str in mode.threat_log) parts += "[FOURSPACES][FOURSPACES][str]" + for(var/entry in mode.threat_tallies) + parts += "[FOURSPACES][FOURSPACES][entry] added [mode.threat_tallies[entry]]" return parts.Join("
") /client/proc/roundend_report_file() diff --git a/code/game/gamemodes/dynamic/dynamic.dm b/code/game/gamemodes/dynamic/dynamic.dm index dff34df50a..e872ee1915 100644 --- a/code/game/gamemodes/dynamic/dynamic.dm +++ b/code/game/gamemodes/dynamic/dynamic.dm @@ -62,6 +62,10 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) var/threat_level = 0 /// Set at the beginning of the round. Spent by the mode to "purchase" rules. var/threat = 0 + /// Starting threat level, for things that increase it but can bring it back down. + var/initial_threat_level = 0 + /// Things that cause a rolling threat adjustment to be displayed at roundend. + var/list/threat_tallies = list() /// Running information about the threat. Can store text or datum entries. var/list/threat_log = list() /// As above, but with info such as refunds. @@ -281,7 +285,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) if(!check_rights(R_ADMIN)) return - var/list/out = list("Threat LogThreat Log
Starting Threat: [threat_level]
") + var/list/out = list("Threat LogThreat Log
Starting Threat: [initial_threat_level]
") for(var/entry in threat_log_verbose) if(istext(entry)) @@ -328,6 +332,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) var/midround_injection_cooldown_middle = 0.5*(GLOB.dynamic_first_midround_delay_min + GLOB.dynamic_first_midround_delay_max) midround_injection_cooldown = round(CLAMP(EXP_DISTRIBUTION(midround_injection_cooldown_middle), GLOB.dynamic_first_midround_delay_min, GLOB.dynamic_first_midround_delay_max)) + world.time log_game("DYNAMIC: Dynamic Mode initialized with a Threat Level of... [threat_level]!") + initial_threat_level = threat_level return TRUE /datum/game_mode/dynamic/pre_setup() diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index add3c1d9b0..d271c6c24c 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm @@ -583,6 +583,8 @@ This is here to make the tiles around the station mininuke change when it's arme . = ..() AddComponent(/datum/component/stationloving, !fake) +#define STATIONARY_DISK_STRING "Stationary Nuke Disk" + /obj/item/disk/nuclear/process() if(fake) STOP_PROCESSING(SSobj, src) @@ -590,21 +592,42 @@ This is here to make the tiles around the station mininuke change when it's arme var/turf/newturf = get_turf(src) if(newturf && lastlocation == newturf) if(last_disk_move < world.time - 5000 && prob((world.time - 5000 - last_disk_move)*0.0001)) - var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control - if(istype(loneop)) - loneop.weight += 1 - if(loneop.weight % 5 == 0) - message_admins("[src] is stationary in [ADMIN_VERBOSEJMP(newturf)]. The weight of Lone Operative is now [loneop.weight].") - log_game("[src] is stationary for too long in [loc_name(newturf)], and has increased the weight of the Lone Operative event to [loneop.weight].") + if(istype(SSticker.mode, /datum/game_mode/dynamic)) + var/datum/game_mode/dynamic/mode = SSticker.mode + mode.create_threat(0.1) + if(round(mode.threat) == mode.threat) + message_admins("[src] is stationary in [ADMIN_VERBOSEJMP(newturf)]. The dynamic threat rating has increased to [mode.threat].") + log_game("[src] is stationary for too long in [loc_name(newturf)], and has increased dynamic threat to [mode.threat].") + if(!(STATIONARY_DISK_STRING in mode.threat_tallies)) + mode.threat_tallies[STATIONARY_DISK_STRING] = 0 + mode.threat_tallies[STATIONARY_DISK_STRING] += 0.1 + else + var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control + if(istype(loneop)) + loneop.weight += 1 + if(loneop.weight % 5 == 0) + message_admins("[src] is stationary in [ADMIN_VERBOSEJMP(newturf)]. The weight of Lone Operative is now [loneop.weight].") + log_game("[src] is stationary for too long in [loc_name(newturf)], and has increased the weight of the Lone Operative event to [loneop.weight].") else lastlocation = newturf last_disk_move = world.time - var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control - if(istype(loneop) && prob(loneop.weight)) - loneop.weight = max(loneop.weight - 1, 0) - if(loneop.weight % 5 == 0) - message_admins("[src] is on the move (currently in [ADMIN_VERBOSEJMP(newturf)]). The weight of Lone Operative is now [loneop.weight].") - log_game("[src] being on the move has reduced the weight of the Lone Operative event to [loneop.weight].") + if(istype(SSticker.mode, /datum/game_mode/dynamic)) + var/datum/game_mode/dynamic/mode = SSticker.mode + if(STATIONARY_DISK_STRING in mode.threat_tallies) + mode.threat_tallies[STATIONARY_DISK_STRING] -= 0.1 + mode.spend_threat(0.1) + mode.threat_level = max(mode.threat_level-0.1,mode.initial_threat_level) + if(mode.threat_tallies[STATIONARY_DISK_STRING] == 0) + mode.threat_tallies -= STATIONARY_DISK_STRING + else + var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control + if(istype(loneop) && prob(loneop.weight)) + loneop.weight = max(loneop.weight - 1, 0) + if(loneop.weight % 5 == 0) + message_admins("[src] is on the move (currently in [ADMIN_VERBOSEJMP(newturf)]). The weight of Lone Operative is now [loneop.weight].") + log_game("[src] being on the move has reduced the weight of the Lone Operative event to [loneop.weight].") + +#undef STATIONARY_DISK_STRING /obj/item/disk/nuclear/examine(mob/user) . = ..()