From 8e0c06e50e52a484c60de8fc0ace1473d23c312e Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sat, 25 Jan 2020 00:32:27 +0100 Subject: [PATCH 1/4] Hey, do you remember that wizard round where everyone tried arming up the nuclear bomb and we all went DELTA RED DELTA RED DELTA RED DELTA ? --- code/game/machinery/computer/communications.dm | 15 ++++++++++----- .../antagonists/nukeop/equipment/nuclearbomb.dm | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 1bc8a82147..17f17e8247 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -15,6 +15,7 @@ var/message_cooldown = 0 var/ai_message_cooldown = 0 var/tmp_alertlevel = 0 + var/static/security_level_cd // used to stop mass spam. var/const/STATE_DEFAULT = 1 var/const/STATE_CALLSHUTTLE = 2 var/const/STATE_CANCELSHUTTLE = 3 @@ -94,16 +95,18 @@ I = pda.id if (I && istype(I)) if(ACCESS_CAPTAIN in I.access) + if(security_level_cd < world.time) + to_chat(usr, "Security level protocols are currently on cooldown. Please stand by.") + return var/old_level = GLOB.security_level if(!tmp_alertlevel) tmp_alertlevel = SEC_LEVEL_GREEN if(tmp_alertlevel < SEC_LEVEL_GREEN) tmp_alertlevel = SEC_LEVEL_GREEN - if(tmp_alertlevel == SEC_LEVEL_BLUE) - tmp_alertlevel = SEC_LEVEL_BLUE if(tmp_alertlevel > SEC_LEVEL_AMBER) tmp_alertlevel = SEC_LEVEL_AMBER //Cannot engage delta with this set_security_level(tmp_alertlevel) + security_level_cd = world.time + 15 SECONDS if(GLOB.security_level != old_level) to_chat(usr, "Authorization confirmed. Modifying security level.") playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0) @@ -376,19 +379,21 @@ if("ai-announce") make_announcement(usr, 1) if("ai-securitylevel") + if(security_level_cd < world.time) + to_chat(usr, "Security level protocols are currently on cooldown. Please stand by.") + return tmp_alertlevel = text2num( href_list["newalertlevel"] ) if(!tmp_alertlevel) - tmp_alertlevel = 0 + tmp_alertlevel = SEC_LEVEL_GREEN var/old_level = GLOB.security_level if(!tmp_alertlevel) tmp_alertlevel = SEC_LEVEL_GREEN if(tmp_alertlevel < SEC_LEVEL_GREEN) tmp_alertlevel = SEC_LEVEL_GREEN - if(tmp_alertlevel == SEC_LEVEL_BLUE) - tmp_alertlevel = SEC_LEVEL_BLUE if(tmp_alertlevel > SEC_LEVEL_AMBER) tmp_alertlevel = SEC_LEVEL_AMBER //Cannot engage delta with this set_security_level(tmp_alertlevel) + security_level_cd = world.time + 15 SECONDS if(GLOB.security_level != old_level) //Only notify people if an actual change happened var/security_level = get_security_level() diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index 2186e8b49e..5818ba0001 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm @@ -30,6 +30,7 @@ var/interior = "" var/proper_bomb = TRUE //Please var/obj/effect/countdown/nuclearbomb/countdown + var/nuclear_cooldown //used to stop global spam. /obj/machinery/nuclearbomb/Initialize() . = ..() @@ -367,12 +368,16 @@ return timing = !timing if(timing) + if(nuclear_cooldown < world.time) + to_chat(usr, "[src]'s timer protocols are currently on cooldown, please stand by.") + return previous_level = get_security_level() detonation_timer = world.time + (timer_set * 10) for(var/obj/item/pinpointer/nuke/syndicate/S in GLOB.pinpointer_list) S.switch_mode_to(TRACK_INFILTRATOR) countdown.start() set_security_level("delta") + nuclear_cooldown = world.time + 15 SECONDS if(GLOB.war_declared) var/area/A = get_area(src) From a89cd796d45e914314f78b98e6cbf8396b4722d2 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 26 Jan 2020 21:33:36 +0100 Subject: [PATCH 2/4] emergency shuttle console spam limiter. --- code/game/machinery/computer/communications.dm | 4 ++-- .../antagonists/nukeop/equipment/nuclearbomb.dm | 2 +- code/modules/shuttle/emergency.dm | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 17f17e8247..6a36c41997 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -95,7 +95,7 @@ I = pda.id if (I && istype(I)) if(ACCESS_CAPTAIN in I.access) - if(security_level_cd < world.time) + if(security_level_cd > world.time) to_chat(usr, "Security level protocols are currently on cooldown. Please stand by.") return var/old_level = GLOB.security_level @@ -379,7 +379,7 @@ if("ai-announce") make_announcement(usr, 1) if("ai-securitylevel") - if(security_level_cd < world.time) + if(security_level_cd > world.time) to_chat(usr, "Security level protocols are currently on cooldown. Please stand by.") return tmp_alertlevel = text2num( href_list["newalertlevel"] ) diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index 5818ba0001..8d98f24b1e 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm @@ -368,7 +368,7 @@ return timing = !timing if(timing) - if(nuclear_cooldown < world.time) + if(nuclear_cooldown > world.time) to_chat(usr, "[src]'s timer protocols are currently on cooldown, please stand by.") return previous_level = get_security_level() diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index c863e0e44a..96d1c04856 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -2,6 +2,8 @@ #define ENGINES_START_TIME 100 #define ENGINES_STARTED (SSshuttle.emergency.mode == SHUTTLE_IGNITING) #define IS_DOCKED (SSshuttle.emergency.mode == SHUTTLE_DOCKED || (ENGINES_STARTED)) +#define MAX_AUTH_INPUTS 6 + /obj/machinery/computer/emergency_shuttle name = "emergency shuttle console" @@ -10,6 +12,8 @@ icon_keyboard = "tech_key" var/auth_need = 3 var/list/authorized = list() + var/auth_cooldown //these two vars are used to quell spam. + var/auth_combo = 0 /obj/machinery/computer/emergency_shuttle/attackby(obj/item/I, mob/user,params) if(istype(I, /obj/item/card/id)) @@ -67,6 +71,13 @@ to_chat(user, "The access level of your card is not high enough.") return + if(auth_cooldown <= world.time) + auth_combo = 0 + + else if(auth_combo >= MAX_AUTH_INPUTS) + to_chat(user, "Authorizations controller lockdown engaged, please wait [CEILING(auth_coodown - world.time)] before trying again.") + return + var/old_len = authorized.len switch(action) @@ -91,6 +102,10 @@ minor_announce("[remaining] authorizations needed until shuttle is launched early", null, alert) if(repeal) minor_announce("Early launch authorization revoked, [remaining] authorizations needed") + auth_cooldown = world.time + 15 SECONDS + if(++auth_combo = MAX_AUTH_INPUTS) //C-c-combo breaker! + say("Authorization controller abuse detected, lockdown engaged.") + playsound(src, 'sound/machines/buzz-sigh.ogg', 50, 0) /obj/machinery/computer/emergency_shuttle/proc/authorize(mob/user, source) var/obj/item/card/id/ID = user.get_idcard(TRUE) @@ -567,3 +582,4 @@ #undef ENGINES_START_TIME #undef ENGINES_STARTED #undef IS_DOCKED +#undef MAX_AUTH_INPUTS From 9b149244b04bb22a974509348ab00e84d2957bae Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 26 Jan 2020 21:56:31 +0100 Subject: [PATCH 3/4] Ok here we go. --- code/modules/shuttle/emergency.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 96d1c04856..703184320f 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -75,7 +75,7 @@ auth_combo = 0 else if(auth_combo >= MAX_AUTH_INPUTS) - to_chat(user, "Authorizations controller lockdown engaged, please wait [CEILING(auth_coodown - world.time)] before trying again.") + to_chat(user, "Authorizations controller lockdown engaged, please wait [CEILING(auth_coodown - world.time, 1)] before trying again.") return var/old_len = authorized.len @@ -103,7 +103,7 @@ if(repeal) minor_announce("Early launch authorization revoked, [remaining] authorizations needed") auth_cooldown = world.time + 15 SECONDS - if(++auth_combo = MAX_AUTH_INPUTS) //C-c-combo breaker! + if(++auth_combo == MAX_AUTH_INPUTS) //C-c-combo breaker! say("Authorization controller abuse detected, lockdown engaged.") playsound(src, 'sound/machines/buzz-sigh.ogg', 50, 0) From 2adb981832802bebe0f5758e35b80072441801ff Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 26 Jan 2020 22:04:46 +0100 Subject: [PATCH 4/4] Welp. --- code/modules/shuttle/emergency.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 703184320f..abb1373401 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -75,7 +75,7 @@ auth_combo = 0 else if(auth_combo >= MAX_AUTH_INPUTS) - to_chat(user, "Authorizations controller lockdown engaged, please wait [CEILING(auth_coodown - world.time, 1)] before trying again.") + to_chat(user, "Authorizations controller lockdown engaged, please wait [CEILING(auth_cooldown - world.time, 1)] before trying again.") return var/old_len = authorized.len