From 6f3110757597ac32d6f3dd9c3285fb2a0e57c501 Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Fri, 16 Sep 2016 00:37:28 -0400 Subject: [PATCH] Fun Preservation Circuits Adds a cooldown to the manual reboot command, to prevent anti-fun comdoms from endlessly rebooting to lock crew out of the game. In the event of the game server being knocked offline, the manual reboot can be used even if it was on cooldown from a previous restart. This still initiates a fresh cooldown. --- code/game/machinery/computer/communications.dm | 14 ++++++++------ code/modules/arcade/mob_hunt/game_server.dm | 7 +++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index adce79343b2..f1b13b65628 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -275,13 +275,15 @@ if("RestartNanoMob") if(mob_hunt_server) - var/loading_msg = pick("Respawning spawns", "Reticulating splines", "Flipping hat", - "Capturing all of them", "Fixing minor text issues", "Being the very best", - "Nerfing this", "Not communicating with playerbase", "Coding a ripoff in a 2D spaceman game") - to_chat(usr, "Restarting Nano-Mob Hunter GO! game server. [loading_msg]...") - mob_hunt_server.manual_reboot() + if(mob_hunt_server.manual_reboot()) + var/loading_msg = pick("Respawning spawns", "Reticulating splines", "Flipping hat", + "Capturing all of them", "Fixing minor text issues", "Being the very best", + "Nerfing this", "Not communicating with playerbase", "Coding a ripoff in a 2D spaceman game") + to_chat(usr, "Restarting Nano-Mob Hunter GO! game server. [loading_msg]...") + else + to_chat(usr, "Nano-Mob Hunter GO! game server reboot failed due to recent restart. Please wait before re-attempting.") else - to_chat(usr, "Nano-Mob Hunter GO! game server is offline for extended maintenance. Contact your Central Command administrators for more info if desired.") + to_chat(usr, "Nano-Mob Hunter GO! game server is offline for extended maintenance. Contact your Central Command administrators for more info if desired.") if("AcceptDocking") to_chat(usr, "Docking request accepted!") diff --git a/code/modules/arcade/mob_hunt/game_server.dm b/code/modules/arcade/mob_hunt/game_server.dm index 7058eb5f575..3ad04e5a9f9 100644 --- a/code/modules/arcade/mob_hunt/game_server.dm +++ b/code/modules/arcade/mob_hunt/game_server.dm @@ -7,6 +7,7 @@ var/global/datum/controller/process/mob_hunt/mob_hunt_server var/list/trap_spawns = list() var/list/connected_clients = list() var/server_status = 1 //1 is online, 0 is offline + var/reset_cooldown = 0 //number of controller cycles before the manual_reboot proc can be used again (ignored if server is offline so you can always boot back up) /datum/controller/process/mob_hunt/setup() name = "Nano-Mob Hunter GO Server" @@ -21,6 +22,8 @@ var/global/datum/controller/process/mob_hunt/mob_hunt_server return ..() /datum/controller/process/mob_hunt/doWork() + if(reset_cooldown) //if reset_cooldown is set (we are on cooldown, duh), reduce the remaining cooldown every cycle + reset_cooldown-- if(server_status == 0) return client_mob_update() @@ -66,11 +69,15 @@ var/global/datum/controller/process/mob_hunt/mob_hunt_server spawn_mob() /datum/controller/process/mob_hunt/proc/manual_reboot() + if(server_status && reset_cooldown) + return 0 for(var/obj/effect/nanomob/N in trap_spawns) N.despawn() for(var/obj/effect/nanomob/N in normal_spawns) N.despawn() server_status = 1 + reset_cooldown = 25 //25 controller cycle cooldown for manual restarts + return 1 /datum/controller/process/mob_hunt/proc/spawn_mob() var/list/nanomob_types = subtypesof(/datum/mob_hunt)