diff --git a/code/datums/communication/dsay.dm b/code/datums/communication/dsay.dm index 273f17a36b7..c329b243c89 100644 --- a/code/datums/communication/dsay.dm +++ b/code/datums/communication/dsay.dm @@ -10,8 +10,9 @@ mute_setting = MUTE_DEADCHAT show_preference_setting = /datum/client_preference/show_dsay +// Changes the default speech_method kwarg. /decl/communication_channel/dsay/communicate(communicator, message, speech_method = /decl/dsay_communication/say) - ..() + return ..() /decl/communication_channel/dsay/can_communicate(var/client/communicator, var/message, var/speech_method_type) var/decl/dsay_communication/speech_method = GET_DECL(speech_method_type) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 64b8129a881..a9fc6994d81 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -620,7 +620,7 @@ Used for atoms performing audible actions - `message`: The string to show to anyone who can hear this atom - - `dead_message?`: The string deaf mobs will see + - `deaf_message?`: The string deaf mobs will see - `hearing_distance?`: The number of tiles away the message can be heard. Defaults to world.view - `check_ghosts?`: TRUE if ghosts should hear the message if their preferences allow - `radio_message?`: The string to send over radios diff --git a/code/game/machinery/_machines_base/machinery.dm b/code/game/machinery/_machines_base/machinery.dm index d6fafc99f1e..cff48f06503 100644 --- a/code/game/machinery/_machines_base/machinery.dm +++ b/code/game/machinery/_machines_base/machinery.dm @@ -240,6 +240,9 @@ Class Procs: /obj/machinery/CouldNotUseTopic(var/mob/user) user.unset_machine() +// This must not be converted to use OnTopic. +// mechanics_text and power_text can be done at a distance (via examination) +// while the TOPIC_REFRESH handling must come after OnTopic has resolved in the parent call of Topic. /obj/machinery/Topic(href, href_list, datum/topic_state/state) if(href_list["mechanics_text"] && construct_state) // This is an OOC examine thing handled via Topic; specifically bypass all checks, but do nothing other than message to chat. var/list/info = get_tool_manipulation_info() @@ -254,6 +257,13 @@ Class Procs: . = ..() if(. == TOPIC_REFRESH) updateUsrDialog() // Update legacy UIs to the extent possible. + SSnano.update_uis(src) // And our modern NanoUI ones, too. + update_icon() // A lot of machines like to do icon updates on refresh, so we'll handle it for them here. + else if(. == TOPIC_CLOSE) + usr.unset_machine() + var/datum/nanoui/open_ui = SSnano.get_open_ui(usr, src, "main") + if(open_ui) + open_ui.close() /obj/machinery/proc/get_tool_manipulation_info() return construct_state?.mechanics_info() diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm index 721eddb4ad9..65ecb25cd2e 100644 --- a/code/game/machinery/atmo_control.dm +++ b/code/game/machinery/atmo_control.dm @@ -114,9 +114,6 @@ data["automation"] = automation -/obj/machinery/computer/air_control/Process() - ..() - /obj/machinery/computer/air_control/receive_signal(datum/signal/signal) if(!signal || signal.encryption) return @@ -148,56 +145,56 @@ if(href_list["in_refresh_status"]) input_info = null refreshing_input = TRUE - signal.data = list ("tag" = input_tag, "status" = 1) + signal.data = list("tag" = input_tag, "status" = 1) . = 1 if(href_list["in_toggle_injector"]) input_info = null refreshing_input = TRUE - signal.data = list ("tag" = input_tag, "power_toggle" = 1) + signal.data = list("tag" = input_tag, "power_toggle" = 1) . = 1 if(href_list["in_set_flowrate"]) input_info = null refreshing_input = TRUE - input_flow_setting = input("What would you like to set the rate limit to?", "Set Volume", input_flow_setting) as num|null + input_flow_setting = input(user, "What would you like to set the rate limit to?", "Set Volume", input_flow_setting) as num|null input_flow_setting = clamp(input_flow_setting, 0, ATMOS_DEFAULT_VOLUME_PUMP+500) - signal.data = list ("tag" = input_tag, "set_volume_rate" = input_flow_setting) + signal.data = list("tag" = input_tag, "set_volume_rate" = input_flow_setting) . = 1 if(href_list["in_set_max"]) input_info = null refreshing_input = TRUE input_flow_setting = ATMOS_DEFAULT_VOLUME_PUMP+500 - signal.data = list ("tag" = input_tag, "set_volume_rate" = input_flow_setting) + signal.data = list("tag" = input_tag, "set_volume_rate" = input_flow_setting) . = 1 if(href_list["out_refresh_status"]) output_info = null refreshing_output = TRUE - signal.data = list ("tag" = output_tag, "status" = 1) + signal.data = list("tag" = output_tag, "status" = 1) . = 1 if(href_list["out_toggle_power"]) output_info = null refreshing_output = TRUE - signal.data = list ("tag" = output_tag, "power_toggle" = 1, "status" = 1) + signal.data = list("tag" = output_tag, "power_toggle" = 1, "status" = 1) . = 1 if(href_list["out_set_pressure"]) output_info = null refreshing_output = TRUE - pressure_setting = input("How much pressure would you like to output?", "Set Pressure", pressure_setting) as num|null + pressure_setting = input(user, "How much pressure would you like to output?", "Set Pressure", pressure_setting) as num|null pressure_setting = clamp(pressure_setting, 0, MAX_PUMP_PRESSURE) - signal.data = list ("tag" = output_tag, "set_internal_pressure" = "[pressure_setting]", "status" = 1) + signal.data = list("tag" = output_tag, "set_internal_pressure" = "[pressure_setting]", "status" = 1) . = 1 if(href_list["s_out_set_pressure"]) output_info = null refreshing_output = TRUE - pressure_setting = input("How much pressure would you like to maintain inside the core?", "Set Core Pressure", pressure_setting) as num|null + pressure_setting = input(user, "How much pressure would you like to maintain inside the core?", "Set Core Pressure", pressure_setting) as num|null pressure_setting = clamp(pressure_setting, 0, MAX_PUMP_PRESSURE) - signal.data = list ("tag" = output_tag, "set_external_pressure" = pressure_setting, "checks" = 1, "status" = 1) + signal.data = list("tag" = output_tag, "set_external_pressure" = pressure_setting, "checks" = 1, "status" = 1) . = 1 if(href_list["s_set_default"]) @@ -210,11 +207,11 @@ output_info = null refreshing_output = TRUE pressure_setting = MAX_PUMP_PRESSURE - signal.data = list ("tag" = output_tag, "set_internal_pressure" = pressure_setting, "status" = 1) + signal.data = list("tag" = output_tag, "set_internal_pressure" = pressure_setting, "status" = 1) . = 1 if(href_list["set_frequency"]) - var/F = input("What frequency would you like to set this to? (Decimal is added automatically)", "Adjust Frequency", frequency) as num|null + var/F = input(user, "What frequency would you like to set this to? (Decimal is added automatically)", "Adjust Frequency", frequency) as num|null if(F) frequency = F set_frequency(F) @@ -291,7 +288,7 @@ else ..(signal) -/obj/machinery/computer/air_control/fuel_injection/Topic(href, href_list) +/obj/machinery/computer/air_control/fuel_injection/OnTopic(mob/user, href_list, datum/topic_state/state) if((. = ..())) return diff --git a/code/game/machinery/computer/area_atmos.dm b/code/game/machinery/computer/area_atmos.dm index f287fbbc0b3..d6b82399d7c 100644 --- a/code/game/machinery/computer/area_atmos.dm +++ b/code/game/machinery/computer/area_atmos.dm @@ -88,25 +88,25 @@ show_browser(user, "[dat]", "window=miningshuttle;size=400x400") status = "" -/obj/machinery/computer/area_atmos/Topic(href, href_list) - if(..()) +/obj/machinery/computer/area_atmos/OnTopic(mob/user, href_list) + if((. = ..())) return - usr.set_machine(src) - if(href_list["scan"]) scanscrubbers() + return TOPIC_REFRESH else if(href_list["toggle"]) var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber = locate(href_list["scrub"]) if(!validscrubber(scrubber)) - spawn(20) + spawn(2 SECONDS) status = "ERROR: Couldn't connect to scrubber! (timeout)" connectedscrubbers -= scrubber - src.updateUsrDialog() - return + updateUsrDialog() + return TOPIC_REFRESH scrubber.update_use_power(text2num(href_list["toggle"]) ? POWER_USE_ACTIVE : POWER_USE_IDLE) + return TOPIC_REFRESH /obj/machinery/computer/area_atmos/proc/validscrubber(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber) if(!isobj(scrubber) || get_dist(scrubber.loc, src.loc) > src.range || scrubber.loc.z != src.loc.z) diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index 0c145faa9de..da48f902851 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -7,15 +7,18 @@ light_color = "#00b000" var/hack_icon = "error" - var/noserver = "ALERT: No server detected." - var/incorrectkey = "ALERT: Incorrect decryption key!" - var/defaultmsg = "Welcome. Please select an option." - var/rebootmsg = "%$&(£: Critical %$$@ Error // !RestArting! - ?pLeaSe wAit!" - var/screen = 0 // 0 = Main menu, 1 = Message Logs, 2 = Hacked screen, 3 = Custom Message - var/hacking = 0 // Is it being hacked into by the AI/Cyborg - var/emag = 0 // When it is emagged. + var/const/noserver = "ALERT: No server detected." + var/const/incorrectkey = "ALERT: Incorrect decryption key!" + var/const/defaultmsg = "Welcome. Please select an option." + var/const/rebootmsg = "%$&(£: Critical %$$@ Error // !RestArting! - ?pLeaSe wAit!" + + var/const/SCREEN_MAIN_MENU = 0 + var/const/SCREEN_MESSAGE_LOGS = 1 + var/const/SCREEN_HACKING = 2 + var/screen = SCREEN_MAIN_MENU + var/hacking = FALSE // Is it being hacked into by a silicon? var/message = "System bootup complete. Please select an option." // The message that shows on the main menu. - var/auth = 0 // Are they authenticated? + var/auth = FALSE // Are they authenticated? var/obj/machinery/network/message_server/tracking_linked_server /obj/machinery/computer/message_monitor/Initialize() @@ -43,7 +46,7 @@ return ..() if(!istype(user)) return TRUE - if(IS_SCREWDRIVER(O) && emag) + if(IS_SCREWDRIVER(O) && emagged) //Stops people from just unscrewing the monitor and putting it back to get the console working again. to_chat(user, "It is too hot to mess with!") return TRUE @@ -53,11 +56,11 @@ // Will create sparks and print out the console's password. You will then have to wait a while for the console to be back online. // It'll take more time if there's more characters in the password. - if(!emag && operable()) + if(!emagged && operable()) var/obj/machinery/network/message_server/linked_server = get_message_server() if(linked_server) - emag = 1 - screen = 2 + emagged = TRUE + screen = SCREEN_HACKING spark_at(src, amount = 5) var/obj/item/paper/monitorkey/MK = new(loc) // Will help make emagging the console not so easy to get away with. @@ -70,7 +73,7 @@ to_chat(user, "A no server error appears on the screen.") /obj/machinery/computer/message_monitor/on_update_icon() - if(emag || hacking) + if(emagged || hacking) icon_screen = hack_icon else icon_screen = initial(icon_screen) @@ -82,10 +85,16 @@ /obj/machinery/computer/message_monitor/interact(var/mob/living/user) //If the computer is being hacked or is emagged, display the reboot message. - if(hacking || emag) + if(hacking || emagged) message = rebootmsg var/obj/machinery/network/message_server/linked_server = get_message_server() + // This must run early so that changing the message actually works. + if(hacking || emagged) + screen = SCREEN_HACKING + else if(!auth || !linked_server || (linked_server.stat & (NOPOWER|BROKEN))) + message = auth ? noserver : message + screen = SCREEN_MAIN_MENU var/list/dat = list() dat += "Message Monitor Console" dat += "

Message Monitor Console


" @@ -98,16 +107,9 @@ dat += "

\[Unauthenticated\] /" dat += " Server Power: [linked_server?.active ? "\[On\]":"\[Off\]"]

" - if(hacking || emag) - screen = 2 - else if(!auth || !linked_server || (linked_server.stat & (NOPOWER|BROKEN))) - if(!linked_server || (linked_server.stat & (NOPOWER|BROKEN))) - message = noserver - screen = 0 - switch(screen) //Main menu - if(0) + if(SCREEN_MAIN_MENU) // = TAB var/i = 0 dat += "
[++i]. Link To A Server
" @@ -123,10 +125,32 @@ if((isAI(user) || isrobot(user)) && player_is_antag(user.mind)) //Malf/Traitor AIs can bruteforce into the system to gain the Key. dat += "
*&@#. Bruteforce Key
" - + //Request Console Logs + if(SCREEN_MESSAGE_LOGS) + var/index = 0 + /* data_rc_msg + X - 5% + var/rec_dpt = "Unspecified" //name of the person - 15% + var/send_dpt = "Unspecified" //name of the sender- 15% + var/message = "Blank" //transferred message - 300px + var/stamp = "Unstamped" - 15% + var/id_auth = "Unauthenticated" - 15% + var/priority = "Normal" - 10% + */ + dat += "
Back - Refresh

" + dat += {" + "} + for(var/datum/data_rc_msg/rc in linked_server.rc_msgs) + if(++index > 3000) + break + // Del - Sender - Recepient - Message + // X - Al Green - Your Mom - WHAT UP!? + dat += {" + "} + dat += "
XSending Dep.Receiving Dep.MessageStampID Auth.Priority.
X
[rc.send_dpt][rc.rec_dpt][rc.message][rc.stamp][rc.id_auth][rc.priority]
" //Hacking screen. - if(2) - if(isAI(user) || isrobot(user)) + if(SCREEN_HACKING) + if(issilicon(user)) dat += "Brute-forcing for server key.
It will take 20 seconds for every character that the password has." dat += "In the meantime, this console can reveal your true intentions if you let someone access it. Make sure no humans enter the room during that time." else @@ -166,35 +190,7 @@ 10010000001100100011101010111001001101001011011100110011
10010000001110100011010000110000101110100001000000111010
001101001011011010110010100101110"} - - //Request Console Logs - if(4) - - var/index = 0 - /* data_rc_msg - X - 5% - var/rec_dpt = "Unspecified" //name of the person - 15% - var/send_dpt = "Unspecified" //name of the sender- 15% - var/message = "Blank" //transferred message - 300px - var/stamp = "Unstamped" - 15% - var/id_auth = "Unauthenticated" - 15% - var/priority = "Normal" - 10% - */ - dat += "
Back - Refresh

" - dat += {" - "} - for(var/datum/data_rc_msg/rc in linked_server.rc_msgs) - index++ - if(index > 3000) - break - // Del - Sender - Recepient - Message - // X - Al Green - Your Mom - WHAT UP!? - dat += {" - "} - dat += "
XSending Dep.Receiving Dep.MessageStampID Auth.Priority.
X
[rc.send_dpt][rc.rec_dpt][rc.message][rc.stamp][rc.id_auth][rc.priority]
" - dat += "" - message = defaultmsg var/datum/browser/written_digital/popup = new(user, "message", "Message Monitoring Console", 700, 700) popup.set_content(JOINTEXT(dat)) popup.open() @@ -207,15 +203,16 @@ else var/currentKey = linked_server.decryptkey to_chat(user, "Brute-force completed! The key is '[currentKey]'.") - src.hacking = 0 + hacking = FALSE update_icon() - src.screen = 0 // Return the screen back to normal + screen = SCREEN_MAIN_MENU // Return the screen back to normal + message = defaultmsg // reset it for the next interaction /obj/machinery/computer/message_monitor/proc/UnemagConsole() - src.emag = 0 + emagged = FALSE update_icon() -/obj/machinery/computer/message_monitor/Topic(href, href_list) +/obj/machinery/computer/message_monitor/OnTopic(mob/user, href_list) if((. = ..())) return @@ -223,19 +220,24 @@ var/obj/machinery/network/message_server/linked_server = get_message_server() if (href_list["auth"]) if(auth) - auth = 0 - screen = 0 + auth = FALSE + screen = SCREEN_MAIN_MENU + message = defaultmsg // reset it for the next interaction + . = TOPIC_REFRESH else - var/dkey = trim(input(usr, "Please enter the decryption key.") as text|null) - if(dkey && dkey != "") - if(linked_server && linked_server.decryptkey == dkey) - auth = 1 + var/dkey = trim(input(user, "Please enter the decryption key.") as text|null) + . = TOPIC_HANDLED + if(dkey) + . = TOPIC_REFRESH + if(linked_server?.decryptkey == dkey) + auth = TRUE else message = incorrectkey //Turn the server on/off. if (href_list["active"] && auth && linked_server) linked_server.active = !linked_server.active + . = TOPIC_REFRESH //Find a server if (href_list["find"]) @@ -245,7 +247,7 @@ if((MS.z in local_zs) && !(MS.stat & (BROKEN|NOPOWER))) local_message_servers += MS if(length(local_message_servers) > 1) - tracking_linked_server = input(usr,"Please select a server.", "Select a server.", null) as null|anything in local_message_servers + tracking_linked_server = input(user, "Please select a server.", "Select a server.", null) as null|anything in local_message_servers message = "NOTICE: Server selected." else if(length(local_message_servers) > 0) tracking_linked_server = local_message_servers[1] @@ -253,47 +255,53 @@ else message = noserver linked_server = get_message_server() + . = TOPIC_REFRESH //Clears the request console logs - KEY REQUIRED if (href_list["clearr"]) if(!linked_server || (linked_server.stat & (NOPOWER|BROKEN))) message = noserver + . = TOPIC_REFRESH else if(auth) linked_server.rc_msgs = list() message = "NOTICE: Logs cleared." + . = TOPIC_REFRESH //Change the password - KEY REQUIRED if (href_list["pass"]) if(!linked_server || (linked_server.stat & (NOPOWER|BROKEN))) message = noserver - else - if(auth) - var/dkey = trim(input(usr, "Please enter the decryption key.") as text|null) - if(dkey && dkey != "") - if(linked_server.decryptkey == dkey) - var/newkey = trim(input(usr,"Please enter the new key (3 - 16 characters max):")) - if(length(newkey) <= 3) - message = "NOTICE: Decryption key too short!" - else if(length(newkey) > 16) - message = "NOTICE: Decryption key too long!" - else if(newkey && newkey != "") - linked_server.decryptkey = newkey - message = "NOTICE: Decryption key set." - else - message = incorrectkey + . = TOPIC_REFRESH + else if(auth) + var/dkey = trim(input(user, "Please enter the decryption key.") as text|null) + . = TOPIC_HANDLED + if(dkey) + . = TOPIC_REFRESH + if(linked_server.decryptkey == dkey) + var/newkey = trim(input(user,"Please enter the new key (3 - 16 characters max):")) + if(length(newkey) <= 3) + message = "NOTICE: Decryption key too short!" + else if(length(newkey) > 16) + message = "NOTICE: Decryption key too long!" + else if(newkey && newkey != "") + linked_server.decryptkey = newkey + message = "NOTICE: Decryption key set." + else + message = incorrectkey //Hack the Console to get the password if (href_list["hack"]) - if((isAI(usr) || isrobot(usr)) && player_is_antag(usr.mind)) - src.hacking = 1 - src.screen = 2 - update_icon() + if(issilicon(user) && player_is_antag(user.mind)) + hacking = TRUE + screen = SCREEN_HACKING + . = TOPIC_REFRESH //Time it takes to bruteforce is dependant on the password length. - addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/computer/message_monitor, BruteForceConsole), usr, linked_server), 100*length(linked_server.decryptkey)) + addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/machinery/computer/message_monitor, BruteForceConsole), user, linked_server), 10 SECONDS * length(linked_server.decryptkey)) //Delete the request console log. if (href_list["deleter"]) - //Are they on the view logs screen? - if(screen == 4) + . = TOPIC_REFRESH + //Make sure they're still on the view logs screen. + if(screen == SCREEN_MESSAGE_LOGS) if(!linked_server || (linked_server.stat & (NOPOWER|BROKEN))) message = noserver else //if(istype(href_list["delete"], /datum/data_pda_msg)) @@ -304,14 +312,16 @@ if(href_list["viewr"]) if(linked_server == null || (linked_server.stat & (NOPOWER|BROKEN))) message = noserver - else - if(auth) - src.screen = 4 + . = TOPIC_REFRESH + else if(auth) + screen = SCREEN_MESSAGE_LOGS + . = TOPIC_REFRESH if (href_list["back"]) - src.screen = 0 - - return interact(usr) + screen = SCREEN_MAIN_MENU + message = defaultmsg // reset it for the next interaction + . = TOPIC_REFRESH + // don't call interact() here, let the prior Topic() call do that via our TOPIC_REFRESH return value /obj/machinery/computer/message_monitor/proc/BruteForceConsole(var/mob/user, var/decrypting) var/obj/machinery/network/message_server/linked_server = get_message_server() diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index 84a1b64504f..b3903352d55 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -50,8 +50,8 @@ show_browser(user, dat, "window=computer;size=400x500") onclose(user, "computer") -/obj/machinery/computer/prisoner/Topic(href, href_list) - if(..()) +/obj/machinery/computer/prisoner/OnTopic(mob/user, href_list) + if((. = ..())) return . = TOPIC_REFRESH @@ -68,15 +68,15 @@ if(I) I.activate(10) else if(href_list["lock"]) - if(src.allowed(usr)) + if(allowed(user)) screen = !screen else - to_chat(usr, "Unauthorized Access.") + to_chat(user, "Unauthorized Access.") else if(href_list["warn"]) - var/warning = sanitize(input(usr,"Message:","Enter your message here!","")) - if(!warning) return + var/warning = sanitize(input(user,"Message:","Enter your message here!","")) + if(!warning) return TOPIC_HANDLED var/obj/item/implant/I = locate(href_list["warn"]) - if((I)&&(I.imp_in)) + if(I?.imp_in) var/mob/living/R = I.imp_in to_chat(R, "You hear a voice in your head saying: '[warning]'") diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index d84ed68404d..b845e67c52b 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -126,7 +126,7 @@ About the new airlock wires panel: */ /obj/machinery/door/airlock/bumpopen(mob/living/user) //Airlocks now zap you when you 'bump' them open when they're electrified. --NeoFite - if(!issilicon(usr)) + if(!issilicon(user)) if(src.isElectrified()) if(!src.justzap) if(src.shock(user, 100)) @@ -534,7 +534,7 @@ About the new airlock wires panel: src.attack_ai(user) /obj/machinery/door/airlock/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if (src.isElectrified()) + if (isElectrified()) if (istype(mover, /obj/item)) var/obj/item/i = mover if(i.material && i.material.conductive) @@ -542,9 +542,9 @@ About the new airlock wires panel: return ..() /obj/machinery/door/airlock/physical_attack_hand(mob/user) - if(!issilicon(usr)) - if(src.isElectrified()) - if(src.shock(user, 100)) + if(!issilicon(user)) + if(isElectrified()) + if(shock(user, 100)) return TRUE . = ..() @@ -564,63 +564,77 @@ About the new airlock wires panel: return ..() -/obj/machinery/door/airlock/Topic(href, href_list) - if(..()) - return 1 +/obj/machinery/door/airlock/OnTopic(mob/user, href_list) + if((. = ..())) + return var/activate = text2num(href_list["activate"]) switch (href_list["command"]) if("idscan") set_idscan(activate, 1) + . = TOPIC_REFRESH if("main_power") if(!main_power_lost_until) - src.loseMainPower() + loseMainPower() + . = TOPIC_REFRESH if("backup_power") if(!backup_power_lost_until) - src.loseBackupPower() + loseBackupPower() + . = TOPIC_REFRESH if("bolts") - if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) - to_chat(usr, "The door bolt control wire is cut - Door bolts permanently dropped.") - else if(activate && src.lock()) - to_chat(usr, "The door bolts have been dropped.") - else if(!activate && src.unlock()) - to_chat(usr, "The door bolts have been raised.") + if(isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) + to_chat(user, "The door bolt control wire is cut - Door bolts permanently dropped.") + . = TOPIC_HANDLED + else if(activate && lock()) + to_chat(user, "The door bolts have been dropped.") + . = TOPIC_REFRESH + else if(!activate && unlock()) + to_chat(user, "The door bolts have been raised.") + . = TOPIC_REFRESH if("electrify_temporary") electrify(30 * activate, 1) + . = TOPIC_REFRESH if("electrify_permanently") electrify(-1 * activate, 1) + . = TOPIC_REFRESH if("open") - if(src.welded) - to_chat(usr, text("The airlock has been welded shut!")) - else if(src.locked) - to_chat(usr, text("The door bolts are down!")) + if(welded) + to_chat(user, text("The airlock has been welded shut!")) + . = TOPIC_HANDLED + else if(locked) + to_chat(user, text("The door bolts are down!")) + . = TOPIC_HANDLED else if(activate && density) open() + . = TOPIC_REFRESH else if(!activate && !density) close() + . = TOPIC_REFRESH if("safeties") set_safeties(!activate, 1) if("timing") // Door speed control if(src.isWireCut(AIRLOCK_WIRE_SPEED)) - to_chat(usr, text("The timing wire is cut - Cannot alter timing.")) + to_chat(user, text("The timing wire is cut - Cannot alter timing.")) + . = TOPIC_HANDLED else if (activate && src.normalspeed) - normalspeed = 0 + normalspeed = FALSE + . = TOPIC_REFRESH else if (!activate && !src.normalspeed) - normalspeed = 1 + normalspeed = TRUE + . = TOPIC_REFRESH if("lights") // Lights - if(src.isWireCut(AIRLOCK_WIRE_LIGHT)) - to_chat(usr, "The lights wire is cut - The door lights are permanently disabled.") + if(isWireCut(AIRLOCK_WIRE_LIGHT)) + to_chat(user, "The lights wire is cut - The door lights are permanently disabled.") else if (!activate && src.lights) lights = 0 - to_chat(usr, "The door lights have been disabled.") + . = TOPIC_REFRESH + to_chat(user, "The door lights have been disabled.") else if (activate && !src.lights) lights = 1 - to_chat(usr, "The door lights have been enabled.") - - update_icon() - return 1 + . = TOPIC_REFRESH + to_chat(user, "The door lights have been enabled.") //returns 1 on success, 0 on failure /obj/machinery/door/airlock/proc/cut_bolts(var/obj/item/item, var/mob/user) diff --git a/code/game/machinery/embedded_controller/airlock_docking_controller.dm b/code/game/machinery/embedded_controller/airlock_docking_controller.dm index 87696262c88..026318090b4 100644 --- a/code/game/machinery/embedded_controller/airlock_docking_controller.dm +++ b/code/game/machinery/embedded_controller/airlock_docking_controller.dm @@ -69,7 +69,7 @@ disable_override() else enable_override() - return TRUE + return TOPIC_REFRESH . = ..(command) . = airlock_program.receive_user_command(command) || . //pass along to subprograms; bypass shortcircuit @@ -129,6 +129,7 @@ /datum/computer/file/embedded_program/airlock/docking/receive_user_command(command) if (master_prog.undocked() || master_prog.override_enabled) //only allow the port to be used as an airlock if nothing is docked here or the override is enabled return ..(command) + return TOPIC_NOACTION /datum/computer/file/embedded_program/airlock/docking/proc/open_doors() toggleDoor(memory["interior_status"], tag_interior_door, memory["secure"], "open") diff --git a/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm b/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm index eca7ae8fb8c..ea88e24d38d 100644 --- a/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm +++ b/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm @@ -46,8 +46,8 @@ ui.open() ui.set_auto_update(1) -/obj/machinery/embedded_controller/radio/docking_port_multi/Topic(href, href_list) - return 1 // Apparently we swallow all input (this is corrected legacy code) +/obj/machinery/embedded_controller/radio/docking_port_multi/OnTopic(user, href_list) + return TOPIC_HANDLED // Apparently we swallow all input (this is corrected legacy code) diff --git a/code/game/machinery/embedded_controller/airlock_program.dm b/code/game/machinery/embedded_controller/airlock_program.dm index eda2a4421eb..467b170bd84 100644 --- a/code/game/machinery/embedded_controller/airlock_program.dm +++ b/code/game/machinery/embedded_controller/airlock_program.dm @@ -145,7 +145,7 @@ /datum/computer/file/embedded_program/airlock/receive_user_command(command) var/shutdown_pump = 0 - . = TRUE + . = TOPIC_REFRESH switch(command) if("cycle_ext") //If airlock is already cycled in this direction, just toggle the doors. @@ -188,7 +188,7 @@ toggleDoor(memory["interior_status"], tag_interior_door, !memory["secure"]) memory["secure"] = !memory["secure"] else - . = FALSE + . = TOPIC_NOACTION if(shutdown_pump) signalPump(tag_airpump, 0) //send a signal to stop pressurizing diff --git a/code/game/machinery/embedded_controller/docking_program.dm b/code/game/machinery/embedded_controller/docking_program.dm index 03cfc947941..c247336a132 100644 --- a/code/game/machinery/embedded_controller/docking_program.dm +++ b/code/game/machinery/embedded_controller/docking_program.dm @@ -79,7 +79,7 @@ if(command == "dock" || command == "undock") if(!tag_target) //Prevents from self-destructing if no docking buddy - return FALSE + return TOPIC_NOACTION var/datum/signal/signal = new() signal.data["tag"] = tag_target @@ -87,7 +87,8 @@ signal.data["recipient"] = id_tag signal.data["code"] = docking_codes receive_signal(signal) - return TRUE + return TOPIC_REFRESH + return TOPIC_NOACTION /datum/computer/file/embedded_program/docking/get_receive_filters() return list("[id_tag]" = "primary controller") diff --git a/code/game/machinery/embedded_controller/docking_program_multi.dm b/code/game/machinery/embedded_controller/docking_program_multi.dm index c525e650e89..45da8d68e82 100644 --- a/code/game/machinery/embedded_controller/docking_program_multi.dm +++ b/code/game/machinery/embedded_controller/docking_program_multi.dm @@ -135,10 +135,11 @@ else override_enabled = 1 broadcast_override_status() - return TRUE + return TOPIC_REFRESH - if (!docking_enabled|| override_enabled) //only allow the port to be used as an airlock if nothing is docked here or the override is enabled + if (!docking_enabled || override_enabled) //only allow the port to be used as an airlock if nothing is docked here or the override is enabled return ..(command) + return TOPIC_NOACTION /datum/computer/file/embedded_program/airlock/multi_docking/get_receive_filters() return ..() + master_tag // master_tag is specifically to get "dock_status" diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm index 2f893501f6e..5b622e965a4 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -28,14 +28,14 @@ update_icon() //spawn(5) program.process() //no, program.process sends some signals and machines respond and we here again and we lag -rastaf0 -/obj/machinery/embedded_controller/Topic(href, href_list) - if(..()) - update_icon() +/obj/machinery/embedded_controller/OnTopic(mob/user, href_list) + if((. = ..())) return - if(usr) - usr.set_machine(src) + if(user) + user.set_machine(src) if(program) return program.receive_user_command(href_list["command"]) // Any further sanitization should be done in here. + return TOPIC_NOACTION /obj/machinery/embedded_controller/Process() if(program) diff --git a/code/game/machinery/embedded_controller/embedded_program_base.dm b/code/game/machinery/embedded_controller/embedded_program_base.dm index e6bcb5b68c3..31e409c555f 100644 --- a/code/game/machinery/embedded_controller/embedded_program_base.dm +++ b/code/game/machinery/embedded_controller/embedded_program_base.dm @@ -16,7 +16,7 @@ return ..() /datum/computer/file/embedded_program/proc/receive_user_command(command) - return FALSE + return TOPIC_NOACTION // Returns all filters on which you want to receive signals /datum/computer/file/embedded_program/proc/get_receive_filters(var/for_ui = FALSE) diff --git a/code/game/machinery/embedded_controller/simple_docking_controller.dm b/code/game/machinery/embedded_controller/simple_docking_controller.dm index 332077048e6..52dae59a453 100644 --- a/code/game/machinery/embedded_controller/simple_docking_controller.dm +++ b/code/game/machinery/embedded_controller/simple_docking_controller.dm @@ -63,7 +63,7 @@ ..(signal, receive_method, receive_param) /datum/computer/file/embedded_program/docking/simple/receive_user_command(command) - . = TRUE + . = TOPIC_REFRESH switch(command) if("force_door") if (override_enabled) @@ -74,7 +74,7 @@ else enable_override() else - . = FALSE + . = TOPIC_NOACTION //tell the docking port to start getting ready for docking - e.g. pressurize /datum/computer/file/embedded_program/docking/simple/prepare_for_docking() diff --git a/code/game/machinery/embedded_controller/tin_can.dm b/code/game/machinery/embedded_controller/tin_can.dm index 895f15cbaf7..1dcf86bdcfe 100644 --- a/code/game/machinery/embedded_controller/tin_can.dm +++ b/code/game/machinery/embedded_controller/tin_can.dm @@ -44,34 +44,34 @@ ..() /datum/computer/file/embedded_program/airlock/tin_can/receive_user_command(command) - . = TRUE + . = TOPIC_REFRESH switch(command) if("toggle_door_safety") door_safety = !door_safety toggleDoor(memory["exterior_status"], tag_exterior_door, door_safety) if("evacuate_atmos") if(state == STATE_EVACUATE) - return + return TOPIC_HANDLED state = STATE_EVACUATE toggleDoor(memory["exterior_status"], tag_exterior_door, door_safety, "close") signalPump(tag_pump_out_internal, 1, 0, 0) // Interior pump, target is a vacuum signalPump(tag_pump_out_external, 1, 1, 10000) // Exterior pump, target is infinite if("fill_atmos") if(state == STATE_FILL) - return + return TOPIC_HANDLED state = STATE_FILL toggleDoor(memory["exterior_status"], tag_exterior_door, door_safety, "close") signalPump(tag_pump_out_internal, 1, 1, memory["external_sensor_pressure"]) // Interior pump, target is exterior pressure signalPump(tag_pump_out_external, 1, 0, 0) // Exterior pump, target is zero, to intake if("seal") if(state == STATE_SEALED) - return + return TOPIC_HANDLED state = STATE_SEALED toggleDoor(memory["exterior_status"], tag_exterior_door, door_safety, "close") signalPump(tag_pump_out_internal, 0) signalPump(tag_pump_out_external, 0) else - . = FALSE + . = TOPIC_NOACTION /datum/computer/file/embedded_program/airlock/tin_can/process() if(door_safety) diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index 2e01d126217..b129241b2ea 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -29,7 +29,7 @@ var/global/list/navbeacons = list() navbeacons += src /obj/machinery/navbeacon/hide(var/intact) - set_invisibility(intact ? 101 : 0) + set_invisibility(intact ? INVISIBILITY_ABSTRACT : INVISIBILITY_NONE) update_icon() /obj/machinery/navbeacon/on_update_icon() @@ -73,100 +73,80 @@ var/global/list/navbeacons = list() var/ai = isAI(user) var/turf/T = loc if(!T.is_plating()) - return // prevent intraction when T-scanner revealed + return // prevent intraction when T-scanner revealed - if(!open && !ai) // can't alter controls if not open, unless you're an AI + if(!open && !ai) // can't alter controls if not open, unless you're an AI to_chat(user, "The beacon's control cover is closed.") return - var/t - - if(locked && !ai) - t = {"Navigation Beacon

-(swipe card to unlock controls)

-Location: [location ? location : "(none)"]

-Transponder Codes: