diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 773eab6e1cee..08af487a78c2 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -1109,7 +1109,10 @@ GLOBAL_DATUM_INIT(dummySave, /savefile, new("tmp/dummySave.sav")) //Cache of ico var/key var/icon/I = thing + var/mob/target_mob = target + if(SSlag_switch.measures[DISABLE_USR_ICON2HTML] && !HAS_TRAIT(target_mob, TRAIT_BYPASS_MEASURES)) + return if (!target) return if (target == world) diff --git a/code/controllers/lag_switch.dm b/code/controllers/subsystem/lag_switch.dm similarity index 83% rename from code/controllers/lag_switch.dm rename to code/controllers/subsystem/lag_switch.dm index c79db0518601..69b740b8dabf 100644 --- a/code/controllers/lag_switch.dm +++ b/code/controllers/subsystem/lag_switch.dm @@ -91,7 +91,7 @@ SUBSYSTEM_DEF(lag_switch) for(var/mob/user as anything in GLOB.player_list) if(user.stat == DEAD && !user.client?.holder) GLOB.keyloop_list -= user - deadchat_broadcast(span_big("To increase performance Observer freelook is now disabled. Please use Orbit, Teleport, and Jump to look around."), message_type = DEADCHAT_ANNOUNCEMENT) + deadchat_broadcast(span_big("To increase performance, Observer freelook is now disabled. Please use Orbit, Teleport, and Jump to look around."), message_type = DEADCHAT_ANNOUNCEMENT) else GLOB.keyloop_list |= GLOB.player_list deadchat_broadcast("Observer freelook has been re-enabled. Enjoy your wooshing.", message_type = DEADCHAT_ANNOUNCEMENT) @@ -102,6 +102,24 @@ SUBSYSTEM_DEF(lag_switch) continue if(!ghost.client.holder && ghost.client.view_size.getView() != ghost.client.view_size.default) ghost.client.view_size.resetToDefault() + deadchat_broadcast(span_big("To increase performance, Observer custom view range/T-ray views are now disabled."), message_type = DEADCHAT_ANNOUNCEMENT) + else + deadchat_broadcast("Observer custom view range/T-ray views are now re-enabled. Enjoy your wooshing.", message_type = DEADCHAT_ANNOUNCEMENT) + if(DISABLE_RUNECHAT) + if(state) + to_chat(world, span_boldannounce("Runechat has been disabled for performance concerns.")) + else + to_chat(world, span_boldannounce("Runechat has been re-enabled.")) + if(DISABLE_USR_ICON2HTML) + if(state) + to_chat(world, span_boldannounce("Icon2html has been disabled for performance concerns.")) + else + to_chat(world, span_boldannounce("Icon2html has been re-enabled.")) + if(DISABLE_NON_OBSJOBS) + var/datum/admins/holder = new(usr) + holder.toggleenter() //This does the same thing, no need for duplicate proc + world.update_status() + /* Commented out since we don't have an implementation of this and I haven't figured out an alternative yet if(SLOWMODE_SAY) if(state) to_chat(world, span_boldannounce("Slowmode for IC/dead chat has been enabled with [slowmode_cooldown/10] seconds between messages.")) @@ -109,8 +127,7 @@ SUBSYSTEM_DEF(lag_switch) for(var/client/C as anything in GLOB.clients) COOLDOWN_RESET(C, say_slowmode) to_chat(world, span_boldannounce("Slowmode for IC/dead chat has been disabled by an admin.")) - if(DISABLE_NON_OBSJOBS) - world.update_status() + */ if(DISABLE_PARALLAX) if (state) to_chat(world, span_boldannounce("Parallax has been disabled for performance concerns.")) diff --git a/code/datums/chatmessage.dm b/code/datums/chatmessage.dm index 6b3e37c2d5be..5392b5bf5f04 100644 --- a/code/datums/chatmessage.dm +++ b/code/datums/chatmessage.dm @@ -70,7 +70,8 @@ stack_trace("/datum/chatmessage created with [isnull(owner) ? "null" : "invalid"] mob owner") qdel(src) return - INVOKE_ASYNC(src, PROC_REF(generate_image), text, target, owner, language, extra_classes, lifespan) + if(!SSlag_switch.measures[DISABLE_RUNECHAT] && !HAS_TRAIT(owner, TRAIT_BYPASS_MEASURES)) + INVOKE_ASYNC(src, PROC_REF(generate_image), text, target, owner, language, extra_classes, lifespan) /datum/chatmessage/Destroy() if (owned_by) diff --git a/code/datums/elements/footstep.dm b/code/datums/elements/footstep.dm index 6f966e3790e6..ab5be21a27a5 100644 --- a/code/datums/elements/footstep.dm +++ b/code/datums/elements/footstep.dm @@ -69,6 +69,9 @@ ///Prepares a footstep for living mobs. Determines if it should get played. Returns the turf it should get played on. Note that it is always a /turf/open /datum/element/footstep/proc/prepare_step(mob/living/source) var/turf/open/turf = get_turf(source) + if(SSlag_switch.measures[DISABLE_FOOTSTEPS] && !HAS_TRAIT(source, TRAIT_BYPASS_MEASURES)) + return + if(!istype(turf)) return diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index dbc2b46833df..ec9d6b3ae73c 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -159,7 +159,8 @@ GLOBAL_PROTECT(admin_verbs_server) /client/proc/mentor_memo, // YOGS - something stupid about "Mentor memos" /client/proc/release_queue, // Yogs -- Adds some queue-manipulation verbs /client/proc/toggle_cdn, - /client/proc/set_next_minetype + /client/proc/set_next_minetype, + /client/proc/lag_switch_panel ) GLOBAL_LIST_INIT(admin_verbs_debug, world.AVerbsDebug()) GLOBAL_PROTECT(admin_verbs_debug) diff --git a/code/modules/admin/verbs/lag_switch.dm b/code/modules/admin/verbs/lag_switch.dm new file mode 100644 index 000000000000..2a3a627c9064 --- /dev/null +++ b/code/modules/admin/verbs/lag_switch.dm @@ -0,0 +1,69 @@ +/client/proc/lag_switch_panel() + set name = "Lag Switch Panel" + set category = "Server" + if(!check_rights(R_SERVER)) + return + var/datum/lag_switch_menu/tgui = new(usr) + tgui.ui_interact(usr) + +/datum/lag_switch_menu + var/client/holder + +/datum/lag_switch_menu/New(user) + if(istype(user, /client)) + var/client/user_client = user + holder = user_client + else + var/mob/user_mob = user + holder = user_mob.client + +/datum/lag_switch_menu/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "LagSwitchPanel") + ui.open() + ui.set_autoupdate(TRUE) + +/datum/lag_switch_menu/ui_state(mob/user) + return GLOB.admin_state + +/datum/lag_switch_menu/ui_close() + qdel(src) + +/datum/lag_switch_menu/ui_data(mob/user) + var/list/data = list() + data["dead_keyloop"] = SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] + data["ghost_zoom_tray"] = SSlag_switch.measures[DISABLE_GHOST_ZOOM_TRAY] + data["runechat"] = SSlag_switch.measures[DISABLE_RUNECHAT] + data["icon2html"] = SSlag_switch.measures[DISABLE_USR_ICON2HTML] + data["observerjobs"] = SSlag_switch.measures[DISABLE_NON_OBSJOBS] + data["slowmodesay"] = SSlag_switch.measures[SLOWMODE_SAY] + data["parallax"] = SSlag_switch.measures[DISABLE_PARALLAX] + data["footsteps"] = SSlag_switch.measures[DISABLE_FOOTSTEPS] + return data + +/datum/lag_switch_menu/ui_act(action, list/params) + . = ..() + if(.) + return + switch(action) + if("toggle_keyloop") + SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] ? SSlag_switch.set_measure(DISABLE_DEAD_KEYLOOP, 0) : SSlag_switch.set_measure(DISABLE_DEAD_KEYLOOP, 1) + if("toggle_zoomtray") + SSlag_switch.measures[DISABLE_GHOST_ZOOM_TRAY] ? SSlag_switch.set_measure(DISABLE_GHOST_ZOOM_TRAY, 0) : SSlag_switch.set_measure(DISABLE_GHOST_ZOOM_TRAY, 1) + if("toggle_runechat") + SSlag_switch.measures[DISABLE_RUNECHAT] ? SSlag_switch.set_measure(DISABLE_RUNECHAT, 0) : SSlag_switch.set_measure(DISABLE_RUNECHAT, 1) + if("toggle_icon2html") + SSlag_switch.measures[DISABLE_USR_ICON2HTML] ? SSlag_switch.set_measure(DISABLE_USR_ICON2HTML, 0) : SSlag_switch.set_measure(DISABLE_USR_ICON2HTML, 1) + if("toggle_observerjobs") + SSlag_switch.measures[DISABLE_NON_OBSJOBS] ? SSlag_switch.set_measure(DISABLE_NON_OBSJOBS, 0) : SSlag_switch.set_measure(DISABLE_NON_OBSJOBS, 1) + if("toggle_slowmodesay") + SSlag_switch.measures[SLOWMODE_SAY] ? SSlag_switch.set_measure(SLOWMODE_SAY, 0) : SSlag_switch.set_measure(SLOWMODE_SAY, 1) + if("toggle_parallax") + SSlag_switch.measures[DISABLE_PARALLAX] ? SSlag_switch.set_measure(DISABLE_PARALLAX, 0) : SSlag_switch.set_measure(DISABLE_PARALLAX, 1) + if("toggle_footsteps") + SSlag_switch.measures[DISABLE_FOOTSTEPS] ? SSlag_switch.set_measure(DISABLE_FOOTSTEPS, 0) : SSlag_switch.set_measure(DISABLE_FOOTSTEPS, 1) + if("enable_all") + SSlag_switch.set_all_measures(1) + if("disable_all") + SSlag_switch.set_all_measures(0) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 816eaa95966f..6e3cdacd213c 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -509,8 +509,11 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "View Range" set desc = "Change your view range." + if(SSlag_switch.measures[DISABLE_GHOST_ZOOM_TRAY] && !is_admin(usr)) + to_chat(usr, span_warning("Observer view range is disabled due to performance concerns.")) + return //yogs start -- Divert this verb to the admin variant if this guy has it - if(check_rights(R_ADMIN,FALSE) && hascall(usr.client,"toggle_view_range")) + if(is_admin(usr) && hascall(usr.client,"toggle_view_range")) call(usr.client,"toggle_view_range")() return //yogs end @@ -993,6 +996,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set category = "Ghost" set name = "T-ray view" set desc = "Toggles a view of sub-floor objects" + if(SSlag_switch.measures[DISABLE_GHOST_ZOOM_TRAY] && !is_admin(usr)) + to_chat(usr, span_warning("Observer T-ray view is disabled due to performance concerns.")) + return var/static/t_ray_view = FALSE t_ray_view = !t_ray_view diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 7ed71daf9af1..990e71572c42 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -93,6 +93,8 @@ return FALSE //This is sota the goto stop mobs from moving var if(mob.control_object) return Move_object(direct) + if(mob.stat == DEAD && (SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] && !is_admin(mob))) + return FALSE if(!isliving(mob)) return mob.Move(n, direct) if(mob.stat == DEAD) diff --git a/tgui/packages/tgui/interfaces/LagSwitchPanel.tsx b/tgui/packages/tgui/interfaces/LagSwitchPanel.tsx new file mode 100644 index 000000000000..69533344f7bb --- /dev/null +++ b/tgui/packages/tgui/interfaces/LagSwitchPanel.tsx @@ -0,0 +1,104 @@ +import { useBackend } from "../backend"; +import { Button, Flex, Section } from "../components"; +import { Window } from "../layouts"; + +type Data = { + dead_keyloop: boolean; + ghost_zoom_tray: boolean; + runechat: boolean; + icon2html: boolean; + observerjobs: boolean; + slowmodesay: boolean; + parallax: boolean; + footsteps: boolean; +} + +/* Credit to Xoxeyos who ported a port of the Ghost Pool Protection interface (PR #11139), which this follows the same design for the most part. */ +export const LagSwitchPanel = (props, context) => { + const { act, data } = useBackend(context); + const { dead_keyloop, ghost_zoom_tray, runechat, icon2html, observerjobs, slowmodesay, parallax, footsteps } = data; + return ( + + + + +
+
+
+
+
+
+ ); +}; diff --git a/yogstation.dme b/yogstation.dme index 113f1e959402..fed4c5870a9e 100644 --- a/yogstation.dme +++ b/yogstation.dme @@ -404,7 +404,6 @@ #include "code\controllers\controller.dm" #include "code\controllers\failsafe.dm" #include "code\controllers\globals.dm" -#include "code\controllers\lag_switch.dm" #include "code\controllers\master.dm" #include "code\controllers\subsystem.dm" #include "code\controllers\configuration\config_entry.dm" @@ -447,6 +446,7 @@ #include "code\controllers\subsystem\input.dm" #include "code\controllers\subsystem\ipintel.dm" #include "code\controllers\subsystem\job.dm" +#include "code\controllers\subsystem\lag_switch.dm" #include "code\controllers\subsystem\language.dm" #include "code\controllers\subsystem\lighting.dm" #include "code\controllers\subsystem\machines.dm" @@ -1716,6 +1716,7 @@ #include "code\modules\admin\verbs\ghost_pool_protection.dm" #include "code\modules\admin\verbs\hiddenprints.dm" #include "code\modules\admin\verbs\individual_logging.dm" +#include "code\modules\admin\verbs\lag_switch.dm" #include "code\modules\admin\verbs\machine_upgrade.dm" #include "code\modules\admin\verbs\manipulate_organs.dm" #include "code\modules\admin\verbs\map_template_loadverb.dm"