Files
Bubberstation/code/modules/research/server_control.dm
coldud13 53293cfb53 [MANUAL MIRROR] R&D Monitoring console TGUI + Can see RD consoles (#72987) (#21131)
R&D Monitoring console TGUI + Can see RD consoles (#72987)

## About The Pull Request

I wrote this while constantly rushing lol

This PR does many things, the largest is that the R&D Monitoring console
(the RD's one) is now TGUI
It also changes how researching loggings work, bringing the RD console
and NtosRD app on par with eachother

The type of person is also logged differently, instead of ``Cyborg:
[name]`` and ``User: [name]``, humans do not have a prefix and cyborgs
will say ``CYBORG [name]``. ``research_logs`` also works differently now
to make it easier to reference each needed data from the list.

Lastly, I added the ability to see R&D consoles from the console, and
the ability to remotely un/lock them down. This currently is pretty
useless as it can't control the tablet app variant, and anyone with
Science access can just unlock it, however with some minor future
changes I think this can be turned into a good way for the RD to get
control of their department.

Video demonstration, mostly (I made a few edits after this):

https://user-images.githubusercontent.com/53777086/215005387-817106f4-5237-4f2e-b0ac-da28e6a17f9c.mp4

## Why It's Good For The Game

This console is overhyped by the game, being hidden behind an RD-locked
Command-colored door, in the same room as one of the most damaging theft
objectives, yet it is one of the most useless and forgotten consoles in
R&D if you don't count everything outside of researching, experiments
and robotics.

This adds a nice TGUI menu while making it a little more worthwhile to
use.

## Changelog

🆑
balance: The R&D monitoring console now shows R&D consoles and their
locations.
refactor: The R&D monitoring console now has a nice TGUI menu.
/🆑

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
2023-05-15 16:45:30 +01:00

85 lines
2.7 KiB
Plaintext

/obj/machinery/computer/rdservercontrol
name = "R&D Server Controller"
desc = "Manages access to research databases and consoles."
icon_screen = "rdcomp"
icon_keyboard = "rd_key"
circuit = /obj/item/circuitboard/computer/rdservercontrol
req_access = list(ACCESS_RD)
///Connected techweb node the server is connected to.
var/datum/techweb/stored_research
/obj/machinery/computer/rdservercontrol/Initialize(mapload, obj/item/circuitboard/C)
. = ..()
if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research)
stored_research = SSresearch.science_tech
/obj/machinery/computer/rdservercontrol/multitool_act(mob/living/user, obj/item/multitool/tool)
if(!QDELETED(tool.buffer) && istype(tool.buffer, /datum/techweb))
stored_research = tool.buffer
balloon_alert(user, "techweb connected")
return TRUE
/obj/machinery/computer/rdservercontrol/emag_act(mob/user)
if(obj_flags & EMAGGED)
return
obj_flags |= EMAGGED
playsound(src, SFX_SPARKS, 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
balloon_alert(user, "console emagged")
/obj/machinery/computer/rdservercontrol/ui_interact(mob/user, datum/tgui/ui)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "ServerControl", name)
ui.open()
/obj/machinery/computer/rdservercontrol/ui_data(mob/user)
var/list/data = list()
data["server_connected"] = !!stored_research
if(stored_research)
data["logs"] += stored_research.research_logs
for(var/obj/machinery/rnd/server/server as anything in stored_research.techweb_servers)
data["servers"] += list(list(
"server_name" = server,
"server_details" = server.get_status_text(),
"server_disabled" = server.research_disabled,
"server_ref" = REF(server),
))
for(var/obj/machinery/computer/rdconsole/console as anything in stored_research.consoles_accessing)
data["consoles"] += list(list(
"console_name" = console,
"console_location" = get_area(console),
"console_locked" = console.locked,
"console_ref" = REF(console),
))
return data
/obj/machinery/computer/rdservercontrol/ui_act(action, params)
. = ..()
if(.)
return TRUE
if(!allowed(usr) && !(obj_flags & EMAGGED))
balloon_alert(usr, "access denied!")
playsound(src, 'sound/machines/click.ogg', 20, TRUE)
return TRUE
switch(action)
if("lockdown_server")
var/obj/machinery/rnd/server/server_selected = locate(params["selected_server"]) in stored_research.techweb_servers
if(!server_selected)
return FALSE
server_selected.toggle_disable(usr)
return TRUE
if("lock_console")
var/obj/machinery/computer/rdconsole/console_selected = locate(params["selected_console"]) in stored_research.consoles_accessing
if(!console_selected)
return FALSE
console_selected.locked = !console_selected.locked
return TRUE