|
| 1 | +/client/proc/lag_switch_panel() |
| 2 | + set name = "Lag Switch Panel" |
| 3 | + set category = "Server" |
| 4 | + if(!check_rights(R_SERVER)) |
| 5 | + return |
| 6 | + var/datum/lag_switch_menu/tgui = new(usr) |
| 7 | + tgui.ui_interact(usr) |
| 8 | + |
| 9 | +/datum/lag_switch_menu |
| 10 | + var/client/holder |
| 11 | + |
| 12 | +/datum/lag_switch_menu/New(user) |
| 13 | + if(istype(user, /client)) |
| 14 | + var/client/user_client = user |
| 15 | + holder = user_client |
| 16 | + else |
| 17 | + var/mob/user_mob = user |
| 18 | + holder = user_mob.client |
| 19 | + |
| 20 | +/datum/lag_switch_menu/ui_interact(mob/user, datum/tgui/ui) |
| 21 | + ui = SStgui.try_update_ui(user, src, ui) |
| 22 | + if(!ui) |
| 23 | + ui = new(user, src, "LagSwitchPanel") |
| 24 | + ui.open() |
| 25 | + ui.set_autoupdate(TRUE) |
| 26 | + |
| 27 | +/datum/lag_switch_menu/ui_state(mob/user) |
| 28 | + return GLOB.admin_state |
| 29 | + |
| 30 | +/datum/lag_switch_menu/ui_close() |
| 31 | + qdel(src) |
| 32 | + |
| 33 | +/datum/lag_switch_menu/ui_data(mob/user) |
| 34 | + var/list/data = list() |
| 35 | + data["dead_keyloop"] = SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] |
| 36 | + data["ghost_zoom_tray"] = SSlag_switch.measures[DISABLE_GHOST_ZOOM_TRAY] |
| 37 | + data["runechat"] = SSlag_switch.measures[DISABLE_RUNECHAT] |
| 38 | + data["icon2html"] = SSlag_switch.measures[DISABLE_USR_ICON2HTML] |
| 39 | + data["observerjobs"] = SSlag_switch.measures[DISABLE_NON_OBSJOBS] |
| 40 | + data["slowmodesay"] = SSlag_switch.measures[SLOWMODE_SAY] |
| 41 | + data["parallax"] = SSlag_switch.measures[DISABLE_PARALLAX] |
| 42 | + data["footsteps"] = SSlag_switch.measures[DISABLE_FOOTSTEPS] |
| 43 | + return data |
| 44 | + |
| 45 | +/datum/lag_switch_menu/ui_act(action, list/params) |
| 46 | + . = ..() |
| 47 | + if(.) |
| 48 | + return |
| 49 | + switch(action) |
| 50 | + if("toggle_keyloop") |
| 51 | + SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] ? SSlag_switch.set_measure(DISABLE_DEAD_KEYLOOP, 0) : SSlag_switch.set_measure(DISABLE_DEAD_KEYLOOP, 1) |
| 52 | + if("toggle_zoomtray") |
| 53 | + 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) |
| 54 | + if("toggle_runechat") |
| 55 | + SSlag_switch.measures[DISABLE_RUNECHAT] ? SSlag_switch.set_measure(DISABLE_RUNECHAT, 0) : SSlag_switch.set_measure(DISABLE_RUNECHAT, 1) |
| 56 | + if("toggle_icon2html") |
| 57 | + SSlag_switch.measures[DISABLE_USR_ICON2HTML] ? SSlag_switch.set_measure(DISABLE_USR_ICON2HTML, 0) : SSlag_switch.set_measure(DISABLE_USR_ICON2HTML, 1) |
| 58 | + if("toggle_observerjobs") |
| 59 | + SSlag_switch.measures[DISABLE_NON_OBSJOBS] ? SSlag_switch.set_measure(DISABLE_NON_OBSJOBS, 0) : SSlag_switch.set_measure(DISABLE_NON_OBSJOBS, 1) |
| 60 | + if("toggle_slowmodesay") |
| 61 | + SSlag_switch.measures[SLOWMODE_SAY] ? SSlag_switch.set_measure(SLOWMODE_SAY, 0) : SSlag_switch.set_measure(SLOWMODE_SAY, 1) |
| 62 | + if("toggle_parallax") |
| 63 | + SSlag_switch.measures[DISABLE_PARALLAX] ? SSlag_switch.set_measure(DISABLE_PARALLAX, 0) : SSlag_switch.set_measure(DISABLE_PARALLAX, 1) |
| 64 | + if("toggle_footsteps") |
| 65 | + SSlag_switch.measures[DISABLE_FOOTSTEPS] ? SSlag_switch.set_measure(DISABLE_FOOTSTEPS, 0) : SSlag_switch.set_measure(DISABLE_FOOTSTEPS, 1) |
| 66 | + if("enable_all") |
| 67 | + SSlag_switch.set_all_measures(1) |
| 68 | + if("disable_all") |
| 69 | + SSlag_switch.set_all_measures(0) |
0 commit comments