From e8a4f57bcf1efb0cffb5dca3f655ac3b58764e19 Mon Sep 17 00:00:00 2001 From: Atlantis Date: Sun, 3 Apr 2016 14:57:11 +0200 Subject: [PATCH] Adds full atmospherics reset admin verb - Adds "Fix Atmospheric Problems" verb, that is accessible to server admins. - This verb will perform full reset of atmosphere. Unlike reboot-zas this fixes any possible griefs or bugs, by completely purging all existing gases and resetting them to roundstart values. --- code/modules/admin/admin_verbs.dm | 3 +- code/modules/admin/verbs/grief_fixers.dm | 54 ++++++++++++++++++++++++ polaris.dme | 1 + 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 code/modules/admin/verbs/grief_fixers.dm diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 9643096d8f..78aca1da78 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -94,7 +94,8 @@ var/list/admin_verbs_admin = list( /client/proc/makePAI, /client/proc/toggle_debug_logs, /client/proc/toggle_attack_logs, - /datum/admins/proc/paralyze_mob + /datum/admins/proc/paralyze_mob, + /client/proc/fixatmos ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, diff --git a/code/modules/admin/verbs/grief_fixers.dm b/code/modules/admin/verbs/grief_fixers.dm new file mode 100644 index 0000000000..dd28127e4a --- /dev/null +++ b/code/modules/admin/verbs/grief_fixers.dm @@ -0,0 +1,54 @@ +/client/proc/fixatmos() + set category = "Admin" + set name = "Fix Atmospherics Grief" + + if(!check_rights(R_ADMIN|R_DEBUG)) return + + + if(alert("WARNING: Executing this command will perform a full reset of atmosphere. All pipelines will lose any gas that may be in them, and all zones will be reset to contain air mix as on roundstart. The supermatter engine will also be stopped (to prevent overheat due to removal of coolant). Do not use unless the station is suffering serious atmospheric issues due to grief or bug.", "Full Atmosphere Reboot", "No", "Yes") == "No") + return + feedback_add_details("admin_verb","FA") + + log_and_message_admins("Full atmosphere reset initiated by [usr].") + world << "Initiating restart of atmosphere. The server may lag a bit." + sleep(10) + var/current_time = world.timeofday + + // Depower the supermatter, as it would quickly blow up once we remove all gases from the pipes. + for(var/obj/machinery/power/supermatter/S in machines) + S.power = 0 + usr << "\[1/5\] - Supermatter depowered" + + // Remove all gases from all pipenets + for(var/datum/pipe_network/PN in pipe_networks) + for(var/datum/gas_mixture/G in PN.gases) + G.gas = list() + G.update_values() + + usr << "\[2/5\] - All pipenets purged of gas." + + // Delete all zones. + for(var/zone/Z in world) + Z.c_invalidate() + + usr << "\[3/5\] - All ZAS Zones removed." + + var/list/unsorted_overlays = list() + for(var/id in gas_data.tile_overlay) + unsorted_overlays |= gas_data.tile_overlay[id] + + + for(var/turf/simulated/T in world) + T.air = null + T.overlays.Remove(unsorted_overlays) + T.zone = null + + usr << "\[4/5\] - All turfs reset to roundstart values." + + qdel(air_master) + air_master = new + air_master.Setup() + spawn air_master.Start() + + usr << "\[5/5\] - ZAS Rebooted" + world << "Atmosphere restart completed in [(world.timeofday - current_time)/10] seconds." \ No newline at end of file diff --git a/polaris.dme b/polaris.dme index 0bd1eab3c8..871fddeff9 100644 --- a/polaris.dme +++ b/polaris.dme @@ -926,6 +926,7 @@ #include "code\modules\admin\verbs\diagnostics.dm" #include "code\modules\admin\verbs\dice.dm" #include "code\modules\admin\verbs\getlogs.dm" +#include "code\modules\admin\verbs\grief_fixers.dm" #include "code\modules\admin\verbs\mapping.dm" #include "code\modules\admin\verbs\massmodvar.dm" #include "code\modules\admin\verbs\modifyvariables.dm"