From 37e295b04ae54c1932d5b19e35c54c2bfdd8052b Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 5 Feb 2022 18:58:52 +0100 Subject: [PATCH] [MIRROR] brings back greenshifts [MDB IGNORE] (#11281) * brings back greenshifts * Update code/game/gamemodes/game_mode.dm Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com> Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com> --- code/game/gamemodes/dynamic/dynamic.dm | 17 ++++++++++++++--- code/game/gamemodes/game_mode.dm | 6 +++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/code/game/gamemodes/dynamic/dynamic.dm b/code/game/gamemodes/dynamic/dynamic.dm index 7ea5f0e28a5..77b81c67d4e 100644 --- a/code/game/gamemodes/dynamic/dynamic.dm +++ b/code/game/gamemodes/dynamic/dynamic.dm @@ -288,13 +288,24 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) . += "Your station is somehow in the middle of hostile territory, in clear view of any enemy of the corporation. Your likelihood to survive is low, and station destruction is expected and almost inevitable. Secure any sensitive material and neutralize any enemy you will come across. It is important that you at least try to maintain the station.
" . += "Good luck." + var/min_threat = 100 + for(var/datum/dynamic_ruleset/ruleset as anything in init_rulesets(/datum/dynamic_ruleset)) + if(ruleset.weight <= 0 || ruleset.cost <= 0) + continue + min_threat = min(ruleset.cost, min_threat) + var/greenshift = GLOB.dynamic_forced_extended || (threat_level < min_threat && shown_threat < min_threat) //if both shown and real threat are below any ruleset, its extended time + + generate_station_goals(greenshift) . += generate_station_goal_report() . += generate_station_trait_report() print_command_report(., "Central Command Status Summary", announce=FALSE) - priority_announce("A summary has been copied and printed to all communications consoles.", "Security level elevated.", ANNOUNCER_INTERCEPT) - if(SSsecurity_level.current_level < SEC_LEVEL_BLUE) - set_security_level(SEC_LEVEL_BLUE) + if(greenshift) + priority_announce("Thanks to the tireless efforts of our security and intelligence divisions, there are currently no credible threats to [station_name()]. All station construction projects have been authorized. Have a secure shift!", "Security Report", SSstation.announcer.get_rand_report_sound()) + else + priority_announce("A summary has been copied and printed to all communications consoles.", "Security level elevated.", ANNOUNCER_INTERCEPT) + if(SSsecurity_level.current_level < SEC_LEVEL_BLUE) + set_security_level(SEC_LEVEL_BLUE) /datum/game_mode/dynamic/proc/show_threatlog(mob/admin) if(!SSticker.HasRoundStarted()) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 55b3c52d9dc..4c8c3a32b3d 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -49,7 +49,6 @@ ) query_round_game_mode.Execute() qdel(query_round_game_mode) - //generate_station_goals() SKYRAT EDIT REMOVAL return TRUE @@ -183,10 +182,11 @@ for (var/C in GLOB.admins) to_chat(C, msg.Join()) -/datum/game_mode/proc/generate_station_goals() +/datum/game_mode/proc/generate_station_goals(greenshift) + var/goal_budget = greenshift ? INFINITY : CONFIG_GET(number/station_goal_budget) var/list/possible = subtypesof(/datum/station_goal) var/goal_weights = 0 - while(possible.len && goal_weights < CONFIG_GET(number/station_goal_budget)) + while(possible.len && goal_weights < goal_budget) var/datum/station_goal/picked = pick_n_take(possible) goal_weights += initial(picked.weight) GLOB.station_goals += new picked