mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 10:42:37 +00:00
## About The Pull Request I've seen a few cases in the past where LateInitialize is done cause of the init return value being set to do so for no real reason, I thought I should try to avoid that by ensuring LateInitialize isn't ever called without overriding. This fixes a ton of machine's LateInitialize not calling parent (mechpad, door buttons, message monitor, a lot of tram machines, abductor console, holodeck computer & disposal bin), avoiding having to set itself up to be connected to power. If they were intended to not connect to power, they should be using ``NO_POWER_USE`` instead. Also removes a ton of returns to LateInit when it's already getting it from parent regardless (many cases of that in machine code). ## Why It's Good For The Game I think this is better for coding standard reasons as well as just making sure we're not calling this proc on things that does absolutely nothing with them. A machine not using power can be seen evidently not using power with ``NO_POWER_USE``, not so much if it's LateInitialize not calling parent. ## Changelog 🆑 fix: Mech pads, door buttons, message monitors, tram machines, abductor consoles & holodeck computers now use power. /🆑
86 lines
2.8 KiB
Plaintext
86 lines
2.8 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/post_machine_initialize()
|
|
. = ..()
|
|
if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research)
|
|
CONNECT_TO_RND_SERVER_ROUNDSTART(stored_research, src)
|
|
|
|
/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, obj/item/card/emag/emag_card)
|
|
if(obj_flags & EMAGGED)
|
|
return FALSE
|
|
obj_flags |= EMAGGED
|
|
playsound(src, SFX_SPARKS, 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
|
|
balloon_alert(user, "console emagged")
|
|
return TRUE
|
|
|
|
/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
|