-
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Admin] Makes the lag switch subsystem work (#22958)
* Lag * Moves the subsystem file * Fixes that one line
- Loading branch information
Showing
10 changed files
with
214 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Data>(context); | ||
const { dead_keyloop, ghost_zoom_tray, runechat, icon2html, observerjobs, slowmodesay, parallax, footsteps } = data; | ||
return ( | ||
<Window title="Lag Switch Panel" width={400} height={270}> | ||
<Window.Content> | ||
<Flex> | ||
<Flex.Item grow={1}> | ||
<Section title="Options" | ||
buttons={ | ||
<> | ||
<Button | ||
color="good" | ||
icon="plus-circle" | ||
content="Enable Everything" | ||
onClick={() => act("enable_all")} /> | ||
<Button | ||
color="bad" | ||
icon="minus-circle" | ||
content="Disable Everything" | ||
onClick={() => act("disable_all")} /> | ||
</> | ||
}> | ||
<Button | ||
fluid | ||
textAlign="center" | ||
color={dead_keyloop ? "good" : "bad"} | ||
icon="ghost" | ||
content="Disable ghost freelook (Staff exempted)" | ||
onClick={() => act("toggle_keyloop")} /> | ||
<Button | ||
fluid | ||
textAlign="center" | ||
color={ghost_zoom_tray ? "good" : "bad"} | ||
icon="magnifying-glass" | ||
content="Disable ghost view/T-ray (Staff exempted)" | ||
onClick={() => act("toggle_zoomtray")} /> | ||
<Button | ||
fluid | ||
textAlign="center" | ||
color={runechat ? "good" : "bad"} | ||
icon="comment" | ||
content="Disable runechat" | ||
onClick={() => act("toggle_runechat")} /> | ||
<Button | ||
fluid | ||
textAlign="center" | ||
color={icon2html ? "good" : "bad"} | ||
icon="image" | ||
content="Disable icon2html" | ||
onClick={() => act("toggle_icon2html")} /> | ||
<Button | ||
fluid | ||
textAlign="center" | ||
color={observerjobs ? "good" : "bad"} | ||
icon="hammer" | ||
content="Prevent new player joining" | ||
onClick={() => act("toggle_observerjobs")} /> | ||
{/* Commented out since we don't have an implementation of this and I haven't figured out an alternative yet | ||
<Button | ||
fluid | ||
textAlign="center" | ||
color={slowmodesay ? "good" : "bad"} | ||
icon="stopwatch" | ||
content="Enable IC/dsay slowmode" | ||
onClick={() => act("toggle_slowmodesay")} /> | ||
*/} | ||
<Button | ||
fluid | ||
textAlign="center" | ||
color={parallax ? "good" : "bad"} | ||
icon="map" | ||
content="Disable parallax" | ||
onClick={() => act("toggle_parallax")} /> | ||
<Button | ||
fluid | ||
textAlign="center" | ||
color={footsteps ? "good" : "bad"} | ||
icon="shoe-prints" | ||
content="Disable footsteps" | ||
onClick={() => act("toggle_footsteps")} /> | ||
</Section> | ||
</Flex.Item> | ||
</Flex> | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters