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 += {"X | Sending Dep. | Receiving Dep. |
+ Message | Stamp | ID Auth. | Priority. |
"}
+ 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 += {"X | [rc.send_dpt] |
+ [rc.rec_dpt] | [rc.message] | [rc.stamp] | [rc.id_auth] | [rc.priority] |
"}
+ dat += "
"
//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 += {"X | Sending Dep. | Receiving Dep. |
- Message | Stamp | ID Auth. | Priority. |
"}
- 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 += {"X | [rc.send_dpt] |
- [rc.rec_dpt] | [rc.message] | [rc.stamp] | [rc.id_auth] | [rc.priority] |
"}
- dat += "
"
-
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:"}
-
- for(var/key in codes)
- t += "- [key] ... [codes[key]]"
- t+= "
"
-
- else
-
- t = {"Navigation Beacon
-(swipe card to lock controls)
-Location: [location ? location : "(none)"]
-Transponder Codes:"}
-
- for(var/key in codes)
- t += "- [key] ... [codes[key]]"
- t += " (edit)"
- t += " (delete)
"
- t += "(add new)
"
- t+= "
"
-
- show_browser(user, t, "window=navbeacon")
+ var/restricted = locked && !ai
+ var/list/dat = list({"Navigation Beacon
+(swipe card to [locked ? "unlock" : "lock"] controls)
+Location: [restricted ? "" : ""][location ? location : "(none)"][restricted ? "" : ""]
+Transponder Codes:"})
+
+ for(var/key in codes)
+ dat += "- [key] ... [codes[key]]"
+ if(!restricted)
+ dat += " (edit)"
+ dat += " (delete)
"
+ if(!restricted)
+ dat += "(add new)
"
+ dat += "
"
+
+ show_browser(user, JOINTEXT(dat), "window=navbeacon")
onclose(user, "navbeacon")
return
-/obj/machinery/navbeacon/Topic(href, href_list)
- ..()
- if (usr.stat)
+/obj/machinery/navbeacon/OnTopic(mob/user, href_list, datum/topic_state/state)
+ if((. = ..()))
return
- if ((in_range(src, usr) && isturf(src.loc)) || (issilicon(usr)))
- if(open && !locked)
- usr.set_machine(src)
-
- if(href_list["locedit"])
- var/newloc = sanitize(input("Enter New Location", "Navigation Beacon", location) as text|null)
- if(newloc)
- location = newloc
- updateDialog()
-
- else if(href_list["edit"])
- var/codekey = href_list["code"]
+ if(!open || locked)
+ return TOPIC_NOACTION
- var/newkey = input("Enter Transponder Code Key", "Navigation Beacon", codekey) as text|null
- if(!newkey)
- return
+ if(href_list["locedit"])
+ var/newloc = sanitize(input(user, "Enter New Location", "Navigation Beacon", location) as text|null)
+ if(newloc)
+ location = newloc
+ return TOPIC_REFRESH
- var/codeval = codes[codekey]
- var/newval = input("Enter Transponder Code Value", "Navigation Beacon", codeval) as text|null
- if(!newval)
- newval = codekey
- return
+ else if(href_list["edit"])
+ var/codekey = href_list["code"]
- codes.Remove(codekey)
- codes[newkey] = newval
+ var/newkey = sanitize(input(user, "Enter Transponder Code Key", "Navigation Beacon", codekey) as text|null)
+ if(!newkey)
+ return TOPIC_HANDLED
- updateDialog()
+ var/codeval = codes[codekey]
+ var/newval = sanitize(input(user, "Enter Transponder Code Value", "Navigation Beacon", codeval || "1") as text|null)
+ if(!newval)
+ return TOPIC_HANDLED
- else if(href_list["delete"])
- var/codekey = href_list["code"]
- codes.Remove(codekey)
- updateDialog()
+ codes -= codekey
+ codes[newkey] = newval
+ return TOPIC_REFRESH
- else if(href_list["add"])
+ else if(href_list["delete"])
+ var/codekey = href_list["code"]
+ codes -= codekey
+ return TOPIC_REFRESH
- var/newkey = input("Enter New Transponder Code Key", "Navigation Beacon") as text|null
- if(!newkey)
- return
+ else if(href_list["add"])
- var/newval = input("Enter New Transponder Code Value", "Navigation Beacon") as text|null
- if(!newval)
- newval = "1"
- return
+ var/newkey = sanitize(input(user, "Enter New Transponder Code Key", "Navigation Beacon") as text|null)
+ if(!newkey)
+ return TOPIC_HANDLED
- if(!codes)
- codes = new()
+ var/newval = sanitize(input(user, "Enter New Transponder Code Value", "Navigation Beacon", "1") as text|null)
+ if(!newval)
+ return TOPIC_HANDLED
- codes[newkey] = newval
-
- updateDialog()
+ codes[newkey] = newval
+ return TOPIC_REFRESH
/obj/machinery/navbeacon/Destroy()
- navbeacons.Remove(src)
- . = ..()
+ global.navbeacons -= src
+ return ..()
// Patrol beacon types below. So many.
diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm
index 50cf312569b..20c88ea6082 100644
--- a/code/game/machinery/newscaster.dm
+++ b/code/game/machinery/newscaster.dm
@@ -112,42 +112,59 @@ var/global/list/allCasters = list() //Global list that will contain reference to
desc = "A standard newsfeed handler. All the news you absolutely have no use for, in one place!"
icon = 'icons/obj/terminals.dmi'
icon_state = "newscaster_normal"
- //var/list/datum/feed_channel/channel_list = list() //This list will contain the names of the feed channels. Each name will refer to a data region where the messages of the feed channels are stored.
- //OBSOLETE: We're now using a global news network
- var/screen = 0 //Or maybe I'll make it into a list within a list afterwards... whichever I prefer, go fuck yourselves :3
- // 0 = welcome screen - main menu
- // 1 = view feed channels
- // 2 = create feed channel
- // 3 = create feed story
- // 4 = feed story submited sucessfully
- // 5 = feed channel created successfully
- // 6 = ERROR: Cannot create feed story
- // 7 = ERROR: Cannot create feed channel
- // 8 = print newspaper
- // 9 = viewing channel feeds
- // 10 = censor feed story
- // 11 = censor feed channel
- //Holy shit this is outdated, made this when I was still starting newscasters :3
+ var/const/SCREEN_WELCOME = 0
+ var/const/SCREEN_VIEW_CHANNELS = 1
+ var/const/SCREEN_CREATE_CHANNEL = 2
+ var/const/SCREEN_CREATE_STORY = 3
+ var/const/SCREEN_STORY_SUBMITTED = 4
+ var/const/SCREEN_CHANNEL_SUBMITTED = 5
+ var/const/SCREEN_STORY_FAILED = 6
+ var/const/SCREEN_CHANNEL_FAILED = 7
+ var/const/SCREEN_CHOOSE_PRINT = 8
+ var/const/SCREEN_VIEW_STORIES = 9
+ var/const/SCREEN_CENSOR_STORY = 10
+ var/const/SCREEN_CENSOR_CHANNEL = 11
+ var/const/SCREEN_PICK_CENSOR_CHANNEL = 12
+ var/const/SCREEN_PICK_CENSOR_STORY = 13
+ var/const/SCREEN_MAKE_WANTED_ISSUE = 14
+ var/const/SCREEN_WANTED_CONFIRMED = 15
+ var/const/SCREEN_WANTED_FAILED = 16
+ var/const/SCREEN_WANTED_DELETED = 17
+ var/const/SCREEN_WANTED_VIEW = 18
+ var/const/SCREEN_WANTED_EDITED = 19
+ var/const/SCREEN_PRINT_COMPLETE = 20
+ var/const/SCREEN_PRINT_FAILED = 21
+ var/screen = SCREEN_WELCOME
var/paper_remaining = 0
- var/securityCaster = 0
- // 0 = Caster cannot be used to issue wanted posters
- // 1 = the opposite
- var/unit_no = 0 //Each newscaster has a unit number
- //var/datum/feed_message/wanted //We're gonna use a feed_message to store data of the wanted person because fields are similar
- //var/wanted_issue = 0 //OBSOLETE
- // 0 = there's no WANTED issued, we don't need a special icon_state
- // 1 = Guess what.
- var/alert_delay = 500
- var/alert = 0
- // 0 = there hasn't been a news/wanted update in the last alert_delay
- // 1 = there has
- var/scanned_user = "Unknown" //Will contain the name of the person who currently uses the newscaster
- var/msg = ""; //Feed message
- var/datum/news_photo/photo_data = null
- var/channel_name = ""; //the feed channel which will be receiving the feed, or being created
- var/c_locked=0; //Will our new channel be locked to public submissions?
- var/hitstaken = 0 //Death at 3 hits from an item with force>=15
- var/datum/feed_channel/viewing_channel = null
+ /// (BOOL) Whether or not the newscaster can be used to create wanted issues.
+ var/securityCaster = FALSE
+ /// The unique unit number identifying a specific newscaster, useful for forensics.
+ var/unit_no = 0
+ var/alert_delay = 1 MINUTE
+ /// Whether or not the alert overlay state should be used to inform about a recent news/wanted update in the last alert_delay.
+ var/alert = FALSE
+ /// The name (based on an ID) of the user currently operating the newscaster.
+ var/scanned_user = "Unknown"
+
+ // Temporary variables used while creating a new story.
+ /// The text content of the feed message to create.
+ var/tmp/msg = "" //Feed message
+ /// The photo to attach to the news story. A wrapper for a photo object with additional metadata.
+ var/tmp/datum/news_photo/photo_data = null
+
+ // Temporary variable used while creating a new channel.
+ /// Whether or not the currently-being-created channel will be locked to public submissions.
+ var/tmp/c_locked = FALSE
+
+ // Temporary variable used for both creating a new channel and creating a new story.
+ /// The name of the feed channel to either create, or submit a new story to.
+ var/tmp/channel_name = ""
+
+ /// A hit counter that determines cosmetic damage overlays, up to 3. Currently never incremented.
+ var/hitstaken = 0
+
+ /// The channel that's currently open.
+ var/tmp/datum/feed_channel/viewing_channel = null
light_range = 0
anchored = TRUE
obj_flags = OBJ_FLAG_MOVES_UNSUPPORTED
@@ -208,7 +225,7 @@ var/global/list/allCasters = list() //Global list that will contain reference to
src.scan_user(human_or_robot_user) //Newscaster scans you
switch(screen)
- if(0)
+ if(SCREEN_WELCOME)
dat += "Welcome to Newscasting Unit #[src.unit_no].
Interface & News networks Operational."
if(news_network.wanted_issue)
dat+= "
Read Wanted Issue"
@@ -228,7 +245,7 @@ var/global/list/allCasters = list() //Global list that will contain reference to
dat+="
Censor Feed Stories"
dat+="
Mark Feed Channel with [global.using_map.company_name] D-Notice"
dat+="
The newscaster recognises you as: [src.scanned_user]"
- if(1)
+ if(SCREEN_VIEW_CHANNELS)
dat+= "Local Feed Channels
"
if( !length(news_network.network_channels) )
dat+="No active channels found..."
@@ -239,14 +256,14 @@ var/global/list/allCasters = list() //Global list that will contain reference to
else
dat+="[CHANNEL.channel_name] [(CHANNEL.censored) ? ("***") : null ]
"
dat+="
Refresh"
- dat+="
Back"
- if(2)
+ dat+="
Back"
+ if(SCREEN_CREATE_CHANNEL)
dat+="Creating new Feed Channel..."
dat+="
Channel Name: [src.channel_name]
"
dat+="Channel Author: [src.scanned_user]
"
dat+="Will Accept Public Feeds: [(src.c_locked) ? ("NO") : ("YES")]
"
- dat+="
Submit
Cancel
"
- if(3)
+ dat+="
Submit
Cancel
"
+ if(SCREEN_CREATE_STORY)
dat+="Creating new Feed Message..."
dat+="
Receiving Channel: [src.channel_name]
" //MARK
dat+="Message Author: [src.scanned_user]
"
@@ -258,14 +275,14 @@ var/global/list/allCasters = list() //Global list that will contain reference to
dat+="
Delete Photo"
else
dat+="Attach Photo"
- dat+="
Submit
Cancel
"
- if(4)
+ dat+="
Submit
Cancel
"
+ if(SCREEN_STORY_SUBMITTED)
dat+="Feed story successfully submitted to [src.channel_name].
"
- dat+="
Return
"
- if(5)
+ dat+="
Return
"
+ if(SCREEN_CHANNEL_SUBMITTED)
dat+="Feed Channel [src.channel_name] created successfully.
"
- dat+="
Return
"
- if(6)
+ dat+="
Return
"
+ if(SCREEN_STORY_FAILED)
dat+="ERROR: Could not submit Feed story to Network.
"
if(src.channel_name=="")
dat+="Invalid receiving channel name.
"
@@ -274,8 +291,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to
if(src.msg == "" || src.msg == "\[REDACTED\]")
dat+="Invalid message body.
"
- dat+="
Return
"
- if(7)
+ dat+="
Return
"
+ if(SCREEN_CHANNEL_FAILED)
dat+="ERROR: Could not submit Feed Channel to Network.
"
var/list/existing_authors = list()
for(var/datum/feed_channel/FC in news_network.network_channels)
@@ -296,8 +313,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to
dat+="Channel name already in use.
"
if(src.scanned_user=="Unknown")
dat+="Channel author unverified.
"
- dat+="
Return
"
- if(8)
+ dat+="
Return
"
+ if(SCREEN_CHOOSE_PRINT)
var/total_num=length(news_network.network_channels)
var/active_num=total_num
var/message_num=0
@@ -309,8 +326,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to
dat+="Network currently serves a total of [total_num] Feed channels, [active_num] of which are active, and a total of [message_num] Feed Stories." //TODO: CONTINUE
dat+="
Liquid Paper remaining: [(src.paper_remaining) *100 ] cm^3"
dat+="
Print Paper"
- dat+="
Cancel"
- if(9)
+ dat+="
Cancel"
+ if(SCREEN_VIEW_STORIES)
dat+="[src.viewing_channel.channel_name]: \[created by: [src.viewing_channel.author]\] \[views: [++src.viewing_channel.views]\]
"
if(src.viewing_channel.censored)
dat+="ATTENTION: This channel has been deemed as threatening to the welfare of the [station_name()], and marked with a [global.using_map.company_name] D-Notice.
"
@@ -332,8 +349,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to
dat+="
"
dat+="\[Story by [MESSAGE.author] - [MESSAGE.time_stamp]\]
"
dat+="
Refresh"
- dat+="
Back"
- if(10)
+ dat+="
Back"
+ if(SCREEN_CENSOR_STORY)
dat+="[global.using_map.company_name] Feed Censorship Tool
"
dat+="NOTE: Due to the nature of news Feeds, total deletion of a Feed Story is not possible.
"
dat+="Keep in mind that users attempting to view a censored feed will instead see the \[REDACTED\] tag above it."
@@ -343,8 +360,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to
else
for(var/datum/feed_channel/CHANNEL in news_network.network_channels)
dat+="[CHANNEL.channel_name] [(CHANNEL.censored) ? ("***") : null ]
"
- dat+="
Cancel"
- if(11)
+ dat+="
Cancel"
+ if(SCREEN_CENSOR_CHANNEL)
dat+="[global.using_map.company_name] D-Notice Handler
"
dat+="A D-Notice is to be bestowed upon the channel if the handling Authority deems it as harmful for the [station_name()]'s"
dat+="morale, integrity or disciplinary behaviour. A D-Notice will render a channel unable to be updated by anyone, without deleting any feed"
@@ -355,8 +372,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to
for(var/datum/feed_channel/CHANNEL in news_network.network_channels)
dat+="[CHANNEL.channel_name] [(CHANNEL.censored) ? ("***") : null ]
"
- dat+="
Back"
- if(12)
+ dat+="
Back"
+ if(SCREEN_PICK_CENSOR_STORY)
dat+="[src.viewing_channel.channel_name]: \[ created by: [src.viewing_channel.author] \]
"
dat+="[(src.viewing_channel.author=="\[REDACTED\]") ? ("Undo Author censorship") : ("Censor channel Author")]
"
@@ -367,8 +384,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to
for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages)
dat+="-[MESSAGE.body]
\[[MESSAGE.message_type] by [MESSAGE.author]\]
"
dat+="[(MESSAGE.body == "\[REDACTED\]") ? ("Undo story censorship") : ("Censor story")] - [(MESSAGE.author == "\[REDACTED\]") ? ("Undo Author Censorship") : ("Censor message Author")]
"
- dat+="
Back"
- if(13)
+ dat+="
Back"
+ if(SCREEN_PICK_CENSOR_CHANNEL)
dat+="[src.viewing_channel.channel_name]: \[ created by: [src.viewing_channel.author] \]
"
dat+="Channel messages listed below. If you deem them dangerous to the [station_name()], you can Bestow a D-Notice upon the channel.
"
if(src.viewing_channel.censored)
@@ -381,8 +398,8 @@ var/global/list/allCasters = list() //Global list that will contain reference to
for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages)
dat+="-[MESSAGE.body]
\[[MESSAGE.message_type] by [MESSAGE.author]\]
"
- dat+="
Back"
- if(14)
+ dat+="
Back"
+ if(SCREEN_MAKE_WANTED_ISSUE)
dat+="Wanted Issue Handler:"
var/wanted_already = 0
var/end_param = 1
@@ -409,11 +426,11 @@ var/global/list/allCasters = list() //Global list that will contain reference to
dat+="
[(wanted_already) ? ("Edit Issue") : ("Submit")]"
if(wanted_already)
dat+="
Take down Issue"
- dat+="
Cancel"
- if(15)
+ dat+="
Cancel"
+ if(SCREEN_WANTED_CONFIRMED)
dat+="Wanted issue for [src.channel_name] is now in Network Circulation.
"
- dat+="
Return
"
- if(16)
+ dat+="
Return
"
+ if(SCREEN_WANTED_FAILED)
dat+="ERROR: Wanted Issue rejected by Network.
"
if(src.channel_name=="" || src.channel_name == "\[REDACTED\]")
dat+="Invalid name for person wanted.
"
@@ -421,11 +438,11 @@ var/global/list/allCasters = list() //Global list that will contain reference to
dat+="Issue author unverified.
"
if(src.msg == "" || src.msg == "\[REDACTED\]")
dat+="Invalid description.
"
- dat+="
Return
"
- if(17)
+ dat+="
Return
"
+ if(SCREEN_WANTED_DELETED)
dat+="Wanted Issue successfully deleted from Circulation
"
- dat+="
Return
"
- if(18)
+ dat+="
Return
"
+ if(SCREEN_WANTED_VIEW)
dat+="-- STATIONWIDE WANTED ISSUE --
\[Submitted by: [news_network.wanted_issue.backup_author]\]
"
dat+="Criminal: [news_network.wanted_issue.author]
"
dat+="Description: [news_network.wanted_issue.body]
"
@@ -435,290 +452,284 @@ var/global/list/allCasters = list() //Global list that will contain reference to
dat+="
"
else
dat+="None"
- dat+="
Back
"
- if(19)
+ dat+="
Back
"
+ if(SCREEN_WANTED_EDITED)
dat+="Wanted issue for [src.channel_name] successfully edited.
"
- dat+="
Return
"
- if(20)
+ dat+="
Return
"
+ if(SCREEN_PRINT_COMPLETE)
dat+="Printing successful. Please receive your newspaper from the bottom of the machine.
"
- dat+="Return"
- if(21)
+ dat+="Return"
+ if(SCREEN_PRINT_FAILED)
dat+="Unable to print newspaper. Insufficient paper. Please notify maintenance personnel to refill machine storage.
"
- dat+="Return"
- else
- dat+="I'm sorry to break your immersion. This shit's bugged. Report this bug to Agouri, polyxenitopalidou@gmail.com"
+ dat+="Return"
var/processed_dat = human_or_robot_user.handle_reading_literacy(human_or_robot_user, dat, digital = TRUE)
if(processed_dat)
show_browser(human_or_robot_user, processed_dat, "window=newscaster_main;size=400x600")
onclose(human_or_robot_user, "newscaster_main")
-/obj/machinery/newscaster/Topic(href, href_list)
- if(..())
+// This really needs to be rewritten, desperately.
+// TODO: Rewrite newscasters to use files, networks, mainframes, etc. Also make it use NanoUI.
+/obj/machinery/newscaster/OnTopic(mob/user, href_list, datum/topic_state/state)
+ if((. = ..())) // already handled in parent
return
- if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && isturf(src.loc))) || (issilicon(usr)))
- usr.set_machine(src)
- if(href_list["set_channel_name"])
- src.channel_name = sanitize_safe(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", ""), MAX_LNAME_LEN)
- src.updateUsrDialog()
- //src.update_icon()
-
- else if(href_list["set_channel_lock"])
- src.c_locked = !src.c_locked
- src.updateUsrDialog()
- //src.update_icon()
-
- else if(href_list["submit_new_channel"])
- //var/list/existing_channels = list() //OBSOLETE
- var/list/existing_authors = list()
- for(var/datum/feed_channel/FC in news_network.network_channels)
- //existing_channels += FC.channel_name
- if(FC.author == "\[REDACTED\]")
- existing_authors += FC.backup_author
- else
- existing_authors +=FC.author
- var/check = 0
- for(var/datum/feed_channel/FC in news_network.network_channels)
- if(FC.channel_name == src.channel_name)
- check = 1
- break
- if(src.channel_name == "" || src.channel_name == "\[REDACTED\]" || src.scanned_user == "Unknown" || check || (src.scanned_user in existing_authors) )
- src.screen=7
- else
- var/choice = alert("Please confirm Feed channel creation","Network Channel Handler","Confirm","Cancel")
- if(choice=="Confirm")
- news_network.CreateFeedChannel(src.channel_name, src.scanned_user, c_locked)
- src.screen=5
- src.updateUsrDialog()
- //src.update_icon()
-
- else if(href_list["set_channel_receiving"])
- //var/list/datum/feed_channel/available_channels = list()
- var/list/available_channels = list()
- for(var/datum/feed_channel/F in news_network.network_channels)
- if( (!F.locked || F.author == scanned_user) && !F.censored)
- available_channels += F.channel_name
- src.channel_name = input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in available_channels
- src.updateUsrDialog()
-
- else if(href_list["set_new_message"])
- src.msg = pencode2html(sanitize(input(usr, "Write your Feed story", "Network Channel Handler", "") as message|null))
- src.updateUsrDialog()
-
- else if(href_list["set_attachment"])
- AttachPhoto(usr)
- src.updateUsrDialog()
-
- else if(href_list["submit_new_message"])
- if(src.msg =="" || src.msg=="\[REDACTED\]" || src.scanned_user == "Unknown" || src.channel_name == "" )
- src.screen=6
- else
- var/image = photo_data ? photo_data.photo : null
- SSstatistics.add_field("newscaster_stories",1)
- news_network.SubmitArticle(src.msg, src.scanned_user, src.channel_name, image, 0)
- if(photo_data)
- qdel(photo_data)
- photo_data = null
- src.screen=4
-
- src.updateUsrDialog()
-
- else if(href_list["create_channel"])
- src.screen=2
- src.updateUsrDialog()
-
- else if(href_list["create_feed_story"])
- src.screen=3
- src.updateUsrDialog()
-
- else if(href_list["menu_paper"])
- src.screen=8
- src.updateUsrDialog()
- else if(href_list["print_paper"])
- if(!src.paper_remaining)
- src.screen=21
+ // no need to do set_machine, that's done in CouldUseTopic
+ if(href_list["set_channel_name"])
+ channel_name = sanitize_safe(input(user, "Provide a Feed Channel Name", "Network Channel Handler", ""), MAX_LNAME_LEN)
+ . = TOPIC_REFRESH
+
+ else if(href_list["set_channel_lock"])
+ c_locked = !c_locked
+ . = TOPIC_REFRESH
+
+ else if(href_list["submit_new_channel"])
+ var/list/existing_authors = list()
+ for(var/datum/feed_channel/FC in news_network.network_channels)
+ if(FC.author == "\[REDACTED\]")
+ existing_authors += FC.backup_author
else
- src.print_paper()
- src.screen = 20
- src.updateUsrDialog()
-
- else if(href_list["menu_censor_story"])
- src.screen=10
- src.updateUsrDialog()
-
- else if(href_list["menu_censor_channel"])
- src.screen=11
- src.updateUsrDialog()
-
- else if(href_list["menu_wanted"])
- var/already_wanted = 0
- if(news_network.wanted_issue)
- already_wanted = 1
-
- if(already_wanted)
- src.channel_name = news_network.wanted_issue.author
- src.msg = news_network.wanted_issue.body
- src.screen = 14
- src.updateUsrDialog()
-
- else if(href_list["set_wanted_name"])
- src.channel_name = sanitize_safe(input(usr, "Provide the name of the Wanted person", "Network Security Handler", ""), MAX_LNAME_LEN)
- src.updateUsrDialog()
-
- else if(href_list["set_wanted_desc"])
- src.msg = sanitize(input(usr, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", ""))
- src.updateUsrDialog()
-
- else if(href_list["submit_wanted"])
- var/input_param = text2num(href_list["submit_wanted"])
- if(src.msg == "" || src.channel_name == "" || src.scanned_user == "Unknown")
- src.screen = 16
- else
- var/choice = alert("Please confirm Wanted Issue [(input_param==1) ? ("creation.") : ("edit.")]","Network Security Handler","Confirm","Cancel")
- if(choice=="Confirm")
- if(input_param==1) //If input_param == 1 we're submitting a new wanted issue. At 2 we're just editing an existing one. See the else below
- var/datum/feed_message/WANTED = new /datum/feed_message
- WANTED.author = src.channel_name
- WANTED.body = src.msg
- WANTED.backup_author = src.scanned_user //I know, a bit wacky
- if(photo_data)
- WANTED.img = photo_data.photo.img
- news_network.wanted_issue = WANTED
- news_network.alert_readers()
- src.screen = 15
- else
- if(news_network.wanted_issue.is_admin_message)
- alert("The wanted issue has been distributed by a [global.using_map.company_name] higherup. You cannot edit it.","Ok")
- return
- news_network.wanted_issue.author = src.channel_name
- news_network.wanted_issue.body = src.msg
- news_network.wanted_issue.backup_author = src.scanned_user
- if(photo_data)
- news_network.wanted_issue.img = photo_data.photo.img
- src.screen = 19
-
- src.updateUsrDialog()
-
- else if(href_list["cancel_wanted"])
- if(news_network.wanted_issue.is_admin_message)
- alert("The wanted issue has been distributed by a [global.using_map.company_name] higherup. You cannot take it down.","Ok")
- return
- var/choice = alert("Please confirm Wanted Issue removal","Network Security Handler","Confirm","Cancel")
+ existing_authors +=FC.author
+ var/check = 0
+ for(var/datum/feed_channel/FC in news_network.network_channels)
+ if(FC.channel_name == channel_name)
+ check = 1
+ break
+ if(channel_name == "" || channel_name == "\[REDACTED\]" || scanned_user == "Unknown" || check || (scanned_user in existing_authors) )
+ screen = SCREEN_CHANNEL_FAILED
+ else
+ var/choice = alert(user, "Please confirm Feed channel creation","Network Channel Handler","Confirm","Cancel")
if(choice=="Confirm")
- news_network.wanted_issue = null
- for(var/obj/machinery/newscaster/NEWSCASTER in allCasters)
- NEWSCASTER.update_icon()
- src.screen=17
- src.updateUsrDialog()
-
- else if(href_list["view_wanted"])
- src.screen=18
- src.updateUsrDialog()
- else if(href_list["censor_channel_author"])
- var/datum/feed_channel/FC = locate(href_list["censor_channel_author"])
- if(FC.is_admin_channel)
- alert("This channel was created by a [global.using_map.company_name] Officer. You cannot censor it.","Ok")
- return
- if(FC.author != "\[REDACTED\]")
- FC.backup_author = FC.author
- FC.author = "\[REDACTED\]"
- else
- FC.author = FC.backup_author
- FC.update()
- src.updateUsrDialog()
-
- else if(href_list["censor_channel_story_author"])
- var/datum/feed_message/MSG = locate(href_list["censor_channel_story_author"])
- if(MSG.is_admin_message)
- alert("This message was created by a [global.using_map.company_name] Officer. You cannot censor its author.","Ok")
- return
- if(MSG.author != "\[REDACTED\]")
- MSG.backup_author = MSG.author
- MSG.author = "\[REDACTED\]"
- else
- MSG.author = MSG.backup_author
- MSG.parent_channel.update()
- src.updateUsrDialog()
-
- else if(href_list["censor_channel_story_body"])
- var/datum/feed_message/MSG = locate(href_list["censor_channel_story_body"])
- if(MSG.is_admin_message)
- alert("This channel was created by a [global.using_map.company_name] Officer. You cannot censor it.","Ok")
- return
- if(MSG.body != "\[REDACTED\]")
- MSG.backup_body = MSG.body
- MSG.backup_caption = MSG.caption
- MSG.backup_img = MSG.img
- MSG.body = "\[REDACTED\]"
- MSG.caption = "\[REDACTED\]"
- MSG.img = null
- else
- MSG.body = MSG.backup_body
- MSG.caption = MSG.caption
- MSG.img = MSG.backup_img
-
- MSG.parent_channel.update()
- src.updateUsrDialog()
-
- else if(href_list["pick_d_notice"])
- var/datum/feed_channel/FC = locate(href_list["pick_d_notice"])
- src.viewing_channel = FC
- src.screen=13
- src.updateUsrDialog()
-
- else if(href_list["toggle_d_notice"])
- var/datum/feed_channel/FC = locate(href_list["toggle_d_notice"])
- if(FC.is_admin_channel)
- alert("This channel was created by a [global.using_map.company_name] Officer. You cannot place a D-Notice upon it.","Ok")
- return
- FC.censored = !FC.censored
- FC.update()
- src.updateUsrDialog()
-
- else if(href_list["view"])
- src.screen=1
- src.updateUsrDialog()
-
- else if(href_list["setScreen"]) //Brings us to the main menu and resets all fields~
- src.screen = text2num(href_list["setScreen"])
- if (src.screen == 0)
- src.scanned_user = "Unknown"
- msg = ""
- src.c_locked=0;
- channel_name=""
- src.viewing_channel = null
- if (photo_data)
- qdel(photo_data)
- photo_data = null
- src.updateUsrDialog()
-
- else if(href_list["show_channel"])
- var/datum/feed_channel/FC = locate(href_list["show_channel"])
- src.viewing_channel = FC
- src.screen = 9
- src.updateUsrDialog()
-
- else if(href_list["pick_censor_channel"])
- var/datum/feed_channel/FC = locate(href_list["pick_censor_channel"])
- src.viewing_channel = FC
- src.screen = 12
- src.updateUsrDialog()
-
- else if(href_list["refresh"])
- src.updateUsrDialog()
+ news_network.CreateFeedChannel(channel_name, scanned_user, c_locked)
+ screen = SCREEN_CHANNEL_SUBMITTED
+ . = TOPIC_REFRESH
+
+ else if(href_list["set_channel_receiving"])
+ var/list/available_channels = list()
+ for(var/datum/feed_channel/F in news_network.network_channels)
+ if( (!F.locked || F.author == scanned_user) && !F.censored)
+ available_channels += F.channel_name
+ channel_name = input(user, "Choose receiving Feed Channel", "Network Channel Handler") in available_channels
+ . = TOPIC_REFRESH
+
+ else if(href_list["set_new_message"])
+ msg = pencode2html(sanitize(input(user, "Write your Feed story", "Network Channel Handler", "") as message|null))
+ . = TOPIC_REFRESH
+
+ else if(href_list["set_attachment"])
+ AttachPhoto(user)
+ . = TOPIC_REFRESH
+
+ else if(href_list["submit_new_message"])
+ if(msg =="" || msg=="\[REDACTED\]" || scanned_user == "Unknown" || channel_name == "" )
+ screen = SCREEN_STORY_FAILED
+ else
+ var/image = photo_data ? photo_data.photo : null
+ SSstatistics.add_field("newscaster_stories",1)
+ news_network.SubmitArticle(msg, scanned_user, channel_name, image, 0)
+ if(photo_data)
+ qdel(photo_data)
+ photo_data = null
+ screen = SCREEN_STORY_SUBMITTED
+
+ . = TOPIC_REFRESH
+
+ else if(href_list["create_channel"])
+ screen = SCREEN_CREATE_CHANNEL
+ . = TOPIC_REFRESH
+
+ else if(href_list["create_feed_story"])
+ screen = SCREEN_CREATE_STORY
+ . = TOPIC_REFRESH
+
+ else if(href_list["menu_paper"])
+ screen = SCREEN_CHOOSE_PRINT
+ . = TOPIC_REFRESH
+ else if(href_list["print_paper"])
+ if(!paper_remaining)
+ screen = SCREEN_PRINT_FAILED
+ else
+ print_paper()
+ screen = SCREEN_PRINT_COMPLETE
+ . = TOPIC_REFRESH
+
+ else if(href_list["menu_censor_story"])
+ screen = SCREEN_CENSOR_STORY
+ . = TOPIC_REFRESH
+
+ else if(href_list["menu_censor_channel"])
+ screen = SCREEN_CENSOR_CHANNEL
+ . = TOPIC_REFRESH
+
+ else if(href_list["menu_wanted"])
+ var/already_wanted = 0
+ if(news_network.wanted_issue)
+ already_wanted = 1
+
+ if(already_wanted)
+ channel_name = news_network.wanted_issue.author
+ msg = news_network.wanted_issue.body
+ screen = SCREEN_MAKE_WANTED_ISSUE
+ . = TOPIC_REFRESH
+
+ else if(href_list["set_wanted_name"])
+ channel_name = sanitize_safe(input(user, "Provide the name of the Wanted person", "Network Security Handler", ""), MAX_LNAME_LEN)
+ . = TOPIC_REFRESH
+
+ else if(href_list["set_wanted_desc"])
+ msg = sanitize(input(user, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", ""))
+ . = TOPIC_REFRESH
+
+ else if(href_list["submit_wanted"])
+ var/input_param = text2num(href_list["submit_wanted"])
+ if(msg == "" || channel_name == "" || scanned_user == "Unknown")
+ screen = SCREEN_WANTED_FAILED
+ else
+ var/choice = alert(user, "Please confirm Wanted Issue [(input_param==1) ? ("creation.") : ("edit.")]","Network Security Handler","Confirm","Cancel")
+ if(choice=="Confirm")
+ if(input_param==1) //If input_param == 1 we're submitting a new wanted issue. At 2 we're just editing an existing one. See the else below
+ var/datum/feed_message/WANTED = new /datum/feed_message
+ WANTED.author = channel_name
+ WANTED.body = msg
+ WANTED.backup_author = scanned_user //I know, a bit wacky
+ if(photo_data)
+ WANTED.img = photo_data.photo.img
+ news_network.wanted_issue = WANTED
+ news_network.alert_readers()
+ screen = SCREEN_WANTED_CONFIRMED
+ else
+ if(news_network.wanted_issue.is_admin_message)
+ alert(user, "The wanted issue has been distributed by a [global.using_map.company_name] higherup. You cannot edit it.","Ok")
+ return TOPIC_HANDLED
+ news_network.wanted_issue.author = channel_name
+ news_network.wanted_issue.body = msg
+ news_network.wanted_issue.backup_author = scanned_user
+ if(photo_data)
+ news_network.wanted_issue.img = photo_data.photo.img
+ screen = SCREEN_WANTED_EDITED
+
+ . = TOPIC_REFRESH
+
+ else if(href_list["cancel_wanted"])
+ if(news_network.wanted_issue.is_admin_message)
+ alert(user, "The wanted issue has been distributed by a [global.using_map.company_name] higherup. You cannot take it down.","Ok")
+ return
+ var/choice = alert(user, "Please confirm Wanted Issue removal","Network Security Handler","Confirm","Cancel")
+ if(choice=="Confirm")
+ news_network.wanted_issue = null
+ for(var/obj/machinery/newscaster/NEWSCASTER in allCasters)
+ NEWSCASTER.update_icon()
+ screen = SCREEN_WANTED_DELETED
+ . = TOPIC_REFRESH
+
+ else if(href_list["view_wanted"])
+ screen = SCREEN_WANTED_VIEW
+ . = TOPIC_REFRESH
+ else if(href_list["censor_channel_author"])
+ var/datum/feed_channel/FC = locate(href_list["censor_channel_author"])
+ if(FC.is_admin_channel)
+ alert(user, "This channel was created by a [global.using_map.company_name] Officer. You cannot censor it.","Ok")
+ return TOPIC_HANDLED
+ if(FC.author != "\[REDACTED\]")
+ FC.backup_author = FC.author
+ FC.author = "\[REDACTED\]"
+ else
+ FC.author = FC.backup_author
+ FC.update()
+ . = TOPIC_REFRESH
+
+ else if(href_list["censor_channel_story_author"])
+ var/datum/feed_message/MSG = locate(href_list["censor_channel_story_author"])
+ if(MSG.is_admin_message)
+ alert(user, "This message was created by a [global.using_map.company_name] Officer. You cannot censor its author.","Ok")
+ return TOPIC_HANDLED
+ if(MSG.author != "\[REDACTED\]")
+ MSG.backup_author = MSG.author
+ MSG.author = "\[REDACTED\]"
+ else
+ MSG.author = MSG.backup_author
+ MSG.parent_channel.update()
+ . = TOPIC_REFRESH
+
+ else if(href_list["censor_channel_story_body"])
+ var/datum/feed_message/MSG = locate(href_list["censor_channel_story_body"])
+ if(MSG.is_admin_message)
+ alert(user, "This channel was created by a [global.using_map.company_name] Officer. You cannot censor it.","Ok")
+ return TOPIC_HANDLED
+ if(MSG.body != "\[REDACTED\]")
+ MSG.backup_body = MSG.body
+ MSG.backup_caption = MSG.caption
+ MSG.backup_img = MSG.img
+ MSG.body = "\[REDACTED\]"
+ MSG.caption = "\[REDACTED\]"
+ MSG.img = null
+ else
+ MSG.body = MSG.backup_body
+ MSG.caption = MSG.caption
+ MSG.img = MSG.backup_img
+
+ MSG.parent_channel.update()
+ . = TOPIC_REFRESH
+
+ else if(href_list["pick_d_notice"])
+ var/datum/feed_channel/FC = locate(href_list["pick_d_notice"])
+ viewing_channel = FC
+ screen = SCREEN_PICK_CENSOR_CHANNEL
+ . = TOPIC_REFRESH
+
+ else if(href_list["toggle_d_notice"])
+ var/datum/feed_channel/FC = locate(href_list["toggle_d_notice"])
+ if(FC.is_admin_channel)
+ alert(user, "This channel was created by a [global.using_map.company_name] Officer. You cannot place a D-Notice upon it.","Ok")
+ return TOPIC_HANDLED
+ FC.censored = !FC.censored
+ FC.update()
+ . = TOPIC_REFRESH
+
+ else if(href_list["view"])
+ screen = SCREEN_VIEW_CHANNELS
+ . = TOPIC_REFRESH
+
+ else if(href_list["setScreen"]) //Brings us to the main menu and resets all fields~
+ screen = text2num(href_list["setScreen"])
+ if (screen == SCREEN_WELCOME)
+ scanned_user = "Unknown"
+ msg = ""
+ c_locked=0
+ channel_name=""
+ viewing_channel = null
+ if (photo_data)
+ qdel(photo_data)
+ photo_data = null
+ . = TOPIC_REFRESH
+
+ else if(href_list["show_channel"])
+ var/datum/feed_channel/FC = locate(href_list["show_channel"])
+ viewing_channel = FC
+ screen = SCREEN_VIEW_STORIES
+ . = TOPIC_REFRESH
+
+ else if(href_list["pick_censor_channel"])
+ var/datum/feed_channel/FC = locate(href_list["pick_censor_channel"])
+ viewing_channel = FC
+ screen = SCREEN_PICK_CENSOR_CHANNEL
+ . = TOPIC_REFRESH
+
+ else if(href_list["refresh"])
+ . = TOPIC_REFRESH
/datum/news_photo
- var/is_synth = 0
+ /// This var is currently unused.
+ var/is_synth = FALSE
+ /// The actual photo object to display to the user. TODO: Refactor to just copy the image from a photo?
var/obj/item/photo/photo = null
-/datum/news_photo/New(var/obj/item/photo/p, var/synth)
+/datum/news_photo/New(obj/item/photo/p, synth = FALSE)
is_synth = synth
photo = p
/obj/machinery/newscaster/proc/AttachPhoto(mob/user)
if(photo_data)
- qdel(photo_data)
- photo_data = null
+ QDEL_NULL(photo_data)
return
if(istype(user.get_active_held_item(), /obj/item/photo))
@@ -730,13 +741,14 @@ var/global/list/allCasters = list() //Global list that will contain reference to
if (!selection)
return
- photo_data = new(selection, 1)
+ photo_data = new(selection, TRUE)
//########################################################################################################################
//###################################### NEWSPAPER! ######################################################################
//########################################################################################################################
+// TODO: Rewrite newspapers to use pencode? Also change the name from The Griffon and do something about unnecessary mentions of space.
/obj/item/newspaper
name = "newspaper"
desc = "An issue of The Griffon, the space newspaper."
@@ -837,36 +849,37 @@ var/global/list/allCasters = list() //Global list that will contain reference to
to_chat(user, "The paper is full of unintelligible symbols!")
-/obj/item/newspaper/Topic(href, href_list)
- var/mob/living/U = usr
- ..()
- if ((src in U.contents) || ( isturf(loc) && in_range(src, U) ))
- U.set_machine(src)
- if(href_list["next_page"])
- if(curr_page==src.pages+1)
- return //Don't need that at all, but anyway.
- if(src.curr_page == src.pages) //We're at the middle, get to the end
- src.screen = 2
- else
- if(curr_page == 0) //We're at the start, get to the middle
- src.screen=1
- src.curr_page++
- playsound(src.loc, "pageturn", 50, 1)
+/obj/item/newspaper/DefaultTopicState()
+ return global.physical_no_access_topic_state
- else if(href_list["prev_page"])
- if(curr_page == 0)
- return
- if(curr_page == 1)
- src.screen = 0
+/obj/item/newspaper/OnTopic(mob/user, href_list, datum/topic_state/state)
+ if((. = ..()))
+ return
+ if(href_list["next_page"])
+ if(curr_page==src.pages+1)
+ return //Don't need that at all, but anyway.
+ if(src.curr_page == src.pages) //We're at the middle, get to the end
+ src.screen = 2
+ else
+ if(curr_page == 0) //We're at the start, get to the middle
+ src.screen=1
+ src.curr_page++
+ playsound(src.loc, "pageturn", 50, 1)
- else
- if(curr_page == src.pages+1) //we're at the end, let's go back to the middle.
- src.screen = 1
- src.curr_page--
- playsound(src.loc, "pageturn", 50, 1)
+ else if(href_list["prev_page"])
+ if(curr_page == 0)
+ return
+ if(curr_page == 1)
+ src.screen = 0
+
+ else
+ if(curr_page == src.pages+1) //we're at the end, let's go back to the middle.
+ src.screen = 1
+ src.curr_page--
+ playsound(src.loc, "pageturn", 50, 1)
- if (ismob(src.loc))
- src.attack_self(src.loc)
+ if (ismob(src.loc))
+ src.attack_self(src.loc)
/obj/item/newspaper/attackby(obj/item/W, mob/user)
diff --git a/code/game/machinery/nuclear_bomb.dm b/code/game/machinery/nuclear_bomb.dm
index dd3da2e44ae..28272033fa9 100644
--- a/code/game/machinery/nuclear_bomb.dm
+++ b/code/game/machinery/nuclear_bomb.dm
@@ -220,9 +220,9 @@ var/global/bomb_set
return 1
return 0
-/obj/machinery/nuclearbomb/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/nuclearbomb/OnTopic(mob/user, href_list, datum/topic_state/state)
+ if((. = ..()))
+ return
if(href_list["auth"])
if(auth)
@@ -230,13 +230,14 @@ var/global/bomb_set
yes_code = 0
auth = null
else
- var/obj/item/I = usr.get_active_held_item()
+ var/obj/item/I = user.get_active_held_item()
if(istype(I, /obj/item/disk/nuclear))
- if(!usr.try_unequip(I, src))
- return 1
+ if(!user.try_unequip(I, src))
+ return TOPIC_HANDLED
auth = I
- if(is_auth(usr))
+ if(is_auth(user))
if(href_list["type"])
+ . = TOPIC_REFRESH
if(href_list["type"] == "E")
if(code == r_code)
yes_code = 1
@@ -259,52 +260,56 @@ var/global/bomb_set
if(yes_code)
if(href_list["time"])
if(timing)
- to_chat(usr, "Cannot alter the timing during countdown.")
- return
+ to_chat(user, SPAN_WARNING("Cannot alter the timing during countdown."))
+ return TOPIC_HANDLED
var/time = text2num(href_list["time"])
timeleft += time
timeleft = clamp(timeleft, minTime, maxTime)
+ . = TOPIC_HANDLED
if(href_list["timer"])
if(timing == -1)
- return 1
+ return TOPIC_NOACTION
if(!anchored)
- to_chat(usr, "\The [src] needs to be anchored.")
- return 1
+ to_chat(user, SPAN_WARNING("\The [src] needs to be anchored."))
+ return TOPIC_HANDLED
if(safety)
- to_chat(usr, "The safety is still on.")
- return 1
+ to_chat(user, SPAN_WARNING("The safety is still on."))
+ return TOPIC_HANDLED
if(wires.IsIndexCut(NUCLEARBOMB_WIRE_TIMING))
- to_chat(usr, "Nothing happens, something might be wrong with the wiring.")
- return 1
+ to_chat(user, SPAN_WARNING("Nothing happens, something might be wrong with the wiring."))
+ return TOPIC_HANDLED
if(!timing && !safety)
- start_bomb(usr)
+ start_bomb(user)
+ . = TOPIC_HANDLED
else
check_cutoff()
+ . = TOPIC_HANDLED
if(href_list["safety"])
if (wires.IsIndexCut(NUCLEARBOMB_WIRE_SAFETY))
- to_chat(usr, "Nothing happens, something might be wrong with the wiring.")
- return 1
+ to_chat(user, SPAN_WARNING("Nothing happens, something might be wrong with the wiring."))
+ return TOPIC_HANDLED
safety = !safety
if(safety)
secure_device()
update_icon()
+ return TOPIC_REFRESH
if(href_list["anchor"])
if(removal_stage == 5)
anchored = FALSE
- visible_message("\The [src] makes a highly unpleasant crunching noise. It looks like the anchoring bolts have been cut.")
- return 1
+ visible_message(SPAN_WARNING("\The [src] makes a highly-unpleasant crunching noise. It looks like the anchoring bolts have been cut."), blind_message = SPAN_NOTICE("You hear a highly-unpleasant crunching noise."))
+ return TOPIC_HANDLED
if(!isspaceturf(get_turf(src)))
anchored = !anchored
if(anchored)
- visible_message("With a steely snap, bolts slide out of \the [src] and anchor it to the flooring.")
+ visible_message(SPAN_WARNING("With a steely snap, bolts slide out of \the [src] and anchor it to the flooring."), blind_message = SPAN_NOTICE("You hear a steely snap."))
else
secure_device()
- visible_message("The anchoring bolts slide back into the depths of \the [src].")
+ visible_message(SPAN_WARNING("The anchoring bolts slide back into the depths of \the [src]."), blind_message = SPAN_NOTICE("You hear a steely snap."))
+ return TOPIC_HANDLED
else
- to_chat(usr, "There is nothing to anchor to!")
- return 1
+ to_chat(user, SPAN_WARNING("There is nothing to anchor to!"))
/obj/machinery/nuclearbomb/proc/start_bomb(user)
timing = 1
@@ -472,12 +477,10 @@ var/global/bomb_set
/obj/machinery/nuclearbomb/station/attackby(obj/item/O, mob/user)
return TRUE // cannot be moved
-/obj/machinery/nuclearbomb/station/Topic(href, href_list)
- if((. = ..()))
- return
-
+/obj/machinery/nuclearbomb/station/OnTopic(mob/user, href_list, datum/topic_state/state)
if(href_list["anchor"])
- return
+ return TOPIC_NOACTION
+ return ..()
/obj/machinery/nuclearbomb/station/start_bomb(mob/user)
for(var/inserter in inserters)
diff --git a/code/game/machinery/oxygen_pump.dm b/code/game/machinery/oxygen_pump.dm
index eddac12ba39..615a1243831 100644
--- a/code/game/machinery/oxygen_pump.dm
+++ b/code/game/machinery/oxygen_pump.dm
@@ -219,9 +219,9 @@
// auto update every Master Controller tick
ui.set_auto_update(1)
-/obj/machinery/oxygen_pump/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/oxygen_pump/OnTopic(mob/user, href_list, datum/topic_state/state)
+ if((. = ..()))
+ return
if (href_list["dist_p"])
if (href_list["dist_p"] == "reset")
@@ -232,4 +232,4 @@
var/cp = text2num(href_list["dist_p"])
tank.distribute_pressure += cp
tank.distribute_pressure = min(max(round(tank.distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
- return 1
+ . = TOPIC_REFRESH // Refreshing is handled in machinery/Topic
diff --git a/code/game/machinery/pager.dm b/code/game/machinery/pager.dm
index 0777eb14361..9bee6cc752c 100644
--- a/code/game/machinery/pager.dm
+++ b/code/game/machinery/pager.dm
@@ -43,16 +43,14 @@
else
to_chat(user,"No valid destinations were found for the page.")
-/obj/machinery/network/pager/Topic(href, href_list)
- if(..())
- return 1
- if(stat & NOPOWER)
+/obj/machinery/network/pager/OnTopic(mob/user, href_list, datum/topic_state/state)
+ if((. = ..()))
return
if(!acknowledged && href_list["ack"])
playsound(src, 'sound/machines/ping.ogg', 60)
visible_message("Page acknowledged.")
acknowledged = 1
+ . = TOPIC_REFRESH
var/obj/machinery/network/message_server/MS = get_message_server(z)
- if(!MS)
- return
- MS.send_to_department(department,"Page to [location.proper_name] was acknowledged.", "*ack*")
+ if(MS)
+ MS.send_to_department(department,"Page to [location.proper_name] was acknowledged.", "*ack*")
diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm
index 286ac6310cc..0fde815d132 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/portable_turret.dm
@@ -199,9 +199,9 @@ var/global/list/turret_icons
return ..()
-/obj/machinery/porta_turret/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/porta_turret/OnTopic(mob/user, href_list, datum/topic_state/state)
+ if((. = ..()))
+ return
if(href_list["command"] && href_list["value"])
var/value = text2num(href_list["value"])
@@ -221,8 +221,7 @@ var/global/list/turret_icons
check_access = value
else if(href_list["command"] == "check_anomalies")
check_anomalies = value
-
- return 1
+ . = TOPIC_REFRESH
/obj/machinery/porta_turret/physically_destroyed(skip_qdel)
if(installation)
diff --git a/code/game/machinery/smartfridge/_smartfridge.dm b/code/game/machinery/smartfridge/_smartfridge.dm
index 28f51fab493..c446e87a438 100644
--- a/code/game/machinery/smartfridge/_smartfridge.dm
+++ b/code/game/machinery/smartfridge/_smartfridge.dm
@@ -201,35 +201,30 @@
ui.set_initial_data(data)
ui.open()
-/obj/machinery/smartfridge/Topic(href, href_list)
- if(..()) return 0
-
- var/mob/user = usr
- var/datum/nanoui/ui = SSnano.get_open_ui(user, src, "main")
+/obj/machinery/smartfridge/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["close"])
- user.unset_machine()
- ui.close()
- return 0
+ return TOPIC_CLOSE
if(href_list["vend"])
var/index = text2num(href_list["vend"])
- var/amount = text2num(href_list["amount"])
var/datum/stored_items/I = item_records[index]
var/count = I.get_amount()
+ var/amount = clamp(text2num(href_list["amount"]), 0, count)
// Sanity check, there are probably ways to press the button when it shouldn't be possible.
- if(count > 0)
- if((count - amount) < 0)
- amount = count
- for(var/i = 1 to amount)
- I.get_product(get_turf(src))
- update_icon()
- var/vend_state = "[icon_state]-vend"
- if (check_state_in_icon(vend_state, icon)) //Show the vending animation if needed
- flick(vend_state, src)
- return 1
- return 0
+ if(amount <= 0)
+ return TOPIC_REFRESH // you must be confused, we have none of that here!
+ for(var/i = 1 to amount)
+ I.get_product(get_turf(src))
+ update_icon()
+ var/vend_state = "[icon_state]-vend"
+ if (check_state_in_icon(vend_state, icon)) //Show the vending animation if needed
+ flick(vend_state, src)
+ return TOPIC_REFRESH
+ return TOPIC_NOACTION
/obj/machinery/smartfridge/proc/throw_item()
var/obj/throw_item = null
diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm
index b77c56ffdac..30d1ae2ef8c 100644
--- a/code/game/machinery/spaceheater.dm
+++ b/code/game/machinery/spaceheater.dm
@@ -52,59 +52,57 @@
/obj/machinery/space_heater/state_transition(decl/machine_construction/new_state, mob/user)
. = ..()
- if(istype(new_state, /decl/machine_construction/default/panel_open) && CanInteract(user, DefaultTopicState()))
- interact(user)
+ if(istype(new_state, /decl/machine_construction/default/panel_closed) || !CanInteract(user, DefaultTopicState()))
+ SSnano.close_uis(src)
+ else if(istype(new_state, /decl/machine_construction/default/panel_open))
+ SSnano.update_uis(src)
/obj/machinery/space_heater/interface_interact(mob/user)
if(panel_open)
interact(user)
return TRUE
-/obj/machinery/space_heater/interact(mob/user)
- if(panel_open)
- var/list/dat = list()
- var/obj/item/cell/cell = get_cell()
- dat += "Power cell: "
- if(cell)
- dat += "Installed
"
- else
- dat += "Removed
"
-
- dat += "Power Level: [cell ? round(cell.percent(),1) : 0]%
"
-
- dat += "Set Temperature: "
-
- dat += "-"
-
- dat += " [set_temperature]K ([set_temperature-T0C]°C)"
- dat += "+
"
-
- var/datum/browser/popup = new(user, "spaceheater", "Space Heater Control Panel")
- popup.set_content(jointext(dat, null))
- popup.open()
+/obj/machinery/space_heater/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, datum/topic_state/state = global.physical_no_access_topic_state)
+ if(!panel_open)
+ SSnano.close_uis(src) // should be handled in state_transition, but just in case
+ return
+ var/obj/item/cell/cell = get_cell()
+ var/list/data = list(
+ "has_cell" = !!cell,
+ "cell_percent" = cell?.percent(),
+ "set_temperature" = set_temperature,
+ )
+ // update the ui if it exists, returns null if no ui is passed/found
+ ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open)
+ if(!ui)
+ ui = new(user, src, ui_key, "space_heater.tmpl", "Space Heater Control Panel")
+ ui.set_initial_data(data)
+ ui.open()
/obj/machinery/space_heater/physical_attack_hand(mob/user)
if(!panel_open)
on = !on
- user.visible_message("[user] switches [on ? "on" : "off"] \the [src].","You switch [on ? "on" : "off"] \the [src].")
+ user.visible_message(
+ SPAN_NOTICE("[user] switches [on ? "on" : "off"] \the [src]."),
+ SPAN_NOTICE("You switch [on ? "on" : "off"] \the [src]."),
+ SPAN_NOTICE("You hear a [on ? "machine rumble to life" : "rumbling machine go silent"].")
+ )
update_icon()
return TRUE
return FALSE
-/obj/machinery/space_heater/Topic(href, href_list, state = global.physical_topic_state)
- if (..())
- show_browser(usr, null, "window=spaceheater")
- usr.unset_machine()
- return 1
-
- switch(href_list["op"])
- if("temp")
- var/value = text2num(href_list["val"])
-
- // limit to 0-90 degC
- set_temperature = clamp(set_temperature + value, T0C, T0C + 90)
-
- updateDialog()
+// This machine has physical, mechanical buttons.
+/obj/machinery/space_heater/DefaultTopicState()
+ return global.physical_topic_state
+
+/obj/machinery/space_heater/OnTopic(mob/user, href_list, state)
+ if ((. = ..()))
+ return
+ if(href_list["adj_temp"])
+ var/old_temperature = set_temperature
+ set_temperature = clamp(round(set_temperature + text2num(href_list["adj_temp"])), T0C, 90 CELSIUS) // 90C is pretty damn hot but okay
+ if(old_temperature != set_temperature)
+ . = TOPIC_REFRESH
/obj/machinery/space_heater/power_change()
. = ..()
diff --git a/code/game/machinery/suit_cycler.dm b/code/game/machinery/suit_cycler.dm
index f1721eeec37..fd147aef424 100644
--- a/code/game/machinery/suit_cycler.dm
+++ b/code/game/machinery/suit_cycler.dm
@@ -10,17 +10,17 @@
initial_access = list(list(access_captain, access_bridge))
- var/active = 0 // PLEASE HOLD.
- var/safeties = 1 // The cycler won't start with a living thing inside it unless safeties are off.
- var/irradiating = 0 // If this is > 0, the cycler is decontaminating whatever is inside it.
+ var/active = FALSE // PLEASE HOLD.
+ var/safeties = TRUE //! The cycler won't start with a living thing inside it unless safeties are off.
+ var/irradiating = 0 //! The number of Process() ticks we should irradiate our contents for. If > 0, will irradiate contents. Decrements every Process().
var/radiation_level = 2 // 1 is removing germs, 2 is removing blood, 3 is removing contaminants.
- var/model_text = "" // Some flavour text for the topic box.
- var/locked = 1 // If locked, nothing can be taken from or added to the cycler.
- var/can_repair = 1 // If set, the cycler can repair voidsuits.
- var/electrified = 0 // If set, will shock users.
+ var/model_text = "" //! Some flavour text for the topic box.
+ var/locked = TRUE //! If locked, nothing can be taken from or added to the cycler.
+ var/can_repair = TRUE //! If TRUE, the cycler can repair voidsuits.
+ var/electrified = 0 //! The number of Process() ticks we should shock users for. If > 0, will shock users. Decrements every Process().
- // Possible modifications to pick between
- var/list/available_modifications = list(
+ /// Possible suit modifier decls to pick between
+ var/list/decl/item_modifier/space_suit/available_modifications = list(
/decl/item_modifier/space_suit/engineering,
/decl/item_modifier/space_suit/mining,
/decl/item_modifier/space_suit/medical,
@@ -31,7 +31,7 @@
)
// Extra modifications to add when emagged, duplicates won't be added
- var/emagged_modifications = list(
+ var/list/decl/item_modifier/space_suit/emagged_modifications = list(
/decl/item_modifier/space_suit/engineering,
/decl/item_modifier/space_suit/mining,
/decl/item_modifier/space_suit/medical,
@@ -269,7 +269,7 @@
available_modifications |= additional_modifications
emagged = 1
- safeties = 0
+ safeties = FALSE
req_access = list()
updateUsrDialog()
return 1
@@ -320,95 +320,98 @@
popup.set_content(JOINTEXT(dat))
popup.open()
-/obj/machinery/suit_cycler/Topic(href, href_list)
+/obj/machinery/suit_cycler/OnTopic(user, href_list)
if((. = ..()))
return
if(href_list["eject_suit"])
- if(!suit) return
+ if(!suit) return TOPIC_NOACTION
suit.dropInto(loc)
set_suit(null)
else if(href_list["eject_helmet"])
- if(!helmet) return
+ if(!helmet) return TOPIC_NOACTION
helmet.dropInto(loc)
set_helmet(null)
else if(href_list["eject_boots"])
- if(!boots) return
+ if(!boots) return TOPIC_NOACTION
boots.dropInto(loc)
set_boots(null)
else if(href_list["select_department"])
- var/choice = input("Please select the target department paintjob.", "Suit cycler", target_modification) as null|anything in available_modifications
- if(choice && CanPhysicallyInteract(usr))
+ var/choice = input(user, "Please select the target department paintjob.", "Suit cycler", target_modification) as null|anything in available_modifications
+ . = TOPIC_HANDLED // no matter what, we've prompted for user input so we cancel any further behavior on subtypes
+ if(choice && CanPhysicallyInteract(user))
target_modification = choice
+ . = TOPIC_REFRESH
else if(href_list["select_bodytype"])
var/choice = input("Please select the target body configuration.","Suit cycler",null) as null|anything in available_bodytypes
- if(choice && CanPhysicallyInteract(usr))
+ . = TOPIC_HANDLED
+ if(choice && CanPhysicallyInteract(user))
target_bodytype = choice
+ . = TOPIC_REFRESH
else if(href_list["select_rad_level"])
var/choices = list(1,2,3)
if(emagged)
choices = list(1,2,3,4,5)
var/choice = input("Please select the desired radiation level.","Suit cycler",null) as null|anything in choices
+ . = TOPIC_HANDLED
if(choice)
radiation_level = choice
+ . = TOPIC_REFRESH
else if(href_list["repair_suit"])
-
- if(!suit || !can_repair) return
- active = 1
- spawn(100)
- repair_suit()
- finished_job()
+ if(!suit || !can_repair) return TOPIC_NOACTION
+ active = TRUE
+ addtimer(CALLBACK(src, PROC_REF(repair_suit)), 10 SECONDS)
+ . = TOPIC_REFRESH
else if(href_list["apply_paintjob"])
-
- if(!suit && !helmet) return
- active = 1
- spawn(100)
- apply_paintjob()
- finished_job()
+ if(!suit && !helmet) return TOPIC_NOACTION
+ active = TRUE
+ addtimer(CALLBACK(src, PROC_REF(apply_paintjob)), 10 SECONDS)
+ . = TOPIC_REFRESH
else if(href_list["toggle_safties"])
safeties = !safeties
+ . = TOPIC_REFRESH
else if(href_list["toggle_lock"])
-
- if(allowed(usr))
+ if(allowed(user))
locked = !locked
- to_chat(usr, "You [locked ? "lock" : "unlock"] [src].")
+ to_chat(user, "You [locked ? "lock" : "unlock"] [src].")
+ . = TOPIC_REFRESH
else
- to_chat(usr, FEEDBACK_ACCESS_DENIED)
+ to_chat(user, FEEDBACK_ACCESS_DENIED)
+ . = TOPIC_HANDLED
else if(href_list["begin_decontamination"])
-
if(safeties && occupant)
- to_chat(usr, SPAN_DANGER("\The [src] has detected an occupant. Please remove the occupant before commencing the decontamination cycle."))
- return
+ to_chat(user, SPAN_DANGER("\The [src] has detected an occupant. Please remove the occupant before commencing the decontamination cycle."))
+ return TOPIC_HANDLED
- active = 1
+ active = TRUE
irradiating = 10
- update_icon()
- updateUsrDialog()
-
- sleep(10)
+ . = TOPIC_REFRESH
+ addtimer(CALLBACK(src, PROC_REF(finish_decontamination)), 1 SECOND)
+ update_icon()
+/obj/machinery/suit_cycler/proc/finish_decontamination()
+ if(active && operable()) // doesn't currently use power when active, but maybe it should?
if(helmet)
if(radiation_level > 2)
helmet.decontaminate()
if(radiation_level > 1)
helmet.clean()
-
if(suit)
if(radiation_level > 2)
suit.decontaminate()
if(radiation_level > 1)
suit.clean()
-
if(boots)
if(radiation_level > 2)
boots.decontaminate()
if(radiation_level > 1)
boots.clean()
-
+ // maybe add a failure message if it's been interrupted by the time decontamination finishes?
+ // Update post-decontamination
update_icon()
updateUsrDialog()
@@ -420,7 +423,7 @@
return
if(active && stat & (BROKEN|NOPOWER))
- active = 0
+ active = FALSE
irradiating = 0
electrified = 0
update_icon()
@@ -447,7 +450,7 @@
/obj/machinery/suit_cycler/proc/finished_job()
var/turf/T = get_turf(src)
T.visible_message(SPAN_NOTICE("\The [src] pings loudly."))
- active = 0
+ active = FALSE
updateUsrDialog()
update_icon()
@@ -457,6 +460,7 @@
suit.breaches = list()
suit.calc_breach_damage()
+ finished_job()
/obj/machinery/suit_cycler/verb/leave()
set name = "Eject Cycler"
@@ -497,3 +501,4 @@
suit.refit_for_bodytype(target_bodytype)
if(boots)
boots.refit_for_bodytype(target_bodytype)
+ finished_job()
diff --git a/code/game/machinery/turret_control.dm b/code/game/machinery/turret_control.dm
index c7c2924326f..235da1f889f 100644
--- a/code/game/machinery/turret_control.dm
+++ b/code/game/machinery/turret_control.dm
@@ -136,10 +136,9 @@
ui.open()
ui.set_auto_update(1)
-/obj/machinery/turretid/Topic(href, href_list)
- if(..())
- return 1
-
+/obj/machinery/turretid/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["command"] && href_list["value"])
var/log_action = null
@@ -167,10 +166,10 @@
check_anomalies = value
if(!isnull(log_action))
- log_and_message_admins("has [log_action]", usr, loc)
+ log_and_message_admins("has [log_action]", user, loc)
updateTurrets()
- return 1
+ return TOPIC_REFRESH
/obj/machinery/turretid/proc/updateTurrets()
var/datum/turret_checks/TC = new
diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm
index 83b3d2bfb85..b2ecbe81e5a 100644
--- a/code/game/objects/items/weapons/tanks/tanks.dm
+++ b/code/game/objects/items/weapons/tanks/tanks.dm
@@ -282,8 +282,8 @@ var/global/list/global/tank_gauge_cache = list()
// auto update every Master Controller tick
ui.set_auto_update(1)
-/obj/item/tank/Topic(user, href_list, state = global.inventory_topic_state)
- ..()
+/obj/item/tank/DefaultTopicState()
+ return global.inventory_topic_state
/obj/item/tank/OnTopic(user, href_list)
if (href_list["dist_p"])
diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm
index b2ed1afb24a..fb9f17eeb07 100644
--- a/code/game/objects/structures/janicart.dm
+++ b/code/game/objects/structures/janicart.dm
@@ -111,49 +111,50 @@
ui.set_initial_data(data)
ui.open()
-/obj/structure/janitorialcart/Topic(href, href_list)
- if(!in_range(src, usr))
- return
- if(!isliving(usr))
- return
- var/mob/living/user = usr
-
- if(href_list["take"])
- switch(href_list["take"])
- if("garbage")
- if(mybag)
- user.put_in_hands(mybag)
- to_chat(user, "You take [mybag] from [src].")
- mybag = null
- if("mop")
- if(mymop)
- user.put_in_hands(mymop)
- to_chat(user, "You take [mymop] from [src].")
- mymop = null
- if("spray")
- if(myspray)
- user.put_in_hands(myspray)
- to_chat(user, "You take [myspray] from [src].")
- myspray = null
- if("replacer")
- if(myreplacer)
- user.put_in_hands(myreplacer)
- to_chat(user, "You take [myreplacer] from [src].")
- myreplacer = null
- if("sign")
- if(signs)
- var/obj/item/caution/Sign = locate() in src
- if(Sign)
- user.put_in_hands(Sign)
- to_chat(user, "You take \a [Sign] from [src].")
- signs--
- else
- warning("[src] signs ([signs]) didn't match contents")
- signs = 0
-
- update_icon()
- updateUsrDialog()
-
+/obj/structure/janitorialcart/OnTopic(mob/user, href_list)
+ switch(href_list["take"])
+ if("garbage")
+ if(mybag)
+ user.put_in_hands(mybag)
+ to_chat(user, "You take [mybag] from [src].")
+ mybag = null
+ return TOPIC_REFRESH
+ return TOPIC_HANDLED
+ if("mop")
+ if(mymop)
+ user.put_in_hands(mymop)
+ to_chat(user, "You take [mymop] from [src].")
+ mymop = null
+ return TOPIC_REFRESH
+ return TOPIC_HANDLED
+ if("spray")
+ if(myspray)
+ user.put_in_hands(myspray)
+ to_chat(user, "You take [myspray] from [src].")
+ myspray = null
+ return TOPIC_REFRESH
+ return TOPIC_HANDLED
+ if("replacer")
+ if(myreplacer)
+ user.put_in_hands(myreplacer)
+ to_chat(user, "You take [myreplacer] from [src].")
+ myreplacer = null
+ return TOPIC_REFRESH
+ return TOPIC_HANDLED
+ if("sign")
+ if(signs)
+ var/obj/item/caution/Sign = locate() in src
+ if(Sign)
+ user.put_in_hands(Sign)
+ to_chat(user, "You take \a [Sign] from [src].")
+ signs--
+ else
+ warning("[src] signs ([signs]) didn't match contents")
+ signs = 0
+ return TOPIC_REFRESH
+ return TOPIC_HANDLED
+ else
+ return TOPIC_NOACTION
/obj/structure/janitorialcart/on_update_icon()
..()
diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm
index 10db1cd1afb..5257b0607a9 100644
--- a/code/game/objects/structures/safe.dm
+++ b/code/game/objects/structures/safe.dm
@@ -85,20 +85,18 @@ FLOOR SAFES
show_browser(user, "[name][dat]", "window=safe;size=350x300")
return TRUE
-/obj/structure/safe/Topic(href, href_list)
- if(!ishuman(usr)) return
- var/mob/living/human/user = usr
+/obj/structure/safe/DefaultTopicState()
+ return global.physical_no_access_topic_state
+/obj/structure/safe/OnTopic(mob/user, href_list, state)
if(href_list["open"])
if(check_unlocked())
to_chat(user, "You [open ? "close" : "open"] [src].")
open = !open
- update_icon()
- updateUsrDialog()
- return
+ return TOPIC_REFRESH
else
to_chat(user, "You can't [open ? "close" : "open"] [src], the lock is engaged!")
- return
+ return TOPIC_HANDLED
var/canhear = locate(/obj/item/clothing/neck/stethoscope) in user.get_held_items()
if(href_list["decrement"])
@@ -112,8 +110,7 @@ FLOOR SAFES
if(canhear)
to_chat(user, "You hear a [pick("click", "chink", "clink")] from [src].")
check_unlocked(user, canhear)
- updateUsrDialog()
- return
+ return TOPIC_REFRESH
if(href_list["increment"])
dial = increment(dial)
@@ -126,17 +123,15 @@ FLOOR SAFES
if(canhear)
to_chat(user, "You hear a [pick("click", "chink", "clink")] from [src].")
check_unlocked(user, canhear)
- updateUsrDialog()
- return
+ return TOPIC_REFRESH
if(href_list["retrieve"])
- close_browser(user, "window=safe") // Close the menu
-
+ if(!open)
+ return TOPIC_CLOSE // Close the menu
var/obj/item/P = locate(href_list["retrieve"]) in src
- if(open)
- if(P && in_range(src, user))
- user.put_in_hands(P)
- updateUsrDialog()
+ if(P && CanPhysicallyInteract(user))
+ user.put_in_hands(P)
+ return TOPIC_REFRESH
/obj/structure/safe/attackby(obj/item/I, mob/user)
diff --git a/code/game/objects/structures/under_wardrobe.dm b/code/game/objects/structures/under_wardrobe.dm
index e8f8ab1e513..815a1405394 100644
--- a/code/game/objects/structures/under_wardrobe.dm
+++ b/code/game/objects/structures/under_wardrobe.dm
@@ -69,49 +69,44 @@
return ..()
-/obj/structure/undies_wardrobe/Topic(href, href_list, state)
- if(..())
- return TRUE
+/obj/structure/undies_wardrobe/OnTopic(mob/user, href_list, state)
+ if((. = ..()))
+ return
- var/mob/living/human/H = usr
if(href_list["select_underwear"])
var/datum/category_group/underwear/UWC = global.underwear.categories_by_name[href_list["select_underwear"]]
if(!UWC)
- return
- var/datum/category_item/underwear/UWI = input("Select your desired underwear:", "Choose underwear") as null|anything in exclude_none(UWC.items)
+ return TOPIC_HANDLED
+ var/datum/category_item/underwear/UWI = input(user, "Select your desired underwear:", "Choose underwear") as null|anything in exclude_none(UWC.items)
if(!UWI)
- return
+ return TOPIC_HANDLED
var/list/metadata_list = list()
for(var/tweak in UWI.tweaks)
var/datum/gear_tweak/gt = tweak
- var/metadata = gt.get_metadata(H, title = "Adjust underwear")
+ var/metadata = gt.get_metadata(user, title = "Adjust underwear")
if(!metadata)
- return
+ return TOPIC_HANDLED
metadata_list["[gt]"] = metadata
- if(!CanInteract(H, state))
- return
+ if(!CanInteract(user, state))
+ return TOPIC_HANDLED
- var/id = H.GetIdCard()
+ var/id = user.GetIdCard()
if(!id)
- audible_message("No ID card detected. Unable to acquire your underwear quota for this shift.", WARDROBE_BLIND_MESSAGE(H))
- return
+ audible_message("No ID card detected. Unable to acquire your underwear quota for this shift.", WARDROBE_BLIND_MESSAGE(user))
+ return TOPIC_HANDLED
var/current_quota = LAZYACCESS(amount_of_underwear_by_id_card, id)
if(current_quota >= length(global.underwear.categories))
- audible_message("You have already used up your underwear quota for this shift. Please return previously acquired items to increase it.", WARDROBE_BLIND_MESSAGE(H))
- return
+ audible_message("You have already used up your underwear quota for this shift. Please return previously acquired items to increase it.", WARDROBE_BLIND_MESSAGE(user))
+ return TOPIC_HANDLED
LAZYSET(amount_of_underwear_by_id_card, id, ++current_quota)
- var/obj/UW = UWI.create_underwear(H, metadata_list)
- UW.forceMove(loc)
- H.put_in_hands(UW)
-
- . = TRUE
-
- if(.)
- interact(H)
+ var/obj/UW = UWI.create_underwear(user, metadata_list)
+ UW.dropInto(loc)
+ user.put_in_hands(UW)
+ . = TOPIC_REFRESH
/obj/structure/undies_wardrobe/proc/exclude_none(var/list/L)
. = L.Copy()
diff --git a/code/modules/alarm/atmosphere_alarm.dm b/code/modules/alarm/atmosphere_alarm.dm
index 8786d19fd73..48e134a457d 100644
--- a/code/modules/alarm/atmosphere_alarm.dm
+++ b/code/modules/alarm/atmosphere_alarm.dm
@@ -1,9 +1,6 @@
/datum/alarm_handler/atmosphere
category = NETWORK_ALARM_ATMOS
-/datum/alarm_handler/atmosphere/triggerAlarm(var/atom/origin, var/atom/source, var/duration = 0, var/severity = 1)
- ..()
-
/datum/alarm_handler/atmosphere/major_alarms(var/z_level)
. = list()
for(var/datum/alarm/A in ..())
diff --git a/code/modules/atmospherics/components/binary_devices/oxyregenerator.dm b/code/modules/atmospherics/components/binary_devices/oxyregenerator.dm
index 2fd2be5111f..d6c54d48acc 100644
--- a/code/modules/atmospherics/components/binary_devices/oxyregenerator.dm
+++ b/code/modules/atmospherics/components/binary_devices/oxyregenerator.dm
@@ -136,13 +136,12 @@
ui.open()
ui.set_auto_update(1)
-/obj/machinery/atmospherics/binary/oxyregenerator/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/atmospherics/binary/oxyregenerator/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["toggleStatus"])
update_use_power(!use_power)
- update_icon()
- return 1
+ return TOPIC_REFRESH
if(href_list["setPower"]) //setting power to 0 is redundant anyways
power_setting = clamp(text2num(href_list["setPower"]), 1, 5)
- return 1
+ return TOPIC_REFRESH
diff --git a/code/modules/atmospherics/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/components/binary_devices/passive_gate.dm
index dfa4e594c86..c55ea099f96 100644
--- a/code/modules/atmospherics/components/binary_devices/passive_gate.dm
+++ b/code/modules/atmospherics/components/binary_devices/passive_gate.dm
@@ -138,40 +138,48 @@
ui.set_auto_update(1) // auto update every Master Controller tick
-/obj/machinery/atmospherics/binary/passive_gate/Topic(href,href_list)
- if(..()) return 1
+/obj/machinery/atmospherics/binary/passive_gate/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["toggle_valve"])
unlocked = !unlocked
-
- if(href_list["regulate_mode"])
- switch(href_list["regulate_mode"])
- if ("off") regulate_mode = REGULATE_NONE
- if ("input") regulate_mode = REGULATE_INPUT
- if ("output") regulate_mode = REGULATE_OUTPUT
+ . = TOPIC_REFRESH
+
+ switch(href_list["regulate_mode"])
+ if ("off")
+ regulate_mode = REGULATE_NONE
+ . = TOPIC_REFRESH
+ if ("input")
+ regulate_mode = REGULATE_INPUT
+ . = TOPIC_REFRESH
+ if ("output")
+ regulate_mode = REGULATE_OUTPUT
+ . = TOPIC_REFRESH
switch(href_list["set_press"])
if ("min")
target_pressure = 0
+ . = TOPIC_REFRESH
if ("max")
target_pressure = max_pressure_setting
+ . = TOPIC_REFRESH
if ("set")
- var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure Control",src.target_pressure) as num
- src.target_pressure = clamp(new_pressure, 0, max_pressure_setting)
+ var/new_pressure = input(user, "Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure Control",target_pressure) as num
+ target_pressure = clamp(new_pressure, 0, max_pressure_setting)
+ . = TOPIC_REFRESH
switch(href_list["set_flow_rate"])
if ("min")
set_flow_rate = 0
+ . = TOPIC_REFRESH
if ("max")
set_flow_rate = air1.volume
+ . = TOPIC_REFRESH
if ("set")
- var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[air1.volume]kPa)","Flow Rate Control",src.set_flow_rate) as num
- src.set_flow_rate = clamp(new_flow_rate, 0, air1.volume)
-
- usr.set_machine(src) //Is this even needed with NanoUI?
- src.update_icon()
- src.add_fingerprint(usr)
- return
+ var/new_flow_rate = input(user, "Enter new flow rate limit (0-[air1.volume]kPa)","Flow Rate Control",set_flow_rate) as num
+ set_flow_rate = clamp(new_flow_rate, 0, air1.volume)
+ . = TOPIC_REFRESH
/obj/machinery/atmospherics/binary/passive_gate/proc/toggle_unlocked()
unlocked = !unlocked
diff --git a/code/modules/atmospherics/components/binary_devices/pump.dm b/code/modules/atmospherics/components/binary_devices/pump.dm
index 858f44da07a..b1ec04c332d 100644
--- a/code/modules/atmospherics/components/binary_devices/pump.dm
+++ b/code/modules/atmospherics/components/binary_devices/pump.dm
@@ -141,27 +141,25 @@ Thus, the two variables affect pump operation are set in New():
ui_interact(user)
return TRUE
-/obj/machinery/atmospherics/binary/pump/Topic(href,href_list)
- if((. = ..())) return
+/obj/machinery/atmospherics/binary/pump/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["power"])
update_use_power(!use_power)
- . = 1
+ . = TOPIC_REFRESH
switch(href_list["set_press"])
if ("min")
target_pressure = 0
- . = 1
+ . = TOPIC_REFRESH
if ("max")
target_pressure = max_pressure_setting
- . = 1
+ . = TOPIC_REFRESH
if ("set")
- var/new_pressure = input(usr,"Enter new output pressure (0-[max_pressure_setting]kPa)","Pressure control",src.target_pressure) as num
- src.target_pressure = clamp(new_pressure, 0, max_pressure_setting)
- . = 1
-
- if(.)
- src.update_icon()
+ var/new_pressure = input(user, "Enter new output pressure (0-[max_pressure_setting]kPa)", "Pressure control", target_pressure) as num
+ target_pressure = clamp(new_pressure, 0, max_pressure_setting)
+ . = TOPIC_REFRESH
/obj/machinery/atmospherics/binary/pump/cannot_transition_to(state_path, mob/user)
if(state_path == /decl/machine_construction/default/deconstructed)
diff --git a/code/modules/atmospherics/components/omni_devices/filter.dm b/code/modules/atmospherics/components/omni_devices/filter.dm
index ae66c0bddcf..1c140c763a7 100644
--- a/code/modules/atmospherics/components/omni_devices/filter.dm
+++ b/code/modules/atmospherics/components/omni_devices/filter.dm
@@ -168,15 +168,18 @@
var/decl/material/gas/G = GET_DECL(P.filtering)
return G.gas_symbol
-/obj/machinery/atmospherics/omni/filter/Topic(href, href_list)
- if(..()) return 1
+/obj/machinery/atmospherics/omni/filter/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
switch(href_list["command"])
if("power")
+ . = TOPIC_REFRESH
if(!configuring)
update_use_power(!use_power)
else
update_use_power(POWER_USE_OFF)
if("configure")
+ . = TOPIC_REFRESH
configuring = !configuring
if(configuring)
update_use_power(POWER_USE_OFF)
@@ -187,16 +190,16 @@
if("set_flow_rate")
var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",set_flow_rate) as num
set_flow_rate = clamp(0, new_flow_rate, max_flow_rate)
+ . = TOPIC_REFRESH
if("switch_mode")
switch_mode(dir_flag(href_list["dir"]), mode_return_switch(href_list["mode"]))
+ . = TOPIC_REFRESH
if("switch_filter")
var/new_filter = input(usr,"Select filter mode:","Change filter",href_list["mode"]) in gas_decls_by_symbol_cache
+ . = TOPIC_HANDLED
if(global.materials_by_gas_symbol[new_filter])
switch_filter(dir_flag(href_list["dir"]), ATM_FILTER, global.materials_by_gas_symbol[new_filter])
-
- update_icon()
- SSnano.update_uis(src)
- return
+ . = TOPIC_REFRESH
/obj/machinery/atmospherics/omni/filter/proc/mode_return_switch(var/mode)
switch(mode)
diff --git a/code/modules/atmospherics/components/omni_devices/mixer.dm b/code/modules/atmospherics/components/omni_devices/mixer.dm
index a7bca1ad61d..483e114a9f6 100644
--- a/code/modules/atmospherics/components/omni_devices/mixer.dm
+++ b/code/modules/atmospherics/components/omni_devices/mixer.dm
@@ -186,16 +186,19 @@
return data
-/obj/machinery/atmospherics/omni/mixer/Topic(href, href_list)
- if(..()) return 1
+/obj/machinery/atmospherics/omni/mixer/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
switch(href_list["command"])
if("power")
+ . = TOPIC_REFRESH
if(!configuring)
update_use_power(!use_power)
else
update_use_power(POWER_USE_OFF)
if("configure")
+ . = TOPIC_REFRESH
configuring = !configuring
if(configuring)
update_use_power(POWER_USE_OFF)
@@ -204,18 +207,18 @@
if(configuring && !use_power)
switch(href_list["command"])
if("set_flow_rate")
- var/new_flow_rate = input(usr,"Enter new flow rate limit (0-[max_flow_rate]L/s)","Flow Rate Control",set_flow_rate) as num
+ var/new_flow_rate = input(user, "Enter new flow rate limit (0-[max_flow_rate]L/s)", "Flow Rate Control", set_flow_rate) as num
set_flow_rate = clamp(0, new_flow_rate, max_flow_rate)
+ . = TOPIC_REFRESH
if("switch_mode")
switch_mode(dir_flag(href_list["dir"]), href_list["mode"])
+ . = TOPIC_REFRESH
if("switch_con")
change_concentration(dir_flag(href_list["dir"]))
+ . = TOPIC_REFRESH
if("switch_conlock")
con_lock(dir_flag(href_list["dir"]))
-
- update_icon()
- SSnano.update_uis(src)
- return
+ . = TOPIC_REFRESH
/obj/machinery/atmospherics/omni/mixer/proc/switch_mode(var/port = NORTH, var/mode = ATM_NONE)
if(mode != ATM_INPUT && mode != ATM_OUTPUT)
diff --git a/code/modules/atmospherics/components/unary/cold_sink.dm b/code/modules/atmospherics/components/unary/cold_sink.dm
index 59cd07c1182..5a15543df5a 100644
--- a/code/modules/atmospherics/components/unary/cold_sink.dm
+++ b/code/modules/atmospherics/components/unary/cold_sink.dm
@@ -69,22 +69,20 @@
// auto update every Master Controller tick
ui.set_auto_update(1)
-/obj/machinery/atmospherics/unary/freezer/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/atmospherics/unary/freezer/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["toggleStatus"])
update_use_power(!use_power)
+ . = TOPIC_REFRESH
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
- if(amount > 0)
- set_temperature = min(set_temperature + amount, 1000)
- else
- set_temperature = max(set_temperature + amount, 0)
+ set_temperature = clamp(set_temperature + amount, 0, 1000)
+ . = TOPIC_REFRESH
if(href_list["setPower"]) //setting power to 0 is redundant anyways
var/new_setting = clamp(text2num(href_list["setPower"]), 0, 100)
set_power_level(new_setting)
-
- add_fingerprint(usr)
+ . = TOPIC_REFRESH
/obj/machinery/atmospherics/unary/freezer/Process()
..()
diff --git a/code/modules/atmospherics/components/unary/heat_source.dm b/code/modules/atmospherics/components/unary/heat_source.dm
index a476f6fc520..17e7623e7e7 100644
--- a/code/modules/atmospherics/components/unary/heat_source.dm
+++ b/code/modules/atmospherics/components/unary/heat_source.dm
@@ -87,22 +87,20 @@
// auto update every Master Controller tick
ui.set_auto_update(1)
-/obj/machinery/atmospherics/unary/heater/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/atmospherics/unary/heater/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["toggleStatus"])
update_use_power(!use_power)
+ . = TOPIC_REFRESH
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
- if(amount > 0)
- set_temperature = min(set_temperature + amount, max_temperature)
- else
- set_temperature = max(set_temperature + amount, 0)
+ set_temperature = clamp(set_temperature + amount, 0, max_temperature)
+ . = TOPIC_REFRESH
if(href_list["setPower"]) //setting power to 0 is redundant anyways
var/new_setting = clamp(text2num(href_list["setPower"]), 0, 100)
set_power_level(new_setting)
-
- add_fingerprint(usr)
+ . = TOPIC_REFRESH
//upgrading parts
/obj/machinery/atmospherics/unary/heater/RefreshParts()
diff --git a/code/modules/atmospherics/components/unary/outlet_injector.dm b/code/modules/atmospherics/components/unary/outlet_injector.dm
index 2c0ed7952a9..80bd794da66 100644
--- a/code/modules/atmospherics/components/unary/outlet_injector.dm
+++ b/code/modules/atmospherics/components/unary/outlet_injector.dm
@@ -76,7 +76,7 @@
/obj/machinery/atmospherics/unary/outlet_injector/OnTopic(mob/user, href_list, datum/topic_state/state)
if((. = ..()))
return
- if(href_list["toggle_power"])
+ if(href_list["toggle_power"]) // todo: this could easily be refhacked if you don't have a multitool
update_use_power(!use_power)
to_chat(user, "The multitool emits a short beep confirming the change.")
return TOPIC_REFRESH
diff --git a/code/modules/atmospherics/components/unary/vent_pump.dm b/code/modules/atmospherics/components/unary/vent_pump.dm
index ab70259be36..d304cd337cb 100644
--- a/code/modules/atmospherics/components/unary/vent_pump.dm
+++ b/code/modules/atmospherics/components/unary/vent_pump.dm
@@ -357,7 +357,7 @@
/obj/machinery/atmospherics/unary/vent_pump/OnTopic(mob/user, href_list, datum/topic_state/state)
if((. = ..()))
return
- if(href_list["switchMode"])
+ if(href_list["switchMode"]) // todo: this could easily be refhacked if you don't have a multitool
toggle_pump_dir()
to_chat(user, "The multitool emits a short beep confirming the change.")
return TOPIC_REFRESH
diff --git a/code/modules/awaymissions/artillery.dm b/code/modules/awaymissions/artillery.dm
index 592d71f285f..644356e53d7 100644
--- a/code/modules/awaymissions/artillery.dm
+++ b/code/modules/awaymissions/artillery.dm
@@ -1,57 +1,53 @@
-
-/obj/machinery/artillerycontrol
- var/reload = 180
- name = "superluminal artillery control"
- icon_state = "control_boxp1"
- icon = 'icons/obj/machines/particle_accelerator2.dmi'
- density = TRUE
- anchored = TRUE
-
-/obj/machinery/artillerycontrol/Process()
- if(src.reload<180)
- src.reload++
-
/obj/structure/artilleryplaceholder
name = "artillery"
+ desc = "The ship's old superluminal artillery cannon. Looks inoperative."
icon = 'icons/obj/machines/artillery.dmi'
anchored = TRUE
density = TRUE
- desc = "The ship's old superluminal artillery cannon. Looks inoperative."
/obj/structure/artilleryplaceholder/decorative
density = FALSE
+/obj/machinery/artillerycontrol
+ name = "superluminal artillery control"
+ icon_state = "control_boxp1"
+ icon = 'icons/obj/machines/particle_accelerator2.dmi'
+ density = TRUE
+ anchored = TRUE
+ var/tmp/time_to_reload = 360 SECONDS // originally this was 180 ticks at 1 tick per 2 seconds
+ var/reload_cooldown = 0 // The world.time value after which we will be able to fire.
+
/obj/machinery/artillerycontrol/interface_interact(mob/user)
interact(user)
return TRUE
/obj/machinery/artillerycontrol/interact(mob/user)
user.set_machine(src)
- var/dat = "Superluminal Artillery Control:
"
+ var/dat = list("Superluminal Artillery Control:
")
dat += "Locked on
"
- dat += "Charge progress: [reload]/180:
"
+ dat += "Charge progress: [round(100 - ((reload_cooldown - world.time) / time_to_reload))]%
"
dat += "Open Fire
"
dat += "Deployment of weapon authorized by
[global.using_map.company_name] Naval Command
Remember, friendly fire is grounds for termination of your contract and life.
"
- show_browser(user, dat, "window=scroll")
- onclose(user, "scroll")
-
-/obj/machinery/artillerycontrol/Topic(href, href_list, state = global.physical_topic_state)
- if(..())
- return 1
-
- if ((usr.contents.Find(src) || (in_range(src, usr) && isturf(src.loc))) || (issilicon(usr)))
- var/area/thearea = input("Area to jump bombard", "Open Fire") as null|anything in teleportlocs
- thearea = thearea ? teleportlocs[thearea] : thearea
- if (!thearea || CanUseTopic(usr, global.physical_topic_state) != STATUS_INTERACTIVE)
- return
- if (src.reload < 180)
- return
- if ((usr.contents.Find(src) || (in_range(src, usr) && isturf(src.loc))) || (issilicon(usr)))
- command_announcement.Announce("Wormhole artillery fire detected. Brace for impact.")
- log_and_message_admins("has launched an artillery strike.", 1)
- var/list/L = list()
- for(var/turf/T in get_area_turfs(thearea))
- L+=T
- var/loc = pick(L)
- explosion(loc,2,5,11)
- reload = 0
+ show_browser(user, JOINTEXT(dat), "window=superlumcontrol")
+ onclose(user, "superlumcontrol")
+
+/obj/machinery/artillerycontrol/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
+
+ var/area/thearea = input("Area to jump bombard", "Open Fire") as null|anything in teleportlocs
+ thearea = thearea ? teleportlocs[thearea] : null
+ if (!thearea)
+ return
+ if (world.time < reload_cooldown)
+ return
+ command_announcement.Announce("Wormhole artillery fire detected. Brace for impact.")
+ log_and_message_admins("has launched an artillery strike.", user, get_turf(src))
+ var/list/turf/candidates = list()
+ // this is slow (in world loop) but we don't have a better way unless we pre-register a list of areas -> z-levels
+ // and this code isn't hot code at all
+ for(var/turf/tile in thearea)
+ candidates += tile
+ var/turf/target_loc = pick(candidates)
+ explosion(target_loc, 2, 5, 11)
+ reload_cooldown = world.time + time_to_reload
diff --git a/code/modules/economy/cael/ATM.dm b/code/modules/economy/cael/ATM.dm
index 2af8810c19c..c2e50a63930 100644
--- a/code/modules/economy/cael/ATM.dm
+++ b/code/modules/economy/cael/ATM.dm
@@ -248,28 +248,29 @@
else
return
-/obj/machinery/atm/Topic(var/href, var/href_list)
+/obj/machinery/atm/OnTopic(mob/user, href_list)
if((. = ..()))
return
if(href_list["choice"])
+ . = TOPIC_REFRESH
switch(href_list["choice"])
if("transfer")
if(authenticated_account)
var/transfer_amount = text2num(href_list["funds_amount"])
transfer_amount = round(transfer_amount, 0.01)
if(transfer_amount <= 0)
- alert("That is not a valid amount.")
+ alert(user, "That is not a valid amount.")
else if(transfer_amount <= authenticated_account.money)
var/target_account_number = text2num(href_list["target_acc_number"])
var/transfer_purpose = href_list["purpose"]
var/datum/money_account/target_account = get_account(target_account_number)
if(target_account && authenticated_account.transfer(target_account, transfer_amount, transfer_purpose))
- to_chat(usr, "[html_icon(src)]Funds transfer successful.")
+ to_chat(user, "[html_icon(src)]Funds transfer successful.")
else
- to_chat(usr, "[html_icon(src)]Funds transfer failed.")
+ to_chat(user, "[html_icon(src)]Funds transfer failed.")
else
- to_chat(usr, "[html_icon(src)]You don't have enough funds to do that!")
+ to_chat(user, "[html_icon(src)]You don't have enough funds to do that!")
if("view_screen")
view_screen = text2num(href_list["view_screen"])
if("change_security_level")
@@ -283,7 +284,7 @@
if(held_card)
login_card = held_card
else
- login_card = scan_user(usr)
+ login_card = scan_user(user)
if(!ticks_left_locked_down)
var/tried_account_num = text2num(href_list["account_num"])
@@ -317,11 +318,11 @@
if(failed_account)
failed_account.log_msg("Unauthorized login attempt", machine_id)
else
- to_chat(usr, "[html_icon(src)] Incorrect pin/account combination entered, [max_pin_attempts - number_incorrect_tries] attempts remaining.")
+ to_chat(user, "[html_icon(src)] Incorrect pin/account combination entered, [max_pin_attempts - number_incorrect_tries] attempts remaining.")
previous_account_number = tried_account_num
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, 1)
else
- to_chat(usr, "[html_icon(src)] Unable to log in to account, additional information may be required.")
+ to_chat(user, "[html_icon(src)] Unable to log in to account, additional information may be required.")
number_incorrect_tries = 0
else
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
@@ -331,7 +332,7 @@
//create a transaction log entry
authenticated_account.log_msg("Remote terminal access", machine_id)
- to_chat(usr, "[html_icon(src)] Access granted. Welcome user '[authenticated_account.owner_name].'")
+ to_chat(user, "[html_icon(src)] Access granted. Welcome user '[authenticated_account.owner_name].'")
previous_account_number = tried_account_num
if("e_withdrawal")
@@ -339,10 +340,10 @@
amount = round(amount, 0.01)
var/obj/item/charge_stick/E = charge_stick_type
if(amount <= 0)
- alert("That is not a valid amount.")
+ alert(user, "That is not a valid amount.")
else if(amount > initial(E.max_worth))
var/decl/currency/cur = GET_DECL(initial(E.currency) || global.using_map.default_currency)
- alert("That amount exceeds the maximum amount holdable by charge sticks from this machine ([cur.format_value(initial(E.max_worth))]).")
+ alert(user, "That amount exceeds the maximum amount holdable by charge sticks from this machine ([cur.format_value(initial(E.max_worth))]).")
else if(authenticated_account && amount > 0)
//create an entry in the account transaction log
if(authenticated_account.withdraw(amount, "Credit withdrawal", machine_id))
@@ -350,27 +351,26 @@
E = new charge_stick_type(loc)
E.adjust_worth(amount)
E.creator = authenticated_account.owner_name
- usr.put_in_hands(E)
+ user.put_in_hands(E)
else
- to_chat(usr, "[html_icon(src)]You don't have enough funds to do that!")
+ to_chat(user, "[html_icon(src)]You don't have enough funds to do that!")
if("withdrawal")
var/amount = max(text2num(href_list["funds_amount"]),0)
amount = round(amount, 0.01)
if(amount <= 0)
- alert("That is not a valid amount.")
+ alert(user, "That is not a valid amount.")
else if(authenticated_account && amount > 0)
//remove the money
- // TODO: Jesus Christ why does this entire proc use usr
if(authenticated_account.withdraw(amount, "Credit withdrawal", machine_id))
playsound(src, 'sound/machines/chime.ogg', 50, 1)
- var/cash_turf = get_turf(usr)
+ var/cash_turf = get_turf(user)
var/obj/item/cash/cash = new(cash_turf, null, amount)
if(QDELETED(cash))
cash = locate() in cash_turf
if(cash)
- usr.put_in_hands(cash)
+ user.put_in_hands(cash)
else
- to_chat(usr, "[html_icon(src)]You don't have enough funds to do that!")
+ to_chat(user, "[html_icon(src)]You don't have enough funds to do that!")
if("balance_statement")
if(authenticated_account)
var/txt
@@ -428,20 +428,20 @@
if(!held_card)
//this might happen if the user had the browser window open when somebody emagged it
if(emagged > 0)
- to_chat(usr, "[html_icon(src)] The ATM card reader rejected your ID because this machine has been sabotaged!")
+ to_chat(user, "[html_icon(src)] The ATM card reader rejected your ID because this machine has been sabotaged!")
else
- var/obj/item/I = usr.get_active_held_item()
+ var/obj/item/I = user.get_active_held_item()
if (istype(I, /obj/item/card/id))
- if(!usr.try_unequip(I, src))
+ if(!user.try_unequip(I, src))
return
held_card = I
else
- release_held_id(usr)
+ release_held_id(user)
if("logout")
authenticated_account = null
account_security_level = 0
-
- interact(usr)
+ else
+ . = TOPIC_NOACTION // Unhandled, href hack or just a subtype's command?
/obj/machinery/atm/proc/scan_user(mob/living/human/human_user)
if(!authenticated_account)
diff --git a/code/modules/economy/cael/Accounts_DB.dm b/code/modules/economy/cael/Accounts_DB.dm
index 2fa3a9c13d8..8d8b7f4c8a5 100644
--- a/code/modules/economy/cael/Accounts_DB.dm
+++ b/code/modules/economy/cael/Accounts_DB.dm
@@ -85,13 +85,12 @@
ui.set_initial_data(data)
ui.open()
-/obj/machinery/computer/account_database/Topic(href, href_list)
- if(..())
- return 1
-
- var/datum/nanoui/ui = SSnano.get_open_ui(usr, src, "main")
+/obj/machinery/computer/account_database/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["choice"])
+ . = TOPIC_REFRESH
switch(href_list["choice"])
if("create_account")
creating_new_account = 1
@@ -117,24 +116,22 @@
new_account.deposit(starting_funds, "New account activation", machine_id)
creating_new_account = 0
- ui.close()
+ . = TOPIC_CLOSE
creating_new_account = 0
if("insert_card")
if(held_card)
held_card.dropInto(loc)
- if(ishuman(usr) && !usr.get_active_held_item())
- usr.put_in_hands(held_card)
+ if(ishuman(user) && !user.get_active_held_item())
+ user.put_in_hands(held_card)
held_card = null
- SSnano.update_uis(src)
else
- var/obj/item/I = usr.get_active_held_item()
+ var/obj/item/I = user.get_active_held_item()
if (istype(I, /obj/item/card/id))
- if(!usr.try_unequip(I, src))
+ if(!user.try_unequip(I, src))
return
held_card = I
- SSnano.update_uis(src)
if("view_account_detail")
var/index = text2num(href_list["account_index"])
@@ -227,6 +224,6 @@
"}
P.info = text
- state("The terminal prints out a report.")
-
- return 1
+ visible_message(SPAN_NOTICE("[html_icon(src)] \The [src] prints out \the [P]."))
+ else
+ . = TOPIC_NOACTION
diff --git a/code/modules/holodeck/HolodeckControl.dm b/code/modules/holodeck/HolodeckControl.dm
index 843d0ed4d48..f5db252b01d 100644
--- a/code/modules/holodeck/HolodeckControl.dm
+++ b/code/modules/holodeck/HolodeckControl.dm
@@ -100,40 +100,37 @@
onclose(user, "computer")
return
-/obj/machinery/computer/holodeck_control/Topic(href, href_list)
- if(..())
- return 1
- if((usr.contents.Find(src) || (in_range(src, usr) && isturf(src.loc))) || (issilicon(usr)))
- usr.set_machine(src)
-
- if(href_list["program"])
- var/prog = href_list["program"]
- if(prog in global.using_map.holodeck_programs)
- loadProgram(global.using_map.holodeck_programs[prog])
-
- else if(href_list["AIoverride"])
- if(!issilicon(usr))
- return
+/obj/machinery/computer/holodeck_control/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
+ if(href_list["program"])
+ var/prog = href_list["program"]
+ if(prog in global.using_map.holodeck_programs)
+ loadProgram(global.using_map.holodeck_programs[prog])
+ . = TOPIC_REFRESH
- if(safety_disabled && emagged)
- return //if a traitor has gone through the trouble to emag the thing, let them keep it.
+ else if(href_list["AIoverride"])
+ if(!issilicon(usr))
+ return TOPIC_HANDLED
- safety_disabled = !safety_disabled
- update_projections()
- if(safety_disabled)
- log_and_message_admins("overrode the holodeck's safeties")
- else
- log_and_message_admins("restored the holodeck's safeties")
+ if(safety_disabled && emagged)
+ return TOPIC_HANDLED //if a traitor has gone through the trouble to emag the thing, let them keep it.
- else if(href_list["gravity"])
- toggleGravity(linkedholodeck)
+ safety_disabled = !safety_disabled
+ update_projections()
+ if(safety_disabled)
+ log_and_message_admins("overrode the holodeck's safeties")
+ else
+ log_and_message_admins("restored the holodeck's safeties")
+ . = TOPIC_REFRESH
- else if(href_list["togglehololock"])
- togglelock(usr)
+ else if(href_list["gravity"])
+ toggleGravity(linkedholodeck)
+ . = TOPIC_REFRESH
- src.add_fingerprint(usr)
- src.updateUsrDialog()
- return
+ else if(href_list["togglehololock"])
+ togglelock(usr)
+ . = TOPIC_REFRESH
/obj/machinery/computer/holodeck_control/emag_act(var/remaining_charges, var/mob/user)
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
diff --git a/code/modules/hydroponics/seed_machines.dm b/code/modules/hydroponics/seed_machines.dm
index 418afb41d29..17fbe753529 100644
--- a/code/modules/hydroponics/seed_machines.dm
+++ b/code/modules/hydroponics/seed_machines.dm
@@ -153,13 +153,12 @@
ui.open()
ui.set_auto_update(1)
-/obj/machinery/botany/Topic(href, href_list)
-
- if(..())
- return 1
+/obj/machinery/botany/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["eject_packet"])
- if(!seed) return
+ if(!seed) return TOPIC_REFRESH // You must be mistaken! We have no seed.
seed.dropInto(loc)
if(seed.seed.name == "new line" || isnull(SSplants.seeds[seed.seed.name]))
@@ -168,76 +167,59 @@
SSplants.seeds[seed.seed.name] = seed.seed
seed.update_seed()
- visible_message("[html_icon(src)] [src] beeps and spits out [seed].")
+ visible_message("[html_icon(src)] \The [src] beeps and spits out [seed].")
seed = null
+ . = TOPIC_REFRESH
if(href_list["eject_disk"])
- if(!loaded_disk) return
+ if(!loaded_disk) return TOPIC_REFRESH
loaded_disk.dropInto(loc)
- visible_message("[html_icon(src)] [src] beeps and spits out [loaded_disk].")
+ visible_message("[html_icon(src)] \The [src] beeps and spits out [loaded_disk].")
loaded_disk = null
+ . = TOPIC_REFRESH
- usr.set_machine(src)
- src.add_fingerprint(usr)
-
-/obj/machinery/botany/extractor/Topic(href, href_list)
-
- if(..())
- return 1
-
- var/mob/user = usr
- user.set_machine(src)
- src.add_fingerprint(user)
+/obj/machinery/botany/extractor/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["scan_genome"])
-
- if(!seed) return
-
+ if(!seed) return TOPIC_REFRESH
last_action = world.time
- active = 1
-
- if(seed && seed.seed)
- if(prob(user.skill_fail_chance(SKILL_BOTANY, 100, SKILL_ADEPT)))
- failed_task = 1
- else
- genetics = seed.seed
- degradation = 0
+ active = TRUE
+ if(prob(user.skill_fail_chance(SKILL_BOTANY, 100, SKILL_ADEPT)))
+ failed_task = TRUE
+ else
+ genetics = seed.seed
+ degradation = 0
- qdel(seed)
- seed = null
+ QDEL_NULL(seed)
if(href_list["get_gene"])
-
if(!genetics || !loaded_disk)
- return
+ return TOPIC_REFRESH
var/decl/plant_gene/gene_master = locate(href_list["get_gene"])
if(ispath(gene_master))
gene_master = GET_DECL(gene_master)
if(!istype(gene_master))
- return
+ return TOPIC_HANDLED // Potential href hacking?
last_action = world.time
- active = 1
-
+ active = TRUE
loaded_disk.genes += new /datum/plantgene(gene_master, genetics)
-
loaded_disk.genesource = "[genetics.display_name]"
if(!genetics.roundstart)
loaded_disk.genesource += " (variety #[genetics.uid])"
-
loaded_disk.name += " ([gene_master.name], #[genetics.uid])"
loaded_disk.desc += " The label reads \'gene [gene_master.name], sampled from [genetics.display_name]\'."
- eject_disk = 1
-
+ eject_disk = TRUE
degradation += rand(20,60) + user.skill_fail_chance(SKILL_BOTANY, 100, SKILL_ADEPT)
var/expertise = max(0, user.get_skill_value(SKILL_BOTANY) - SKILL_ADEPT)
degradation = max(0, degradation - 10*expertise)
-
if(degradation >= 100)
- failed_task = 1
+ failed_task = TRUE
genetics = null
degradation = 0
@@ -296,30 +278,24 @@
ui.open()
ui.set_auto_update(1)
-/obj/machinery/botany/editor/Topic(href, href_list)
-
- if(..())
- return 1
+/obj/machinery/botany/editor/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["apply_gene"])
- if(!loaded_disk || !seed) return
-
- var/mob/user = usr
+ if(!loaded_disk || !seed) return TOPIC_REFRESH
last_action = world.time
- active = 1
+ active = TRUE
if(!isnull(SSplants.seeds[seed.seed.name]))
seed.seed = seed.seed.diverge(1)
seed.update_seed()
if(prob(seed.modified))
- failed_task = 1
+ failed_task = TRUE
seed.modified = 101
for(var/datum/plantgene/gene in loaded_disk.genes)
seed.seed.apply_gene(gene)
var/expertise = max(user.get_skill_value(SKILL_BOTANY) - SKILL_ADEPT)
seed.modified += rand(5,10) + min(-5, 30 * expertise)
-
- usr.set_machine(src)
- src.add_fingerprint(usr)
diff --git a/code/modules/hydroponics/seed_storage.dm b/code/modules/hydroponics/seed_storage.dm
index bee76cb91f7..6aa7d2372d1 100644
--- a/code/modules/hydroponics/seed_storage.dm
+++ b/code/modules/hydroponics/seed_storage.dm
@@ -286,8 +286,8 @@
show_browser(user, dat, "window=seedstorage;size=800x500")
onclose(user, "seedstorage")
-/obj/machinery/seed_storage/Topic(var/href, var/list/href_list)
- if (..())
+/obj/machinery/seed_storage/OnTopic(mob/user, href_list)
+ if((. = ..()))
return
var/task = href_list["task"]
var/id = text2num(href_list["id"])
@@ -304,13 +304,14 @@
qdel(our_pile)
flick("[initial(icon_state)]-vend", src)
O.dropInto(loc)
+ . = TOPIC_REFRESH
if ("purge")
QDEL_LIST(our_pile.seeds)
our_pile.seeds.Cut()
+ . = TOPIC_REFRESH
if(!length(our_pile.seeds))
piles -= our_pile
QDEL_NULL(our_pile)
- updateUsrDialog()
/obj/machinery/seed_storage/attackby(var/obj/item/O, var/mob/user)
diff --git a/code/modules/implants/implantchair.dm b/code/modules/implants/implantchair.dm
index 7d2dfe25367..6bfe7ff3b67 100644
--- a/code/modules/implants/implantchair.dm
+++ b/code/modules/implants/implantchair.dm
@@ -9,13 +9,13 @@
opacity = FALSE
anchored = TRUE
- var/ready = 1
+ var/ready = TRUE
var/list/obj/item/implant/loyalty/implant_list = list()
var/max_implants = 5
var/injection_cooldown = 600
var/replenish_cooldown = 6000
var/mob/living/occupant = null
- var/injecting = 0
+ var/injecting = FALSE
/obj/machinery/implantchair/Initialize()
. = ..()
@@ -47,26 +47,24 @@
onclose(user, "implant")
-/obj/machinery/implantchair/Topic(href, href_list)
+/obj/machinery/implantchair/OnTopic(mob/user, href_list)
if((. = ..()))
return
- if((get_dist(src, usr) <= 1) || isAI(usr))
- if(href_list["implant"])
- if(src.occupant)
- injecting = 1
- go_out()
- ready = 0
- spawn(injection_cooldown)
- ready = 1
-
- if(href_list["replenish"])
- ready = 0
- spawn(replenish_cooldown)
- add_implants()
- ready = 1
-
- src.updateUsrDialog()
- src.add_fingerprint(usr)
+ if(!ready) // avoid topic hacking
+ return TOPIC_NOACTION
+ if(href_list["implant"] && occupant)
+ injecting = TRUE
+ go_out()
+ ready = FALSE
+ addtimer(CALLBACK(src, PROC_REF(make_ready)), injection_cooldown)
+
+ if(href_list["replenish"])
+ ready = 0
+ addtimer(CALLBACK(src, PROC_REF(add_implants)), replenish_cooldown)
+ addtimer(CALLBACK(src, PROC_REF(make_ready)), replenish_cooldown)
+
+/obj/machinery/implantchair/proc/make_ready()
+ ready = TRUE
/obj/machinery/implantchair/grab_attack(obj/item/grab/grab, mob/user)
var/mob/living/victim = grab.get_affecting_mob()
@@ -87,7 +85,7 @@
occupant.dropInto(loc)
if(injecting)
implant(src.occupant)
- injecting = 0
+ injecting = FALSE
src.occupant = null
icon_state = "implantchair"
return
diff --git a/code/modules/mechs/equipment/medical.dm b/code/modules/mechs/equipment/medical.dm
index ac926851a43..b9f6b5da59b 100644
--- a/code/modules/mechs/equipment/medical.dm
+++ b/code/modules/mechs/equipment/medical.dm
@@ -65,6 +65,9 @@
add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/antitoxins())
add_reagent_canister(null, new /obj/item/chems/chem_disp_cartridge/oxy_meds())
+/obj/machinery/sleeper/mounted/DefaultTopicState()
+ return global.mech_topic_state
+
/obj/machinery/sleeper/mounted/ui_interact(var/mob/user, var/ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = global.mech_topic_state)
. = ..()
diff --git a/code/modules/mining/machinery/material_smelter.dm b/code/modules/mining/machinery/material_smelter.dm
index 263e0f797c7..3d54d262330 100644
--- a/code/modules/mining/machinery/material_smelter.dm
+++ b/code/modules/mining/machinery/material_smelter.dm
@@ -96,8 +96,9 @@
SSmaterials.create_object(mtype, output_turf, samt)
remove_from_reagents(mtype, ramt)
-/obj/machinery/material_processing/smeltery/Topic(var/user, var/list/href_list)
- . = ..()
+/obj/machinery/material_processing/smeltery/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["toggle_alloying"])
if(atom_flags & ATOM_FLAG_NO_REACT)
diff --git a/code/modules/mob/living/default_language.dm b/code/modules/mob/living/default_language.dm
index 6aba0abfb62..4a7384299ea 100644
--- a/code/modules/mob/living/default_language.dm
+++ b/code/modules/mob/living/default_language.dm
@@ -25,10 +25,6 @@
to_chat(src, "You will now speak whatever your standard default language is if you do not specify one when speaking.")
default_language = language?.type
-// Silicons can't neccessarily speak everything in their languages list
-/mob/living/silicon/set_default_language(language)
- ..()
-
/mob/living/verb/check_default_language()
set name = "Check Default Language"
set category = "IC"
diff --git a/code/modules/mob/living/silicon/robot/drone/drone_console.dm b/code/modules/mob/living/silicon/robot/drone/drone_console.dm
index 41ef351a611..7c6bfc00f01 100644
--- a/code/modules/mob/living/silicon/robot/drone/drone_console.dm
+++ b/code/modules/mob/living/silicon/robot/drone/drone_console.dm
@@ -37,79 +37,71 @@
return
-/obj/machinery/computer/drone_control/Topic(href, href_list)
+/obj/machinery/computer/drone_control/OnTopic(mob/user, href_list)
if((. = ..()))
return
- if(!allowed(usr))
- to_chat(usr, "Access denied.")
- return
-
- if ((usr.contents.Find(src) || (in_range(src, usr) && isturf(src.loc))) || (issilicon(usr)))
- usr.set_machine(src)
+ if(!allowed(user))
+ to_chat(user, "Access denied.")
+ return TOPIC_HANDLED
if (href_list["setarea"])
-
//Probably should consider using another list, but this one will do.
var/t_area = input("Select the area to ping.", "Set Target Area", null) as null|anything in global.tagger_locations
-
if(!t_area)
- return
-
+ return TOPIC_HANDLED
drone_call_area = t_area
- to_chat(usr, "You set the area selector to [drone_call_area].")
+ to_chat(user, "You set the area selector to [drone_call_area].")
+ . = TOPIC_REFRESH
else if (href_list["ping"])
-
- to_chat(usr, "You issue a maintenance request for all active drones, highlighting [drone_call_area].")
+ to_chat(user, "You issue a maintenance request for all active drones, highlighting [drone_call_area].")
for(var/mob/living/silicon/robot/drone/D in global.silicon_mob_list)
if(D.client && D.stat == CONSCIOUS)
to_chat(D, "-- Maintenance drone presence requested in: [drone_call_area].")
+ . = TOPIC_REFRESH
else if (href_list["resync"])
-
var/mob/living/silicon/robot/drone/D = locate(href_list["resync"])
-
+ . = TOPIC_HANDLED
if(D.stat != DEAD)
- to_chat(usr, "You issue a law synchronization directive for the drone.")
+ to_chat(user, "You issue a law synchronization directive for the drone.")
D.law_resync()
+ . = TOPIC_REFRESH
else if (href_list["shutdown"])
-
var/mob/living/silicon/robot/drone/D = locate(href_list["shutdown"])
-
+ . = TOPIC_HANDLED
if(D.stat != DEAD)
- to_chat(usr, "You issue a kill command for the unfortunate drone.")
- message_admins("[key_name_admin(usr)] issued kill order for drone [key_name_admin(D)] from control console.")
- log_game("[key_name(usr)] issued kill order for [key_name(src)] from control console.")
+ to_chat(user, "You issue a kill command for the unfortunate drone.")
+ message_admins("[key_name_admin(user)] issued kill order for drone [key_name_admin(D)] from control console.")
+ log_game("[key_name(user)] issued kill order for [key_name(src)] from control console.")
D.shut_down()
+ . = TOPIC_REFRESH
else if (href_list["search_fab"])
if(dronefab)
- return
+ return TOPIC_HANDLED
for(var/obj/machinery/drone_fabricator/fab in oview(3,src))
-
if(fab.stat & NOPOWER)
continue
-
dronefab = fab
- to_chat(usr, "Drone fabricator located.")
- return
+ to_chat(user, "Drone fabricator located.")
+ return TOPIC_REFRESH
- to_chat(usr, "Unable to locate drone fabricator.")
+ to_chat(user, "Unable to locate drone fabricator.")
+ . = TOPIC_HANDLED
else if (href_list["toggle_fab"])
-
if(!dronefab)
- return
+ return TOPIC_HANDLED
if(get_dist(src,dronefab) > 3)
dronefab = null
- to_chat(usr, "Unable to locate drone fabricator.")
- return
+ to_chat(user, "Unable to locate drone fabricator.")
+ return TOPIC_REFRESH
dronefab.produce_drones = !dronefab.produce_drones
- to_chat(usr, "You [dronefab.produce_drones ? "enable" : "disable"] drone production in the nearby fabricator.")
-
- src.updateUsrDialog()
+ to_chat(user, "You [dronefab.produce_drones ? "enable" : "disable"] drone production in the nearby fabricator.")
+ . = TOPIC_REFRESH
diff --git a/code/modules/mob/living/simple_animal/hostile/faithful_hound.dm b/code/modules/mob/living/simple_animal/hostile/faithful_hound.dm
index 345b7137994..3e5bb0112db 100644
--- a/code/modules/mob/living/simple_animal/hostile/faithful_hound.dm
+++ b/code/modules/mob/living/simple_animal/hostile/faithful_hound.dm
@@ -65,9 +65,6 @@
new /obj/item/ectoplasm(get_turf(src))
qdel(src)
-/mob/living/simple_animal/faithful_hound/Destroy()
- return ..()
-
/mob/living/simple_animal/faithful_hound/hear_say(var/message, var/verb = "says", var/decl/language/language = null, var/italics = 0, var/mob/speaker = null, var/sound/speech_sound, var/sound_vol)
set waitfor = FALSE
if(!ai?.check_memory(speaker, message))
diff --git a/code/modules/modular_computers/laptop_vendor.dm b/code/modules/modular_computers/laptop_vendor.dm
index f4de33b5361..00f823ff9fb 100644
--- a/code/modules/modular_computers/laptop_vendor.dm
+++ b/code/modules/modular_computers/laptop_vendor.dm
@@ -14,19 +14,40 @@
var/obj/item/modular_computer/tablet/fabricated_tablet = null
// Utility vars
- var/state = 0 // 0: Select device type, 1: Select loadout, 2: Payment, 3: Thankyou screen
- var/devtype = 0 // 0: None(unselected), 1: Laptop, 2: Tablet
- var/total_price = 0 // Price of currently vended device.
+ var/const/STATE_DEVICE_SEL = 0
+ var/const/STATE_LOADOUT_SEL = 1
+ var/const/STATE_PAYMENT = 2
+ var/const/STATE_THANK_YOU = 3
+ var/state = STATE_DEVICE_SEL
+ var/const/DEVICE_TYPE_NONE = 0
+ var/const/DEVICE_TYPE_LAPTOP = 1
+ var/const/DEVICE_TYPE_TABLET = 2
+ var/devtype = DEVICE_TYPE_NONE
+ /// The calculated price of the currently vended device.
+ var/total_price = 0
// Device loadout
- var/dev_cpu = 1 // 1: Default, 2: Upgraded
- var/dev_battery = 1 // 1: Default, 2: Upgraded, 3: Advanced
- var/dev_disk = 1 // 1: Default, 2: Upgraded, 3: Advanced
- var/dev_netcard = 0 // 0: None, 1: Basic, 2: Long-Range
- var/dev_tesla = 0 // 0: None, 1: Standard
- var/dev_nanoprint = 0 // 0: None, 1: Standard
- var/dev_card = 0 // 0: None, 1: Standard
- var/dev_aislot = 0 // 0: None, 1: Standard
+ var/const/COMPONENT_NONE = 0
+ var/const/COMPONENT_PRESENT = 1
+ var/const/COMPONENT_BASIC = 1
+ var/const/COMPONENT_UPGRADED = 2
+ var/const/COMPONENT_ADVANCED = 3
+ /// What kind of CPU are we adding? Valid states: COMPONENT_BASIC, COMPONENT_UPGRADED
+ var/dev_cpu = COMPONENT_BASIC
+ /// What kind of battery are we adding? Valid states: COMPONENT_BASIC, COMPONENT_UPGRADED, COMPONENT_ADVANCED
+ var/dev_battery = COMPONENT_BASIC
+ /// What kind of battery are we adding? Valid states: COMPONENT_BASIC, COMPONENT_UPGRADED, COMPONENT_ADVANCED
+ var/dev_disk = COMPONENT_BASIC
+ /// What kind of network card are we adding? Valid states: COMPONENT_NONE, COMPONENT_BASIC, COMPONENT_UPGRADED
+ var/dev_netcard = COMPONENT_NONE
+ /// Are we adding a tesla relay? Valid states: COMPONENT_NONE, COMPONENT_PRESENT
+ var/dev_tesla = COMPONENT_NONE
+ /// Are we adding a printer? Valid states: COMPONENT_NONE, COMPONENT_PRESENT
+ var/dev_nanoprint = COMPONENT_NONE
+ /// Are we adding a card reader? Valid states: COMPONENT_NONE, COMPONENT_PRESENT
+ var/dev_card = COMPONENT_NONE
+ /// Are we adding an AI slot? Valid states: COMPONENT_NONE, COMPONENT_PRESENT
+ var/dev_aislot = COMPONENT_NONE
/obj/machinery/lapvend/on_update_icon()
if(stat & BROKEN)
@@ -38,92 +59,91 @@
// Removes all traces of old order and allows you to begin configuration from scratch.
/obj/machinery/lapvend/proc/reset_order()
- state = 0
- devtype = 0
- if(fabricated_laptop)
- qdel(fabricated_laptop)
- fabricated_laptop = null
- if(fabricated_tablet)
- qdel(fabricated_tablet)
- fabricated_tablet = null
- dev_cpu = 1
- dev_battery = 1
- dev_disk = 1
- dev_netcard = 0
- dev_tesla = 0
- dev_nanoprint = 0
- dev_card = 0
- dev_aislot = 0
+ state = STATE_DEVICE_SEL
+ devtype = DEVICE_TYPE_NONE
+ QDEL_NULL(fabricated_laptop)
+ QDEL_NULL(fabricated_tablet)
+ dev_cpu = COMPONENT_BASIC
+ dev_battery = COMPONENT_BASIC
+ dev_disk = COMPONENT_BASIC
+ dev_netcard = COMPONENT_NONE
+ dev_tesla = COMPONENT_NONE
+ dev_nanoprint = COMPONENT_NONE
+ dev_card = COMPONENT_NONE
+ dev_aislot = COMPONENT_NONE
// Recalculates the price and optionally even fabricates the device.
-/obj/machinery/lapvend/proc/fabricate_and_recalc_price(var/fabricate = 0)
+/obj/machinery/lapvend/proc/fabricate_and_recalc_price(var/fabricate = FALSE)
total_price = 0
- if(devtype == 1) // Laptop, generally cheaper to make it accessible for most station roles
+ if(devtype == DEVICE_TYPE_LAPTOP) // Laptop, generally cheaper to make it accessible for most station roles
var/datum/extension/assembly/modular_computer/assembly
if(fabricate)
fabricated_laptop = new(src)
assembly = get_extension(fabricated_laptop, /datum/extension/assembly)
- total_price = 99
+ total_price = atom_info_repository.get_single_worth_for(/obj/item/modular_computer/laptop)
switch(dev_cpu)
- if(1)
+ if(COMPONENT_BASIC)
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/processor_unit/small)
if(fabricate)
assembly.add_replace_component(null, PART_CPU, new/obj/item/stock_parts/computer/processor_unit/small(fabricated_laptop))
- if(2)
+ if(COMPONENT_UPGRADED)
if(fabricate)
assembly.add_replace_component(null, PART_CPU, new/obj/item/stock_parts/computer/processor_unit(fabricated_laptop))
- total_price += 299
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/processor_unit)
switch(dev_battery)
- if(1) // Basic(750C)
+ if(COMPONENT_BASIC) // Basic(750C)
if(fabricate)
assembly.add_replace_component(null, PART_BATTERY, new/obj/item/stock_parts/computer/battery_module(fabricated_laptop))
- if(2) // Upgraded(1100C)
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/battery_module)
+ if(COMPONENT_UPGRADED) // Upgraded(1100C)
if(fabricate)
assembly.add_replace_component(null, PART_BATTERY, new/obj/item/stock_parts/computer/battery_module/advanced(fabricated_laptop))
- total_price += 199
- if(3) // Advanced(1500C)
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/battery_module/advanced)
+ if(COMPONENT_ADVANCED) // Advanced(1500C)
if(fabricate)
assembly.add_replace_component(null, PART_BATTERY, new/obj/item/stock_parts/computer/battery_module/super(fabricated_laptop))
- total_price += 499
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/battery_module/super)
switch(dev_disk)
- if(1) // Basic(128GQ)
+ if(COMPONENT_BASIC) // Basic(128GQ)
if(fabricate)
assembly.add_replace_component(null, PART_HDD, new/obj/item/stock_parts/computer/hard_drive(fabricated_laptop))
- if(2) // Upgraded(256GQ)
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/hard_drive)
+ if(COMPONENT_UPGRADED) // Upgraded(256GQ)
if(fabricate)
assembly.add_replace_component(null, PART_HDD, new/obj/item/stock_parts/computer/hard_drive/advanced(fabricated_laptop))
- total_price += 99
- if(3) // Advanced(512GQ)
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/hard_drive/advanced)
+ if(COMPONENT_ADVANCED) // Advanced(512GQ)
if(fabricate)
assembly.add_replace_component(null, PART_HDD, new/obj/item/stock_parts/computer/hard_drive/super(fabricated_laptop))
- total_price += 299
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/hard_drive/super)
switch(dev_netcard)
- if(1) // Basic(Short-Range)
+ if(COMPONENT_BASIC) // Basic(Short-Range)
if(fabricate)
assembly.add_replace_component(null, PART_NETWORK, new/obj/item/stock_parts/computer/network_card(fabricated_laptop))
- total_price += 99
- if(2) // Advanced (Long Range)
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/network_card)
+ if(COMPONENT_UPGRADED) // Advanced (Long Range)
if(fabricate)
assembly.add_replace_component(null, PART_NETWORK, new/obj/item/stock_parts/computer/network_card/advanced(fabricated_laptop))
- total_price += 299
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/network_card/advanced)
if(dev_tesla)
- total_price += 399
if(fabricate)
assembly.add_replace_component(null, PART_TESLA, new/obj/item/stock_parts/computer/tesla_link(fabricated_laptop))
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/tesla_link)
if(dev_nanoprint)
- total_price += 99
if(fabricate)
assembly.add_replace_component(null, PART_PRINTER, new/obj/item/stock_parts/computer/nano_printer(fabricated_laptop))
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/nano_printer)
if(dev_card)
- total_price += 199
if(fabricate)
assembly.add_replace_component(null, PART_CARD, new/obj/item/stock_parts/computer/card_slot(fabricated_laptop))
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/card_slot)
if(dev_aislot)
- total_price += 499
if(fabricate)
assembly.add_replace_component(null, PART_AI, new/obj/item/stock_parts/computer/ai_slot(fabricated_laptop))
+ total_price += atom_info_repository.get_single_worth_for(/obj/item/stock_parts/computer/ai_slot)
return total_price
- else if(devtype == 2) // Tablet, more expensive, not everyone could probably afford this.
+ else if(devtype == DEVICE_TYPE_TABLET) // Tablet, more expensive, not everyone could probably afford this.
var/datum/extension/assembly/modular_computer/assembly
if(fabricate)
fabricated_tablet = new(src)
@@ -131,35 +151,35 @@
assembly.add_replace_component(null, PART_CPU, new/obj/item/stock_parts/computer/processor_unit/small(fabricated_tablet))
total_price = 199
switch(dev_battery)
- if(1) // Basic(300C)
+ if(COMPONENT_BASIC) // Basic(300C)
if(fabricate)
assembly.add_replace_component(null, PART_BATTERY, new/obj/item/stock_parts/computer/battery_module/nano(fabricated_tablet))
- if(2) // Upgraded(500C)
+ if(COMPONENT_UPGRADED) // Upgraded(500C)
if(fabricate)
assembly.add_replace_component(null, PART_BATTERY, new/obj/item/stock_parts/computer/battery_module/micro(fabricated_tablet))
total_price += 199
- if(3) // Advanced(750C)
+ if(COMPONENT_ADVANCED) // Advanced(750C)
if(fabricate)
assembly.add_replace_component(null, PART_BATTERY, new/obj/item/stock_parts/computer/battery_module(fabricated_tablet))
total_price += 499
switch(dev_disk)
- if(1) // Basic(32GQ)
+ if(COMPONENT_BASIC) // Basic(32GQ)
if(fabricate)
assembly.add_replace_component(null, PART_HDD, new/obj/item/stock_parts/computer/hard_drive/micro(fabricated_tablet))
- if(2) // Upgraded(64GQ)
+ if(COMPONENT_UPGRADED) // Upgraded(64GQ)
if(fabricate)
assembly.add_replace_component(null, PART_HDD, new/obj/item/stock_parts/computer/hard_drive/small(fabricated_tablet))
total_price += 99
- if(3) // Advanced(128GQ)
+ if(COMPONENT_ADVANCED) // Advanced(128GQ)
if(fabricate)
assembly.add_replace_component(null, PART_HDD, new/obj/item/stock_parts/computer/hard_drive(fabricated_tablet))
total_price += 299
switch(dev_netcard)
- if(1) // Basic(Short-Range)
+ if(COMPONENT_BASIC) // Basic(Short-Range)
if(fabricate)
assembly.add_replace_component(null, PART_NETWORK, new/obj/item/stock_parts/computer/network_card(fabricated_tablet))
total_price += 99
- if(2) // Advanced (Long Range)
+ if(COMPONENT_UPGRADED) // Advanced (Long Range)
if(fabricate)
assembly.add_replace_component(null, PART_NETWORK, new/obj/item/stock_parts/computer/network_card/advanced(fabricated_tablet))
total_price += 299
@@ -182,76 +202,75 @@
return total_price
return 0
-
-
-
-
-/obj/machinery/lapvend/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/lapvend/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["pick_device"])
if(state) // We've already picked a device type
- return 0
+ return TOPIC_REFRESH // Your UI must be out of date (or you're trying to href hack...)
devtype = text2num(href_list["pick_device"])
- state = 1
- fabricate_and_recalc_price(0)
- return 1
+ state = STATE_LOADOUT_SEL
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
if(href_list["clean_order"])
reset_order()
- return 1
- if((state != 1) && devtype) // Following IFs should only be usable when in the Select Loadout mode
- return 0
+ return TOPIC_REFRESH
+ // Following IFs should only be usable when in the Select Loadout mode.
+ if(state != STATE_LOADOUT_SEL)
+ return TOPIC_NOACTION
+ // Proceed to payment
if(href_list["confirm_order"])
- state = 2 // Wait for ID swipe for payment processing
- fabricate_and_recalc_price(0)
- return 1
+ state = STATE_PAYMENT // Wait for ID swipe for payment processing
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
+ // Hardware selection
if(href_list["hw_cpu"])
dev_cpu = text2num(href_list["hw_cpu"])
- fabricate_and_recalc_price(0)
- return 1
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
if(href_list["hw_battery"])
dev_battery = text2num(href_list["hw_battery"])
- fabricate_and_recalc_price(0)
- return 1
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
if(href_list["hw_disk"])
dev_disk = text2num(href_list["hw_disk"])
- fabricate_and_recalc_price(0)
- return 1
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
if(href_list["hw_netcard"])
dev_netcard = text2num(href_list["hw_netcard"])
- fabricate_and_recalc_price(0)
- return 1
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
if(href_list["hw_tesla"])
dev_tesla = text2num(href_list["hw_tesla"])
- fabricate_and_recalc_price(0)
- return 1
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
if(href_list["hw_nanoprint"])
dev_nanoprint = text2num(href_list["hw_nanoprint"])
- fabricate_and_recalc_price(0)
- return 1
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
if(href_list["hw_card"])
dev_card = text2num(href_list["hw_card"])
- fabricate_and_recalc_price(0)
- return 1
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
if(href_list["hw_aislot"])
dev_aislot = text2num(href_list["hw_aislot"])
- fabricate_and_recalc_price(0)
- return 1
- return 0
+ fabricate_and_recalc_price(FALSE)
+ return TOPIC_REFRESH
+ return TOPIC_NOACTION
/obj/machinery/lapvend/interface_interact(var/mob/user)
ui_interact(user)
return TRUE
/obj/machinery/lapvend/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
- if(stat & (BROKEN | NOPOWER | MAINT))
+ if(inoperable(MAINT))
if(ui)
ui.close()
- return 0
- var/list/data[0]
+ return
+ var/list/data = list()
data["state"] = state
- if(state == 1)
+ if(state == STATE_LOADOUT_SEL)
data["devtype"] = devtype
data["hw_battery"] = dev_battery
data["hw_disk"] = dev_disk
@@ -261,7 +280,7 @@
data["hw_card"] = dev_card
data["hw_cpu"] = dev_cpu
data["hw_aislot"] = dev_aislot
- if(state == 1 || state == 2)
+ if(state == STATE_LOADOUT_SEL || state == STATE_PAYMENT)
var/decl/currency/cur = GET_DECL(global.using_map.default_currency)
data["totalprice"] = cur.format_value(total_price)
@@ -273,29 +292,26 @@
ui.set_auto_update(1)
-/obj/machinery/lapvend/attackby(obj/item/W as obj, mob/user as mob)
- // Awaiting payment state
- if(state == 2)
- if(process_payment(W))
- fabricate_and_recalc_price(1)
- flick("world-vend", src)
- if((devtype == 1) && fabricated_laptop)
- fabricated_laptop.forceMove(src.loc)
- fabricated_laptop.update_icon()
- fabricated_laptop.update_verbs()
- fabricated_laptop = null
- else if((devtype == 2) && fabricated_tablet)
- fabricated_tablet.forceMove(src.loc)
- fabricated_tablet.update_verbs()
- fabricated_tablet = null
- ping("Enjoy your new product!")
- state = 3
- return 1
- return 0
+/obj/machinery/lapvend/attackby(obj/item/held_item as obj, mob/user as mob)
+ if(state == STATE_PAYMENT && process_payment(held_item))
+ fabricate_and_recalc_price(TRUE)
+ flick("world-vend", src)
+ if((devtype == DEVICE_TYPE_LAPTOP) && fabricated_laptop)
+ fabricated_laptop.forceMove(src.loc)
+ fabricated_laptop.update_icon()
+ fabricated_laptop.update_verbs()
+ fabricated_laptop = null
+ else if((devtype == DEVICE_TYPE_TABLET) && fabricated_tablet)
+ fabricated_tablet.forceMove(src.loc)
+ fabricated_tablet.update_verbs()
+ fabricated_tablet = null
+ ping("Enjoy your new product!")
+ state = STATE_THANK_YOU
+ return TRUE
return ..()
-// Simplified payment processing, returns 1 on success.
+// Simplified payment processing, returns TRUE on success.
/obj/machinery/lapvend/proc/process_payment(var/obj/item/charge_stick/I)
if(!istype(I))
ping("Invalid payment format.")
diff --git a/code/modules/nano/interaction/hands.dm b/code/modules/nano/interaction/hands.dm
index fe9a3df4c4f..3122925e2cc 100644
--- a/code/modules/nano/interaction/hands.dm
+++ b/code/modules/nano/interaction/hands.dm
@@ -1,6 +1,7 @@
-/*
- This state only checks if user is conscious.
-*/
+/**
+ This state checks if src_object is held in the user's hands (or a cyborg gripper),
+ as well as the default NanoUI interaction.
+**/
var/global/datum/topic_state/hands/hands_topic_state = new
/datum/topic_state/hands/can_use_topic(src_object, mob/user)
diff --git a/code/modules/power/batteryrack.dm b/code/modules/power/batteryrack.dm
index ec8e3abac1c..27524a6eb2c 100644
--- a/code/modules/power/batteryrack.dm
+++ b/code/modules/power/batteryrack.dm
@@ -249,36 +249,34 @@
/obj/machinery/power/smes/batteryrack/outputting()
return
-/obj/machinery/power/smes/batteryrack/Topic(href, href_list)
+/obj/machinery/power/smes/batteryrack/OnTopic(mob/user, href_list)
// ..() would respond to those topic calls, but we don't want to use them at all.
// Calls to these shouldn't occur anyway, due to usage of different nanoUI, but
// it's here in case someone decides to try hrefhacking/modified templates.
if(href_list["input"] || href_list["output"])
- return 1
-
- if(..())
- return 1
+ return TOPIC_HANDLED
+ if((. = ..()))
+ return
if( href_list["disable"] )
update_io(0)
- return 1
+ return TOPIC_REFRESH
else if( href_list["enable"] )
update_io(clamp(text2num(href_list["enable"]), 1, 3))
- return 1
+ return TOPIC_REFRESH
else if( href_list["equaliseon"] )
equalise = 1
- return 1
+ return TOPIC_REFRESH
else if( href_list["equaliseoff"] )
equalise = 0
- return 1
+ return TOPIC_REFRESH
else if( href_list["ejectcell"] )
var/slot_number = text2num(href_list["ejectcell"])
if(slot_number != clamp(round(slot_number), 1, length(internal_cells)))
- return 1
+ return TOPIC_HANDLED
var/obj/item/cell/C = internal_cells[slot_number]
C.dropInto(loc)
internal_cells -= C
- update_icon()
RefreshParts()
update_maxcharge()
- return 1
\ No newline at end of file
+ return TOPIC_REFRESH
\ No newline at end of file
diff --git a/code/modules/power/fusion/core/_core.dm b/code/modules/power/fusion/core/_core.dm
index 3f667ebaa7d..31a3fff21fa 100644
--- a/code/modules/power/fusion/core/_core.dm
+++ b/code/modules/power/fusion/core/_core.dm
@@ -43,15 +43,16 @@
else
owned_field.handle_tick()
-/obj/machinery/fusion_core/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/fusion_core/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if(href_list["str"])
var/dif = text2num(href_list["str"])
field_strength = min(max(field_strength + dif, MIN_FIELD_STR), MAX_FIELD_STR)
change_power_consumption(500 * field_strength, POWER_USE_ACTIVE)
if(owned_field)
owned_field.ChangeFieldStrength(field_strength)
+ return TOPIC_REFRESH
/obj/machinery/fusion_core/update_use_power(new_use_power)
. = ..()
diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm
index d9ffb660f37..fa8764e8dc6 100644
--- a/code/modules/power/gravitygenerator.dm
+++ b/code/modules/power/gravitygenerator.dm
@@ -85,13 +85,12 @@
onclose(user, "gravgen")
-/obj/machinery/computer/gravity_control_computer/Topic(href, href_list)
- set background = 1
+/obj/machinery/computer/gravity_control_computer/OnTopic(user, href_list)
if((. = ..()))
- close_browser(usr, "window=air_alarm")
return
if(href_list["gentoggle"])
+ . = TOPIC_REFRESH
if(gravity_generator.on)
gravity_generator.on = 0
@@ -102,9 +101,9 @@
break
if(!G)
A.gravitychange(0)
+ CHECK_TICK
else
for(var/area/A in gravity_generator.localareas)
gravity_generator.on = 1
A.gravitychange(1)
-
- src.updateUsrDialog()
+ CHECK_TICK
diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm
index d20a0eb1c23..d869748a7b4 100644
--- a/code/modules/power/port_gen.dm
+++ b/code/modules/power/port_gen.dm
@@ -377,29 +377,31 @@
ui.open()
ui.set_auto_update(1)
-/obj/machinery/port_gen/pacman/Topic(href, href_list)
- if(..())
+/obj/machinery/port_gen/pacman/OnTopic(mob/user, href_list)
+ if((. = ..()))
return
- src.add_fingerprint(usr)
if(href_list["action"])
if(href_list["action"] == "enable")
if(!active && HasFuel() && !IsBroken())
- active = 1
- update_icon()
+ active = TRUE
+ . = TOPIC_REFRESH
if(href_list["action"] == "disable")
if (active)
- active = 0
- update_icon()
+ active = FALSE
+ . = TOPIC_REFRESH
if(href_list["action"] == "eject")
if(!active)
DropFuel()
+ . = TOPIC_REFRESH
if(href_list["action"] == "lower_power")
if (power_output > 1)
power_output--
+ . = TOPIC_REFRESH
if (href_list["action"] == "higher_power")
if (power_output < max_power_output || (emagged && power_output < round(max_power_output*2.5)))
power_output++
+ . = TOPIC_REFRESH
/obj/machinery/port_gen/pacman/super
name = "portable fission generator"
diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm
index 4f3f45ee931..c267422e089 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_control.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm
@@ -74,35 +74,35 @@
return
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
- ..()
- //Ignore input if we are broken, !silicon guy cant touch us, or nonai controlling from super far away
- if(stat & (BROKEN|NOPOWER) || (get_dist(src, usr) > 1 && !issilicon(usr)) || (get_dist(src, usr) > 8 && !isAI(usr)))
- usr.unset_machine()
+ . = ..()
+ if(. == TOPIC_CLOSE)
close_browser(usr, "window=pacontrol")
- return
- if( href_list["close"] )
- close_browser(usr, "window=pacontrol")
- usr.unset_machine()
+/obj/machinery/particle_accelerator/control_box/OnTopic(href, href_list)
+ if((. = ..()))
return
-
+ if(inoperable())
+ return TOPIC_CLOSE
+ if(href_list["close"])
+ return TOPIC_CLOSE
if(href_list["togglep"])
- if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE))
- src.toggle_power()
+ if(wires.IsIndexCut(PARTICLE_TOGGLE_WIRE))
+ return TOPIC_HANDLED
+ toggle_power()
+ return TOPIC_REFRESH
else if(href_list["scan"])
- src.part_scan()
-
+ part_scan()
+ return TOPIC_REFRESH
else if(href_list["strengthup"])
- if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
- add_strength()
-
+ if(wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
+ return TOPIC_HANDLED
+ add_strength()
+ return TOPIC_REFRESH
else if(href_list["strengthdown"])
- if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
- remove_strength()
-
- src.updateDialog()
- src.update_icon()
- return
+ if(wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
+ return TOPIC_HANDLED
+ remove_strength()
+ return TOPIC_REFRESH
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
for(var/obj/structure/particle_accelerator/part in connected_parts)
diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm
index 50c22d1479e..2201e1fc430 100644
--- a/code/modules/power/smes.dm
+++ b/code/modules/power/smes.dm
@@ -263,22 +263,19 @@
return 0
return round(100.0*charge/capacity, 0.1)
-/obj/machinery/power/smes/Topic(href, href_list)
- if(..())
- return 1
+/obj/machinery/power/smes/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
if( href_list["cmode"] )
inputting(!input_attempt)
- update_icon()
- return 1
+ . = TOPIC_REFRESH
else if( href_list["online"] )
outputting(!output_attempt)
- update_icon()
- return 1
+ . = TOPIC_REFRESH
else if( href_list["reboot"] )
failure_timer = 0
- update_icon()
- return 1
+ . = TOPIC_REFRESH
else if( href_list["input"] )
switch( href_list["input"] )
if("min")
@@ -288,7 +285,7 @@
if("set")
input_level = (input(usr, "Enter new input level (0-[input_level_max/1000] kW)", "SMES Input Power Control", input_level/1000) as num) * 1000
input_level = max(0, min(input_level_max, input_level)) // clamp to range
- return 1
+ . = TOPIC_REFRESH
else if( href_list["output"] )
switch( href_list["output"] )
if("min")
@@ -298,7 +295,7 @@
if("set")
output_level = (input(usr, "Enter new output level (0-[output_level_max/1000] kW)", "SMES Output Power Control", output_level/1000) as num) * 1000
output_level = max(0, min(output_level_max, output_level)) // clamp to range
- return 1
+ . = TOPIC_REFRESH
/obj/machinery/power/smes/proc/energy_fail(var/duration)
diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm
index 66f77091a28..23e5f846473 100644
--- a/code/modules/power/solar.dm
+++ b/code/modules/power/solar.dm
@@ -427,14 +427,15 @@ var/global/list/solars_list = list()
updateDialog()
/obj/machinery/power/solar_control/Topic(href, href_list)
- if(..())
- close_browser(usr, "window=solcon")
- usr.unset_machine()
- return 0
- if(href_list["close"] )
+ . = ..()
+ if(. == TOPIC_CLOSE)
close_browser(usr, "window=solcon")
- usr.unset_machine()
- return 0
+
+/obj/machinery/power/solar_control/OnTopic(mob/user, href_list)
+ if((. = ..()))
+ return
+ if(href_list["close"])
+ return TOPIC_CLOSE
if(href_list["rate control"])
if(href_list["cdir"])
@@ -442,11 +443,11 @@ var/global/list/solars_list = list()
targetdir = cdir
if(track == 2) //manual update, so losing auto-tracking
track = 0
- spawn(1)
- set_panels(cdir)
+ addtimer(CALLBACK(src, PROC_REF(set_panels), cdir), 1)
if(href_list["tdir"])
trackrate = clamp(trackrate+text2num(href_list["tdir"]), -7200, 7200)
if(trackrate) nexttime = world.time + 36000/abs(trackrate)
+ return TOPIC_REFRESH
if(href_list["track"])
track = text2num(href_list["track"])
@@ -459,6 +460,7 @@ var/global/list/solars_list = list()
targetdir = cdir
if(trackrate) nexttime = world.time + 36000/abs(trackrate)
set_panels(targetdir)
+ return TOPIC_REFRESH
if(href_list["search_connected"])
search_for_connected()
@@ -466,9 +468,7 @@ var/global/list/solars_list = list()
if(connected_tracker && track == 2 && sun)
connected_tracker.set_angle(sun.angle)
set_panels(cdir)
-
- interact(usr)
- return 1
+ return TOPIC_REFRESH
//rotates the panel to the passed angle
/obj/machinery/power/solar_control/proc/set_panels(var/cdir)
diff --git a/code/modules/projectiles/guns/energy/capacitor.dm b/code/modules/projectiles/guns/energy/capacitor.dm
index 6d417484f83..f0ac3df942a 100644
--- a/code/modules/projectiles/guns/energy/capacitor.dm
+++ b/code/modules/projectiles/guns/energy/capacitor.dm
@@ -147,9 +147,6 @@ var/global/list/laser_wavelengths
update_icon()
return TRUE
-/obj/item/gun/energy/capacitor/Process()
- . = ..()
-
/obj/item/gun/energy/capacitor/proc/charge(var/mob/user)
. = FALSE
if(!charging && istype(user))
diff --git a/code/modules/projectiles/guns/energy/temperature.dm b/code/modules/projectiles/guns/energy/temperature.dm
index 933c6d2fff6..414aa4a3ccd 100644
--- a/code/modules/projectiles/guns/energy/temperature.dm
+++ b/code/modules/projectiles/guns/energy/temperature.dm
@@ -48,8 +48,8 @@
show_browser(user, dat, "window=freezegun;size=450x300;can_resize=1;can_close=1;can_minimize=1")
onclose(user, "window=freezegun", src)
-/obj/item/gun/energy/temperature/Topic(user, href_list, state = global.inventory_topic_state)
- ..()
+/obj/item/gun/energy/temperature/DefaultTopicState()
+ return global.inventory_topic_state
/obj/item/gun/energy/temperature/OnTopic(user, href_list)
if(href_list["temp"])
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index e304fbec91e..d7c1f8cc408 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -71,28 +71,56 @@
return ..()
-/obj/machinery/chem_master/Topic(href, href_list, state)
- if(..())
- return 1
- var/mob/user = usr
+/obj/machinery/chem_master/Topic(href, href_list)
+ . = ..()
+ if(. == TOPIC_CLOSE)
+ close_browser(usr, "window=chem_master")
+/obj/machinery/chem_master/OnTopic(mob/user, href_list, state)
+ if((. = ..()))
+ return
if (href_list["ejectp"])
if(loaded_pill_bottle)
loaded_pill_bottle.dropInto(loc)
loaded_pill_bottle = null
else if(href_list["close"])
- show_browser(user, null, "window=chem_master")
- user.unset_machine()
- return
+ return TOPIC_CLOSE
if(beaker)
+ // The custom ones modify our href_list.
+ if (href_list["addcustom"])
+ var/decl/material/their_reagent = locate(href_list["addcustom"])
+ if(their_reagent)
+ useramount = input("Select the amount to transfer.", 30, useramount) as null|num
+ if(useramount)
+ useramount = clamp(useramount, 0, 200)
+ href_list["amount"] = num2text(useramount)
+ href_list["add"] = href_list["addcustom"]
+ href_list -= "addcustom"
+ else
+ return TOPIC_HANDLED
+ else
+ return TOPIC_REFRESH // Tried to move a nonexistent reagent, maybe their UI is stale?
+ else if(href_list["removecustom"])
+ var/decl/material/my_reagents = locate(href_list["removecustom"])
+ if(my_reagents)
+ useramount = input("Select the amount to transfer.", 30, useramount) as null|num
+ if(useramount)
+ useramount = clamp(useramount, 0, 200)
+ href_list["amount"] = num2text(useramount)
+ href_list["remove"] = href_list["removecustom"]
+ href_list -= "removecustom"
+ else
+ return TOPIC_HANDLED
+
+ // DO NOT use else if here, we want these to run even if the custom ones do
var/datum/reagents/R = beaker.reagents
if (href_list["analyze"])
var/decl/material/reagent = locate(href_list["analyze"])
var/dat = get_chem_info(reagent)
if(dat && REAGENT_VOLUME(beaker.reagents, reagent.type))
show_browser(user, dat, "window=chem_master;size=575x400")
- return
+ return TOPIC_HANDLED
else if (href_list["add"])
if(href_list["amount"])
@@ -107,16 +135,7 @@
else
mult -= 0.4 * (SKILL_MAX - user.get_skill_value(core_skill))/(SKILL_MAX-SKILL_MIN) //10% loss per skill level down from max
R.trans_type_to(src, their_reagent.type, amount, mult)
-
-
-
- else if (href_list["addcustom"])
- var/decl/material/their_reagent = locate(href_list["addcustom"])
- if(their_reagent)
- useramount = input("Select the amount to transfer.", 30, useramount) as null|num
- if(useramount)
- useramount = clamp(useramount, 0, 200)
- src.Topic(href, list("amount" = "[useramount]", "add" = href_list["addcustom"]), state)
+ return TOPIC_REFRESH
else if (href_list["remove"])
if(href_list["amount"])
@@ -132,52 +151,44 @@
remove_from_reagents(my_reagents.type, amount)
for(var/decl/material/reagent in contaminants)
remove_from_reagents(reagent.type, round(rand()*amount, 0.1))
-
- else if (href_list["removecustom"])
- var/decl/material/my_reagents = locate(href_list["removecustom"])
- if(my_reagents)
- useramount = input("Select the amount to transfer.", 30, useramount) as null|num
- if(useramount)
- useramount = clamp(useramount, 0, 200)
- src.Topic(href, list("amount" = "[useramount]", "remove" = href_list["removecustom"]), state)
+ return TOPIC_REFRESH
else if (href_list["toggle"])
mode = !mode
+ return TOPIC_REFRESH
else if (href_list["toggle_sloppy"])
sloppy = !sloppy
+ return TOPIC_REFRESH
else if (href_list["main"])
- interact(user)
- return
+ return TOPIC_REFRESH
else if (href_list["eject"])
beaker.forceMove(loc)
beaker = null
reagents.clear_reagents()
icon_state = "mixer0"
+ return TOPIC_REFRESH
else if (href_list["createpill"] || href_list["createpill_multiple"])
var/count = 1
if(reagents.total_volume/count < 1) //Sanity checking.
- return
+ return TOPIC_HANDLED
if (href_list["createpill_multiple"])
count = input("Select the number of pills to make.", "Max [max_pill_count]", pillamount) as num
if(!CanInteract(user, state))
- return
+ return TOPIC_HANDLED
count = clamp(count, 1, max_pill_count)
- if(reagents.total_volume/count < 1) //Sanity checking.
- return
-
- var/amount_per_pill = reagents.total_volume/count
- if (amount_per_pill > 30) amount_per_pill = 30
+ var/amount_per_pill = min(reagents.total_volume/count, 30)
+ if(amount_per_pill < 1) // Sanity checking.
+ return TOPIC_HANDLED
var/name = sanitize_safe(input(usr,"Name:","Name your pill!","[reagents.get_primary_reagent_name()] ([amount_per_pill]u)"), MAX_NAME_LEN)
if(!CanInteract(user, state))
- return
-
+ return TOPIC_HANDLED
if(reagents.total_volume/count < 1) //Sanity checking.
- return
+ return TOPIC_HANDLED
while (count-- && count >= 0)
var/obj/item/chems/pill/dispensed/P = new(loc)
if(!name) name = reagents.get_primary_reagent_name()
@@ -187,9 +198,11 @@
P.update_icon()
if(loaded_pill_bottle && loaded_pill_bottle.storage && loaded_pill_bottle.contents.len < loaded_pill_bottle.storage.max_storage_space)
P.forceMove(loaded_pill_bottle)
+ return TOPIC_REFRESH
else if (href_list["createbottle"])
create_bottle(user)
+ return TOPIC_REFRESH
else if(href_list["change_pill"])
#define MAX_PILL_SPRITE 25 //max icon state of the pill sprites
var/dat = ""
@@ -197,15 +210,16 @@
dat += "![](\"pill[i].png\") |
"
dat += "
"
show_browser(user, dat, "window=chem_master")
- return
+ return TOPIC_HANDLED
else if(href_list["pill_sprite"])
pillsprite = href_list["pill_sprite"]
+ return TOPIC_REFRESH
else if(href_list["label_color"])
bottle_label_color = input(usr, "Pick new bottle label color", "Label color", bottle_label_color) as color
+ return TOPIC_REFRESH
else if(href_list["lid_color"])
bottle_lid_color = input(usr, "Pick new bottle lid color", "Lid color", bottle_lid_color) as color
-
- updateUsrDialog()
+ return TOPIC_REFRESH
/obj/machinery/chem_master/proc/fetch_contaminants(mob/user, datum/reagents/reagents, decl/material/main_reagent)
. = list()
diff --git a/code/modules/shuttles/escape_pods.dm b/code/modules/shuttles/escape_pods.dm
index bd13d30c417..8d1ee2489be 100644
--- a/code/modules/shuttles/escape_pods.dm
+++ b/code/modules/shuttles/escape_pods.dm
@@ -142,7 +142,7 @@ var/global/list/escape_pods_by_name = list()
/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/receive_user_command(command)
if (!armed)
- return TRUE // Eat all commands.
+ return TOPIC_HANDLED // Eat all commands.
return ..(command)
/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/process()
diff --git a/code/modules/synthesized_instruments/real_instruments.dm b/code/modules/synthesized_instruments/real_instruments.dm
index 9324dc19c50..b3cd8c900e2 100644
--- a/code/modules/synthesized_instruments/real_instruments.dm
+++ b/code/modules/synthesized_instruments/real_instruments.dm
@@ -18,11 +18,11 @@
maximum_line_length = global.musical_config.max_line_length
instruments = istype(what) ? list(what) : what
-/datum/real_instrument/proc/Topic_call(href, href_list, usr)
+/datum/real_instrument/proc/OnTopic(mob/user, href_list)
var/target = href_list["target"]
var/value = text2num(href_list["value"])
if (href_list["value"] && !isnum(value))
- to_chat(usr, "Non-numeric value was given.")
+ to_chat(user, "Non-numeric value was given.")
return 0
@@ -31,20 +31,20 @@
if ("play")
src.player.song.playing = value
if (src.player.song.playing)
- src.player.song.play_song(usr)
+ src.player.song.play_song(user)
if ("newsong")
src.player.song.lines.Cut()
src.player.song.tempo = src.player.song.sanitize_tempo(5) // default 120 BPM
if ("import")
var/t = ""
do
- t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", owner.name), t) as message)
- if(!CanInteractWith(usr, owner, global.physical_topic_state))
+ t = html_encode(input(user, "Please paste the entire song, formatted:", text("[]", owner.name), t) as message)
+ if(!CanInteractWith(user, owner, global.physical_topic_state))
return
if(length(t) >= 2*src.maximum_lines*src.maximum_line_length)
- var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
- if(!CanInteractWith(usr, owner, global.physical_topic_state))
+ var/cont = input(user, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
+ if(!CanInteractWith(user, owner, global.physical_topic_state))
return
if(cont == "no")
break
@@ -60,24 +60,24 @@
else
src.player.song.tempo = src.player.song.sanitize_tempo(5) // default 120 BPM
if(src.player.song.lines.len > maximum_lines)
- to_chat(usr,"Too many lines!")
+ to_chat(user,"Too many lines!")
src.player.song.lines.Cut(maximum_lines+1)
var/linenum = 1
for(var/l in src.player.song.lines)
if(length(l) > maximum_line_length)
- to_chat(usr, "Line [linenum] too long!")
+ to_chat(user, "Line [linenum] too long!")
src.player.song.lines.Remove(l)
else
linenum++
if ("show_song_editor")
if (!src.song_editor)
src.song_editor = new (host = src.owner, song = src.player.song)
- src.song_editor.ui_interact(usr)
+ src.song_editor.ui_interact(user)
if ("show_usage")
if (!src.usage_info)
src.usage_info = new (owner, src.player)
- src.usage_info.ui_interact(usr)
+ src.usage_info.ui_interact(user)
if ("volume")
src.player.volume = min(max(min(player.volume+text2num(value), 100), 0), player.max_volume)
if ("transposition")
@@ -91,8 +91,8 @@
if ("sustain_timer")
src.player.song.sustain_timer = max(min(player.song.sustain_timer+value, global.musical_config.longest_sustain_timer), 1)
if ("soft_coeff")
- var/new_coeff = input(usr, "from [global.musical_config.gentlest_drop] to [global.musical_config.steepest_drop]") as num
- if(!CanInteractWith(usr, owner, global.physical_topic_state))
+ var/new_coeff = input(user, "from [global.musical_config.gentlest_drop] to [global.musical_config.steepest_drop]") as num
+ if(!CanInteractWith(user, owner, global.physical_topic_state))
return
new_coeff = round(min(max(new_coeff, global.musical_config.gentlest_drop), global.musical_config.steepest_drop), 0.001)
src.player.song.soft_coeff = new_coeff
@@ -102,8 +102,8 @@
var/datum/instrument/instrument = instruments[key]
categories |= instrument.category
- var/category = input(usr, "Choose a category") as null|anything in categories
- if(!CanInteractWith(usr, owner, global.physical_topic_state))
+ var/category = input(user, "Choose a category") as null|anything in categories
+ if(!CanInteractWith(user, owner, global.physical_topic_state))
return
var/list/instruments_available = list()
for (var/key in instruments)
@@ -111,8 +111,8 @@
if (instrument.category == category)
instruments_available += key
- var/new_instrument = input(usr, "Choose an instrument") as null|anything in instruments_available
- if(!CanInteractWith(usr, owner, global.physical_topic_state))
+ var/new_instrument = input(user, "Choose an instrument") as null|anything in instruments_available
+ if(!CanInteractWith(user, owner, global.physical_topic_state))
return
if (new_instrument)
src.player.song.instrument_data = instruments[new_instrument]
@@ -123,14 +123,14 @@
if (global.musical_config.env_settings_available)
if (!src.env_editor)
src.env_editor = new (src.player)
- src.env_editor.ui_interact(usr)
+ src.env_editor.ui_interact(user)
else
- to_chat(usr, "Virtual environment is disabled.")
+ to_chat(user, "Virtual environment is disabled.")
if ("show_echo_editor")
if (!src.echo_editor)
src.echo_editor = new (src.player)
- src.echo_editor.ui_interact(usr)
+ src.echo_editor.ui_interact(user)
if ("select_env")
if (value in -1 to 26)
@@ -239,11 +239,8 @@
return 0
-/obj/structure/synthesized_instrument/Topic(href, href_list)
- if (..())
- return 1
-
- return real_instrument.Topic_call(href, href_list, usr)
+/obj/structure/synthesized_instrument/OnTopic(mob/user, href_list)
+ return ..() || real_instrument.OnTopic(user, href_list)
////////////////////////
@@ -291,10 +288,7 @@
/obj/item/synthesized_instrument/proc/shouldStopPlaying(mob/user)
- return !(src && in_range(src, user))
-
-/obj/item/synthesized_instrument/Topic(href, href_list)
- if (..())
- return 1
+ return src && CanPhysicallyInteract(user)
- return real_instrument.Topic_call(href, href_list, usr)
\ No newline at end of file
+/obj/item/synthesized_instrument/OnTopic(mob/user, href_list)
+ return ..() || real_instrument.OnTopic(user, href_list)
\ No newline at end of file
diff --git a/mods/content/psionics/machines/psimeter.dm b/mods/content/psionics/machines/psimeter.dm
index b3abc2cb9c5..8266066e7e1 100644
--- a/mods/content/psionics/machines/psimeter.dm
+++ b/mods/content/psionics/machines/psimeter.dm
@@ -42,30 +42,22 @@
popup.set_content(jointext(dat,null))
popup.open()
-/obj/machinery/psi_meter/Topic(href, href_list)
+/obj/machinery/psi_meter/OnTopic(mob/user, href_list)
. = ..()
- if(!.)
-
- if(!issilicon(usr) && !Adjacent(usr))
- return FALSE
-
- var/refresh
- if(href_list["print"])
- if(last_assay)
- var/obj/item/paper/P = new(loc)
- P.name = "paper - Psi-Assay ([last_assayed.name])"
- P.info = jointext(last_assay - last_assay[last_assay.len],null) // Last line is 'print | clear' link line.
- return TRUE
-
- if(href_list["clear"])
- last_assay = null
- refresh = TRUE
- else if(href_list["assay"])
- last_assayed = locate(href_list["assay"])
- if(istype(last_assayed))
- last_assayed.show_psi_assay(usr, src)
- refresh = TRUE
-
- if(refresh)
- interact(usr)
- return TRUE
+ if(.)
+ return
+ if(href_list["print"])
+ if(last_assay)
+ var/obj/item/paper/P = new(loc)
+ P.name = "paper - Psi-Assay ([last_assayed.name])"
+ P.info = jointext(last_assay - last_assay[last_assay.len],null) // Last line is 'print | clear' link line.
+ return TOPIC_HANDLED
+ if(href_list["clear"])
+ last_assay = null
+ return TOPIC_REFRESH
+ else if(href_list["assay"])
+ last_assayed = locate(href_list["assay"])
+ if(istype(last_assayed))
+ last_assayed.show_psi_assay(usr, src)
+ return TOPIC_REFRESH
+ return TOPIC_NOACTION
\ No newline at end of file
diff --git a/mods/content/psionics/machines/psimonitor.dm b/mods/content/psionics/machines/psimonitor.dm
index de83ed6b114..60096626717 100644
--- a/mods/content/psionics/machines/psimonitor.dm
+++ b/mods/content/psionics/machines/psimonitor.dm
@@ -29,45 +29,44 @@
return TRUE
return FALSE
-/obj/machinery/psi_monitor/Topic(href, href_list)
-
+/obj/machinery/psi_monitor/OnTopic(mob/user, href_list)
. = ..()
- if(!.)
-
- if(href_list["login"])
-
- var/obj/item/card/id/ID = usr.GetIdCard()
- if(!ID || !allowed(usr))
- to_chat(usr, "Access denied.")
- else
- authorized = "[ID.registered_name] ([ID.assignment])"
- . = 1
-
- else if(href_list["logout"])
- authorized = FALSE
- . = 1
-
- else if(href_list["show_violations"])
- show_violations = (href_list["show_violations"] == "1")
- . = 1
-
- else if(href_list["remove_violation"])
- var/remove_ind = text2num(href_list["remove_violation"])
- if(remove_ind > 0 && remove_ind <= psi_violations.len)
- psi_violations.Cut(remove_ind, remove_ind++)
- . = 1
-
- else if(href_list["change_mode"])
- var/obj/item/implant/psi_control/implant = locate(href_list["change_mode"])
- if(implant.imp_in && !implant.malfunction)
- var/choice = input("Select a new implant mode.", "Psi Dampener") as null|anything in list(PSI_IMPLANT_AUTOMATIC, PSI_IMPLANT_SHOCK, PSI_IMPLANT_WARN, PSI_IMPLANT_LOG, PSI_IMPLANT_DISABLED)
- if(choice && implant && implant.imp_in && !implant.malfunction)
- implant.psi_mode = choice
- implant.update_functionality()
- . = 1
-
- if(. && usr)
- interact(usr)
+ if(.)
+ return
+
+ if(href_list["login"])
+ var/obj/item/card/id/ID = user.GetIdCard()
+ if(!ID || !allowed(user))
+ to_chat(user, "Access denied.")
+ return TOPIC_HANDLED
+ else
+ authorized = "[ID.registered_name] ([ID.assignment])"
+ return TOPIC_REFRESH
+
+ else if(href_list["logout"])
+ authorized = FALSE
+ return TOPIC_REFRESH
+
+ else if(href_list["show_violations"])
+ show_violations = (href_list["show_violations"] == "1")
+ return TOPIC_REFRESH
+
+ else if(href_list["remove_violation"])
+ var/remove_ind = text2num(href_list["remove_violation"])
+ if(remove_ind > 0 && remove_ind <= psi_violations.len)
+ psi_violations.Cut(remove_ind, remove_ind++)
+ return TOPIC_REFRESH
+
+ else if(href_list["change_mode"])
+ var/obj/item/implant/psi_control/implant = locate(href_list["change_mode"])
+ if(implant.imp_in && !implant.malfunction)
+ var/choice = input("Select a new implant mode.", "Psi Dampener") as null|anything in list(PSI_IMPLANT_AUTOMATIC, PSI_IMPLANT_SHOCK, PSI_IMPLANT_WARN, PSI_IMPLANT_LOG, PSI_IMPLANT_DISABLED)
+ if(choice && implant && implant.imp_in && !implant.malfunction)
+ implant.psi_mode = choice
+ implant.update_functionality()
+ return TOPIC_REFRESH
+ return TOPIC_HANDLED
+ return TOPIC_NOACTION
/obj/machinery/psi_monitor/interface_interact(var/mob/user)
interact(user)
diff --git a/mods/content/xenobiology/slime/_slime.dm b/mods/content/xenobiology/slime/_slime.dm
index 723564251da..71fda53a331 100644
--- a/mods/content/xenobiology/slime/_slime.dm
+++ b/mods/content/xenobiology/slime/_slime.dm
@@ -296,9 +296,6 @@
/mob/living/slime/check_has_mouth()
return FALSE
-/mob/living/slime/set_nutrition(amt)
- ..()
-
/mob/living/slime/get_hydration()
return get_nutrition()
diff --git a/mods/gamemodes/cult/runes.dm b/mods/gamemodes/cult/runes.dm
index c54cb016914..c8e47d2bed6 100644
--- a/mods/gamemodes/cult/runes.dm
+++ b/mods/gamemodes/cult/runes.dm
@@ -129,7 +129,7 @@
if(!cult.can_become_antag(target.mind, 1))
to_chat(target, SPAN_DANGER("Are you going insane?"))
else
- to_chat(target, SPAN_OCCULT("Do you want to join the cult of Nar'Sie? You can choose to ignore offer... Join the cult."))
+ to_chat(target, SPAN_OCCULT("Do you want to join the cult of Nar'Sie? You can choose to ignore the offer... Join the cult."))
spamcheck = 1
spawn(40)
@@ -150,10 +150,10 @@
to_chat(target, SPAN_OCCULT("Your mind turns to ash as the burning flames engulf your very soul and images of an unspeakable horror begin to bombard the last remnants of mental resistance."))
target.take_overall_damage(0, 10)
-/obj/effect/rune/convert/Topic(href, href_list)
- if(href_list["join"] && usr.loc == loc && !iscultist(usr))
+/obj/effect/rune/convert/OnTopic(mob/user, href_list)
+ if(href_list["join"] && user.loc == loc && !iscultist(user))
var/decl/special_role/cult = GET_DECL(/decl/special_role/cultist)
- cult.add_antagonist(usr.mind, ignore_role = 1, do_not_equip = 1)
+ cult.add_antagonist(user.mind, ignore_role = 1, do_not_equip = 1)
/obj/effect/rune/teleport
cultname = "teleport"
@@ -214,16 +214,16 @@
return
destination = sanitize(input)
-/obj/effect/rune/teleport/Topic(href, href_list)
- if(usr.loc != src)
+/obj/effect/rune/teleport/OnTopic(mob/user, href_list)
+ if(user.loc != src)
return
if(href_list["target"])
var/obj/effect/rune/teleport/targ = locate(href_list["target"])
if(istype(targ)) // Checks for null, too
- usr.forceMove(targ)
- targ.showOptions(usr)
+ user.forceMove(targ)
+ targ.showOptions(user)
else if(href_list["leave"])
- leaveRune(usr)
+ leaveRune(user)
/obj/effect/rune/teleport/proc/showOptions(var/mob/living/user)
var/list/t = list()
diff --git a/mods/gamemodes/traitor/syndicatebeacon.dm b/mods/gamemodes/traitor/syndicatebeacon.dm
index 63ad135fb2c..1386e2c44f4 100644
--- a/mods/gamemodes/traitor/syndicatebeacon.dm
+++ b/mods/gamemodes/traitor/syndicatebeacon.dm
@@ -37,22 +37,20 @@
show_browser(user, dat, "window=syndbeacon")
onclose(user, "syndbeacon")
-/obj/machinery/syndicate_beacon/Topic(href, href_list)
- if(..())
+/obj/machinery/syndicate_beacon/OnTopic(mob/user, href_list)
+ if((. = ..()))
return
if(href_list["betraitor"])
+ . = TOPIC_REFRESH
if(charges < 1)
- src.updateUsrDialog()
return
var/mob/M = locate(href_list["traitormob"])
if(M.mind.assigned_special_role || jobban_isbanned(M, /decl/special_role/traitor))
temptext = "We have no need for you at this time. Have a pleasant day.
"
- src.updateUsrDialog()
return
charges -= 1
if(prob(50))
temptext = "Double-crosser. You planned to betray us from the start. Allow us to repay the favor in kind."
- src.updateUsrDialog()
addtimer(CALLBACK(src, PROC_REF(selfdestruct)), rand(5, 20) SECONDS)
return
if(ishuman(M))
@@ -61,10 +59,7 @@
var/decl/special_role/traitors = GET_DECL(/decl/special_role/traitor)
traitors.add_antagonist(N.mind)
log_and_message_admins("has accepted a traitor objective from a syndicate beacon.", M)
-
-
- src.updateUsrDialog()
- return
+ return
/obj/machinery/syndicate_beacon/proc/selfdestruct()
diff --git a/nano/templates/space_heater.tmpl b/nano/templates/space_heater.tmpl
new file mode 100644
index 00000000000..0b6c683380c
--- /dev/null
+++ b/nano/templates/space_heater.tmpl
@@ -0,0 +1,21 @@
+
+
+
Power
+
+ {{if data.has_cell == 0}}
+ None
+ {{else}}
+ Battery ({{:data.cell_percent}}%)
+ {{/if}}
+
+
+
+
Temperature
+
+ {{:helper.link('--', '', {'adj_temp' : -5})}}
+ {{:helper.link('-', '', {'adj_temp' : -1})}}
+
{{:data.set_temperature}}K ({{:data.set_temperature - 273.15}}°C)
+ {{:helper.link('+', '', {'adj_temp' : 1})}}
+ {{:helper.link('++', '', {'adj_temp' : 5})}}
+
+
\ No newline at end of file