From 5502f80e0705ac686213b00f458d723dc8ece55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Barou=C5=A1?= Date: Sat, 7 Nov 2020 15:29:04 +0100 Subject: [PATCH] Removes dead code related to Exosuit Monitoring and Control NanoUI program (#10441) --- aurorastation.dme | 2 - code/__defines/lists.dm | 4 +- code/datums/helper_datums/events.dm | 65 ------------------- code/datums/helper_datums/teleport.dm | 2 +- code/datums/helper_datums/topic_input.dm | 60 ----------------- .../programs/research/exosuit_monitor.dm | 12 ---- code/modules/nano/modules/exosuit_control.dm | 56 ---------------- 7 files changed, 2 insertions(+), 199 deletions(-) delete mode 100644 code/datums/helper_datums/events.dm delete mode 100644 code/datums/helper_datums/topic_input.dm delete mode 100644 code/modules/modular_computers/file_system/programs/research/exosuit_monitor.dm delete mode 100644 code/modules/nano/modules/exosuit_control.dm diff --git a/aurorastation.dme b/aurorastation.dme index 3fc3d4c728c..3978423e3c0 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -295,11 +295,9 @@ #include "code\datums\ert\tcfl.dm" #include "code\datums\helper_datums\away_mission.dm" #include "code\datums\helper_datums\construction_datum.dm" -#include "code\datums\helper_datums\events.dm" #include "code\datums\helper_datums\getrev.dm" #include "code\datums\helper_datums\synthsprites.dm" #include "code\datums\helper_datums\teleport.dm" -#include "code\datums\helper_datums\topic_input.dm" #include "code\datums\looping_sounds\_looping_sound.dm" #include "code\datums\looping_sounds\machinery_sounds.dm" #include "code\datums\observation\_debug.dm" diff --git a/code/__defines/lists.dm b/code/__defines/lists.dm index 640fa6be8fd..0fd4677eb3f 100644 --- a/code/__defines/lists.dm +++ b/code/__defines/lists.dm @@ -13,8 +13,6 @@ // Shims for some list procs in lists.dm. #define isemptylist(L) (!LAZYLEN(L)) -#define safepick(L) LAZYPICK(L,null) -#define listgetindex(L,I) LAZYACCESS(L,I) // binary search sorted insert // IN: Object to be inserted @@ -42,4 +40,4 @@ __BIN_ITEM = LIST[__BIN_MID];\ __BIN_MID = __BIN_ITEM.##COMPARE > IN.##COMPARE ? __BIN_MID : __BIN_MID + 1;\ LIST.Insert(__BIN_MID, IN);\ - } \ No newline at end of file + } diff --git a/code/datums/helper_datums/events.dm b/code/datums/helper_datums/events.dm deleted file mode 100644 index 475a2bb260d..00000000000 --- a/code/datums/helper_datums/events.dm +++ /dev/null @@ -1,65 +0,0 @@ -/* - * WARRANTY VOID IF CODE USED - */ - - -/datum/mecha_events - var/list/events - - New() - ..() - events = new - - proc/addEventType(event_type as text) - if(!(event_type in events) || !islist(events[event_type])) - events[event_type] = list() - return 1 - return - - - // Arguments: event_type as text, proc_holder as datum, proc_name as text - // Returns: New event, null on error. - proc/addEvent(event_type as text, proc_holder, proc_name as text) - if(!event_type || !proc_holder || !proc_name) - return - addEventType(event_type) - var/list/event = events[event_type] - var/datum/mecha_event/E = new /datum/mecha_event(proc_holder,proc_name) - event += E - return E - - // Arguments: event_type as text, any number of additional arguments to pass to event handler - // Returns: null - proc/fireEvent() - var/list/event = listgetindex(events,args[1]) - if(istype(event)) - spawn(-1) - for(var/datum/mecha_event/E in event) - if(!E.Fire(arglist(args.Copy(2)))) - clearEvent(args[1],E) - return - - // Arguments: event_type as text, E as /datum/mecha_event - // Returns: 1 if event cleared, null on error - proc/clearEvent(event_type as text, datum/event/E) - if(!event_type || !E) - return - var/list/event = listgetindex(events,event_type) - event -= E - return 1 - - -/datum/mecha_event - var/listener - var/proc_name - - New(tlistener,tprocname) - listener = tlistener - proc_name = tprocname - return ..() - - proc/Fire() - if(listener) - call(listener,proc_name)(arglist(args)) - return 1 - return diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index b273a698a83..1fb46e03890 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -127,7 +127,7 @@ var/area/destarea = get_area(destination) if(precision) var/list/posturfs = circlerangeturfs(destination,precision) - destturf = safepick(posturfs) + destturf = LAZYPICK(posturfs, null) else destturf = get_turf(destination) diff --git a/code/datums/helper_datums/topic_input.dm b/code/datums/helper_datums/topic_input.dm deleted file mode 100644 index c08ca754be4..00000000000 --- a/code/datums/helper_datums/topic_input.dm +++ /dev/null @@ -1,60 +0,0 @@ -/datum/topic_input - var/href - var/list/href_list - - New(thref,list/thref_list) - href = thref - href_list = thref_list.Copy() - return - - proc/get(i) - return listgetindex(href_list,i) - - proc/getAndLocate(i) - var/t = get(i) - if(t) - t = locate(t) - return t || null - - proc/getNum(i) - var/t = get(i) - if(t) - t = text2num(t) - return isnum(t) ? t : null - - proc/getObj(i) - var/t = getAndLocate(i) - return isobj(t) ? t : null - - proc/getMob(i) - var/t = getAndLocate(i) - return ismob(t) ? t : null - - proc/getTurf(i) - var/t = getAndLocate(i) - return isturf(t) ? t : null - - proc/getAtom(i) - return getType(i,/atom) - - proc/getArea(i) - var/t = getAndLocate(i) - return isarea(t) ? t : null - - proc/getStr(i)//params should always be text, but... - var/t = get(i) - return istext(t) ? t : null - - proc/getType(i,type) - var/t = getAndLocate(i) - return istype(t,type) ? t : null - - proc/getPath(i) - var/t = get(i) - if(t) - t = text2path(t) - return ispath(t) ? t : null - - proc/getList(i) - var/t = getAndLocate(i) - return islist(t) ? t : null \ No newline at end of file diff --git a/code/modules/modular_computers/file_system/programs/research/exosuit_monitor.dm b/code/modules/modular_computers/file_system/programs/research/exosuit_monitor.dm deleted file mode 100644 index 21bf2c0d127..00000000000 --- a/code/modules/modular_computers/file_system/programs/research/exosuit_monitor.dm +++ /dev/null @@ -1,12 +0,0 @@ -/datum/computer_file/program/exosuit_monitor - filename = "exosuitmonitor" - filedesc = "Exosuit Monitoring and Control" - nanomodule_path = /datum/nano_module/exosuit_control - program_icon_state = "mecha" - extended_desc = "This program allows remote monitoring and administration of exosuits with tracking beacons installed." - required_access_run = access_robotics - required_access_download = access_rd - usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP - requires_ntnet = TRUE - size = 8 - color = LIGHT_COLOR_PURPLE diff --git a/code/modules/nano/modules/exosuit_control.dm b/code/modules/nano/modules/exosuit_control.dm deleted file mode 100644 index 87174b3e5e6..00000000000 --- a/code/modules/nano/modules/exosuit_control.dm +++ /dev/null @@ -1,56 +0,0 @@ -/datum/nano_module/exosuit_control - name = "Exosuit Monitoring and Control" - var/stored_data - var/screen = 0 - -// If PC is not null header template is loaded. Use PC.get_header_data() to get relevant nanoui data from it. All data entries begin with "PC_...." -// In future it may be expanded to other modular computer devices. -/datum/nano_module/exosuit_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state) - var/list/data = host.initial_data() - - data["screen"] = screen - switch (screen) - if (0) - var/list/beacons = list() - for(var/obj/item/mecha_parts/mecha_tracking/TR in exo_beacons) - beacons.len++ - beacons[beacons.len] = TR.get_mecha_info_nano() - - data["beacons"] = beacons - if (1) - data["log"] = stored_data - - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) - ui = new(user, src, ui_key, "exosuit_control.tmpl", "Exosuit Control and Monitoring", 800, 500, state = state) - if(host.update_layout()) // This is necessary to ensure the status bar remains updated along with rest of the UI. - ui.auto_update_layout = 1 - ui.set_initial_data(data) - ui.open() - ui.set_auto_update(1) - - -/datum/nano_module/exosuit_control/Topic(href, href_list) - if(..()) - return - var/datum/topic_input/old_filter = new /datum/topic_input(href,href_list) - if(href_list["send_message"]) - var/obj/item/mecha_parts/mecha_tracking/MT = old_filter.getObj("send_message") - var/message = sanitize(input(usr,"Input message","Transmit message") as text) - var/obj/mecha/M = MT.in_mecha() - if(message && M) - M.occupant_message(message) - return - if(href_list["shock"]) - var/obj/item/mecha_parts/mecha_tracking/MT = old_filter.getObj("shock") - - var/response = alert(usr,"Are you certain you wish to terminate this exosuit? Executing this procedure will render it inoperable, and should only be used in extreme circumstances. Improper use will result in your being held liable for damage to Nanotrasen property","Confirm shutdown","Destroy","Cancel") - if (response == "Destroy") - MT.shock(usr) - if(href_list["get_log"]) - var/obj/item/mecha_parts/mecha_tracking/MT = old_filter.getObj("get_log") - stored_data = MT.get_mecha_log() - screen = 1 - if(href_list["return"]) - screen = 0 - return