diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index 6a42640d86618..e6f9bad4045ef 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -313,47 +313,35 @@
to_check_turfs |= adjacent_turf
return null
-/mob/living/simple_animal/bot/atmosbot/get_controls(mob/user)
- var/dat
- dat += hack(user)
- dat += showpai(user)
- dat += "Atmospheric Stabilizer Controls v1.1
"
- dat += "Status: [on ? "On" : "Off"]
"
- dat += "Maintenance panel panel is [open ? "opened" : "closed"]
"
- if(!locked || issilicon(user) || IsAdminGhost(user))
- dat += "Breach Pressure: [breached_pressure]
"
- dat += "Temperature Control: [temperature_control?"Enabled":"Disabled"]
"
- dat += "Temperature Target: [ideal_temperature]K
"
- dat += "Gas Scrubbing Controls
"
- for(var/gas_id in gasses)
- var/gas_enabled = gasses[gas_id]
- dat += "[GLOB.gas_data.names[gas_id]]: [gas_enabled?"Scrubbing":"Not Scrubbing"]
"
- dat += "Patrol Station: [auto_patrol ? "Yes" : "No"]
"
- return dat
-
-/mob/living/simple_animal/bot/atmosbot/Topic(href, href_list)
- if(..())
- return TRUE
-
- if(href_list["set_breach_pressure"])
- var/new_breach_pressure = input(usr, "Pressure to scan for breaches at? (0 to 100)", "Breach Pressure") as num
- if(!isnum(new_breach_pressure) || new_breach_pressure < 0 || new_breach_pressure > 100)
- return
- breached_pressure = new_breach_pressure
- else if(href_list["toggle_temp_control"])
- temperature_control = temperature_control ? FALSE : TRUE
- else if(href_list["toggle_gas"])
- var/gas_id = href_list["toggle_gas"]
- for(var/G in gasses)
- if("[G]" == gas_id)
- gasses[G] = gasses[G] ? FALSE : TRUE
- else if(href_list["set_ideal_temperature"])
- var/new_temp = input(usr, "Set Target Temperature ([T0C]K to [T20C + 20]K)", "Target Temperature") as num
- if(!isnum(new_temp) || new_temp < T0C || new_temp > T20C + 20)
- return
- ideal_temperature = new_temp
-
- update_controls()
+/mob/living/simple_animal/bot/atmosbot/ui_data(mob/user)
+ var/list/data = ..()
+ if (!locked || issilicon(user) || IsAdminGhost(user))
+ data["custom_controls"]["breach_pressure"] = breached_pressure
+ data["custom_controls"]["temperature_control"] = temperature_control
+ data["custom_controls"]["ideal_temperature"] = ideal_temperature
+ data["custom_controls"]["scrub_gasses"] = gasses
+ return data
+
+/mob/living/simple_animal/bot/atmosbot/ui_act(action, params)
+ . = ..()
+ if(. || (locked && !usr.has_unlimited_silicon_privilege))
+ return
+ switch(action)
+ if("breach_pressure")
+ var/adjust_num = round(text2num(params["pressure"]))
+ adjust_num = clamp(adjust_num, 0, 100)
+ breached_pressure = adjust_num
+ if("temperature_control")
+ temperature_control = !temperature_control
+ if("ideal_temperature")
+ var/adjust_num = round(text2num(params["temperature"]))
+ adjust_num = clamp(adjust_num, T0C, T20C + 20)
+ ideal_temperature = adjust_num
+ if("scrub_gasses")
+ var/id = params["id"]
+ for(var/gas_id in gasses)
+ if (gas_id == id)
+ gasses[id] = !gasses[id]
update_icon()
/mob/living/simple_animal/bot/atmosbot/update_icon()
diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index f4b33a44b3aed..28e3c1d1d760d 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -306,18 +306,22 @@
/mob/living/simple_animal/bot/attack_hand(mob/living/carbon/human/H)
if(H.a_intent == INTENT_HELP)
- interact(H)
+ ui_interact(H)
else
return ..()
/mob/living/simple_animal/bot/attack_ai(mob/user)
if(!topic_denied(user))
- interact(user)
+ ui_interact(user)
else
to_chat(user, "[src]'s interface is not responding!")
-/mob/living/simple_animal/bot/interact(mob/user)
- show_controls(user)
+/mob/living/simple_animal/bot/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "SimpleBot", name)
+ ui.set_autoupdate(TRUE)
+ ui.open()
/mob/living/simple_animal/bot/proc/togglelock(mob/living/user)
if(bot_core.allowed(user) && !open && !emagged)
@@ -899,6 +903,79 @@ Pass a positive integer as an argument to override a bot's default speed.
D.open()
frustration = 0
+/mob/living/simple_animal/bot/ui_data(mob/user)
+ var/list/data = list()
+ data["can_hack"] = (issilicon(user) || IsAdminGhost(user))
+ data["custom_controls"] = list()
+ data["emagged"] = emagged
+ data["locked"] = locked
+ data["pai"] = list()
+ data["settings"] = list()
+ if(!locked || issilicon(user) || IsAdminGhost(user))
+ data["pai"]["allow_pai"] = allow_pai
+ data["pai"]["card_inserted"] = paicard
+ data["settings"]["airplane_mode"] = !remote_disabled
+ data["settings"]["maintenance_lock"] = !open
+ data["settings"]["power"] = on
+ data["settings"]["booting"] = booting
+ data["settings"]["patrol_station"] = auto_patrol
+ return data
+
+// Actions received from TGUI
+/mob/living/simple_animal/bot/ui_act(action, params)
+ . = ..()
+ if(.)
+ return
+ if(!bot_core.allowed(usr) && !usr.has_unlimited_silicon_privilege)
+ to_chat(usr, "Access denied.")
+ return
+ if(action == "lock")
+ locked = !locked
+ if(locked && !(issilicon(usr) || IsAdminGhost(usr)))
+ return
+ switch(action)
+ if("power")
+ if(bot_core.allowed(usr) || !locked)
+ if (on)
+ turn_off()
+ else
+ boot_up_sequence()
+ if("maintenance")
+ open = !open
+ if("patrol")
+ if(!issilicon(usr) && !IsAdminGhost(usr) && !(bot_core.allowed(usr) || !locked))
+ return TRUE
+ auto_patrol = !auto_patrol
+ bot_reset()
+ if("airplane")
+ remote_disabled = !remote_disabled
+ if("hack")
+ if(!issilicon(usr) && !IsAdminGhost(usr))
+ return TRUE
+ if(emagged != 2)
+ emagged = 2
+ hacked = TRUE
+ locked = TRUE
+ to_chat(usr, "[text_hack]")
+ message_admins("Safety lock of [ADMIN_LOOKUPFLW(src)] was disabled by [ADMIN_LOOKUPFLW(usr)] in [ADMIN_VERBOSEJMP(src)]")
+ log_game("Safety lock of [src] was disabled by [key_name(usr)] in [AREACOORD(src)]")
+ bot_reset()
+ else if(!hacked)
+ to_chat(usr, "[text_dehack_fail]")
+ else
+ emagged = FALSE
+ hacked = FALSE
+ to_chat(usr, "[text_dehack]")
+ log_game("Safety lock of [src] was re-enabled by [key_name(usr)] in [AREACOORD(src)]")
+ bot_reset()
+ if("eject_pai")
+ if(locked && !(issilicon(usr) || IsAdminGhost(usr)))
+ return
+ if(paicard)
+ to_chat(usr, "You eject [paicard] from [bot_name]")
+ ejectpai(usr)
+ //update_controls()
+
/mob/living/simple_animal/bot/proc/show_controls(mob/M)
users |= M
var/dat = ""
diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm
index 4ebba0bbabbf7..9d3538e7f328f 100644
--- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm
@@ -434,39 +434,30 @@
/obj/machinery/bot_core/cleanbot
req_one_access = list(ACCESS_JANITOR, ACCESS_ROBOTICS)
-
-/mob/living/simple_animal/bot/cleanbot/get_controls(mob/user)
- var/dat
- dat += hack(user)
- dat += showpai(user)
- // missing bot program name here
- dat += "
Status: [on ? "On" : "Off"]"
- dat += "
Behaviour controls are [locked ? "locked" : "unlocked"]"
- dat += "
Maintenance panel panel is [open ? "opened" : "closed"]"
-
+/mob/living/simple_animal/bot/cleanbot/ui_data(mob/user)
+ var/list/data = ..()
if(!locked || issilicon(user)|| IsAdminGhost(user))
- dat += "
Clean Blood: [blood ? "Yes" : "No"]"
- dat += "
Clean Trash: [trash ? "Yes" : "No"]"
- dat += "
Clean Graffiti: [drawn ? "Yes" : "No"]"
- dat += "
Exterminate Pests: [pests ? "Yes" : "No"]"
- dat += "
Patrol Station: [auto_patrol ? "Yes" : "No"]"
- return dat
-
-/mob/living/simple_animal/bot/cleanbot/Topic(href, href_list)
- if(..())
- return 1
- if(href_list["operation"])
- switch(href_list["operation"])
- if("blood")
- blood = !blood
- if("pests")
- pests = !pests
- if("trash")
- trash = !trash
- if("drawn")
- drawn = !drawn
- get_targets()
- update_controls()
+ data["custom_controls"]["clean_blood"] = blood
+ data["custom_controls"]["clean_trash"] = trash
+ data["custom_controls"]["clean_graffiti"] = drawn
+ data["custom_controls"]["pest_control"] = pests
+ return data
+
+/mob/living/simple_animal/bot/cleanbot/ui_act(action, params)
+ if (..())
+ return
+ if(!(bot_core.allowed(usr) || usr.has_unlimited_silicon_privilege) || locked)
+ return
+ switch(action)
+ if("clean_blood")
+ blood = !blood
+ if("clean_trash")
+ trash = !trash
+ if("clean_graffiti")
+ drawn = !drawn
+ if("pest_control")
+ pests = !pests
+ get_targets()
/obj/machinery/bot_core/cleanbot/medbay
req_one_access = list(ACCESS_JANITOR, ACCESS_ROBOTICS, ACCESS_MEDICAL)
diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm
index 7ee271a9b8640..f23d9838f0fa4 100644
--- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm
@@ -98,27 +98,18 @@
text_dehack = "You restore [name]'s combat inhibitor."
text_dehack_fail = "[name] ignores your attempts to restrict him!"
-/mob/living/simple_animal/bot/ed209/get_controls(mob/user)
- var/dat
- dat += hack(user)
- dat += showpai(user)
- dat += "Security Unit v2.6 controls
"
- dat += "
Status: [on ? "On" : "Off"]"
- dat += "
Behaviour controls are [locked ? "locked" : "unlocked"]"
- dat += "
Maintenance panel panel is [open ? "opened" : "closed"]"
-
- if(!locked || issilicon(user)|| IsAdminGhost(user))
+/mob/living/simple_animal/bot/ed209/ui_data(mob/user)
+ var/list/data = ..()
+ if (!locked || issilicon(user) || IsAdminGhost(user))
if(!lasercolor)
- dat += "
"
- dat += "
Arrest Unidentifiable Persons: [idcheck ? "Yes" : "No"]"
- dat += "
Arrest for Unauthorized Weapons: [weaponscheck ? "Yes" : "No"]"
- dat += "
Arrest for Warrant: [check_records ? "Yes" : "No"]"
- dat += "
Operating Mode: [arrest_type ? "Detain" : "Arrest"]"
- dat += "
Report Arrests [declare_arrests ? "Yes" : "No"]"
- dat += "
Auto Patrol [auto_patrol ? "On" : "Off"]"
- return dat
-
-/mob/living/simple_animal/bot/ed209/Topic(href, href_list)
+ data["custom_controls"]["check_id"] = idcheck
+ data["custom_controls"]["check_weapons"] = weaponscheck
+ data["custom_controls"]["check_warrants"] = check_records
+ data["custom_controls"]["handcuff_targets"] = !arrest_type
+ data["custom_controls"]["arrest_alert"] = declare_arrests
+ return data
+
+/mob/living/simple_animal/bot/ed209/ui_act(action, params)
if(lasercolor && ishuman(usr))
var/mob/living/carbon/human/H = usr
if((lasercolor == "b") && (istype(H.wear_suit, /obj/item/clothing/suit/redtag)))//Opposing team cannot operate it
@@ -126,24 +117,19 @@
else if((lasercolor == "r") && (istype(H.wear_suit, /obj/item/clothing/suit/bluetag)))
return
if(..())
- return 1
+ return
- switch(href_list["operation"])
- if("idcheck")
+ switch(action)
+ if("check_id")
idcheck = !idcheck
- update_controls()
- if("weaponscheck")
+ if("check_weapons")
weaponscheck = !weaponscheck
- update_controls()
- if("ignorerec")
+ if("check_warrants")
check_records = !check_records
- update_controls()
- if("switchmode")
+ if("handcuff_targets")
arrest_type = !arrest_type
- update_controls()
- if("declarearrests")
+ if("arrest_alert")
declare_arrests = !declare_arrests
- update_controls()
/mob/living/simple_animal/bot/ed209/proc/judgment_criteria()
var/final = FALSE
diff --git a/code/modules/mob/living/simple_animal/bot/firebot.dm b/code/modules/mob/living/simple_animal/bot/firebot.dm
index 3dad5161e63a0..3a5498f831ec1 100644
--- a/code/modules/mob/living/simple_animal/bot/firebot.dm
+++ b/code/modules/mob/living/simple_animal/bot/firebot.dm
@@ -105,22 +105,13 @@
text_dehack = "You detect errors in [name] and reset his programming."
text_dehack_fail = "[name] is not responding to reset commands!"
-/mob/living/simple_animal/bot/firebot/get_controls(mob/user)
- var/dat
- dat += hack(user)
- dat += showpai(user)
- dat += "Mobile Fire Extinguisher v1.0
"
- dat += "Status: [on ? "On" : "Off"]
"
- dat += "Maintenance panel panel is [open ? "opened" : "closed"]
"
-
- dat += "Behaviour controls are [locked ? "locked" : "unlocked"]
"
+/mob/living/simple_animal/bot/firebot/ui_data(mob/user)
+ var/list/data = ..()
if(!locked || issilicon(user) || IsAdminGhost(user))
- dat += "Extinguish Fires: [extinguish_fires ? "Yes" : "No"]
"
- dat += "Extinguish People: [extinguish_people ? "Yes" : "No"]
"
- dat += "Patrol Station: [auto_patrol ? "Yes" : "No"]
"
- dat += "Stationary Mode: [stationary_mode ? "Yes" : "No"]
"
-
- return dat
+ data["custom_controls"]["extinguish_fires"] = extinguish_fires
+ data["custom_controls"]["extinguish_people"] = extinguish_people
+ data["custom_controls"]["stationary_mode"] = stationary_mode
+ return data
/mob/living/simple_animal/bot/firebot/on_emag(atom/target, mob/user)
..()
@@ -142,19 +133,18 @@
internal_ext.max_water = INFINITY
internal_ext.refill()
-/mob/living/simple_animal/bot/firebot/Topic(href, href_list)
+/mob/living/simple_animal/bot/firebot/ui_act(action, params)
if(..())
- return TRUE
-
- switch(href_list["operation"])
+ return
+ if(!(bot_core.allowed(usr) || usr.has_unlimited_silicon_privilege) || locked)
+ return
+ switch(action)
if("extinguish_fires")
extinguish_fires = !extinguish_fires
if("extinguish_people")
extinguish_people = !extinguish_people
if("stationary_mode")
stationary_mode = !stationary_mode
-
- update_controls()
update_icon()
/mob/living/simple_animal/bot/firebot/proc/is_burning(atom/target)
diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm
index e4d3c3819dd22..938ab34e7f422 100644
--- a/code/modules/mob/living/simple_animal/bot/floorbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm
@@ -84,35 +84,23 @@
text_dehack = "You detect errors in [name] and reset his programming."
text_dehack_fail = "[name] is not responding to reset commands!"
-/mob/living/simple_animal/bot/floorbot/get_controls(mob/user)
- var/dat
- dat += hack(user)
- dat += showpai(user)
- dat += "Floor Repairer Controls v1.1
"
- dat += "Status: [on ? "On" : "Off"]
"
- dat += "Maintenance panel panel is [open ? "opened" : "closed"]
"
- dat += "Special tiles: "
- if(tilestack)
- dat += "Loaded \[[tilestack.amount]/[maxtiles]\]
"
- else
- dat += "None Loaded
"
-
- dat += "Behaviour controls are [locked ? "locked" : "unlocked"]
"
+/mob/living/simple_animal/bot/floorbot/ui_data(mob/user)
+ var/list/data = ..()
if(!locked || issilicon(user) || IsAdminGhost(user))
- dat += "Add tiles to new hull plating: [autotile ? "Yes" : "No"]
"
- dat += "Place floor tiles: [placetiles ? "Yes" : "No"]
"
- dat += "Replace existing floor tiles with custom tiles: [replacetiles ? "Yes" : "No"]
"
- dat += "Repair damaged tiles and platings: [fixfloors ? "Yes" : "No"]
"
- dat += "Traction Magnets: [HAS_TRAIT_FROM(src, TRAIT_IMMOBILIZED, BUSY_FLOORBOT_TRAIT) ? "Engaged" : "Disengaged"]
"
- dat += "Patrol Station: [auto_patrol ? "Yes" : "No"]
"
- var/bmode
+ data["custom_controls"]["tile_hull"] = autotile
+ data["custom_controls"]["place_tiles"] = placetiles
+ data["custom_controls"]["place_custom"] = replacetiles
+ data["custom_controls"]["repair_damage"] = fixfloors
+ data["custom_controls"]["traction_magnets"] = HAS_TRAIT_FROM(src, TRAIT_IMMOBILIZED, BUSY_FLOORBOT_TRAIT)
+ data["custom_controls"]["line_mode"] = FALSE
+ data["custom_controls"]["tile_stack"] = list(
+ "tilestack" = tilestack,
+ "amount" = tilestack?.amount,
+ "max_amount" = tilestack?.max_amount
+ )
if(targetdirection)
- bmode = dir2text(targetdirection)
- else
- bmode = "disabled"
- dat += "Line Mode : [bmode]
"
-
- return dat
+ data["custom_controls"]["line_mode"] = dir2text(targetdirection)
+ return data
/mob/living/simple_animal/bot/floorbot/attackby(obj/item/W , mob/user, params)
if(istype(W, /obj/item/stack/tile/iron))
@@ -159,26 +147,26 @@
if(change_icon)
update_icon()
-/mob/living/simple_animal/bot/floorbot/Topic(href, href_list)
- if(..())
- return TRUE
+/mob/living/simple_animal/bot/floorbot/ui_act(action, params)
+ if (..() || (locked && !usr.has_unlimited_silicon_privilege))
+ return
- switch(href_list["operation"])
- if("replace")
+ switch(action)
+ if("place_custom")
replacetiles = !replacetiles
- if("place")
+ if("place_tiles")
placetiles = !placetiles
- if("fix")
+ if("repair_damage")
fixfloors = !fixfloors
- if("autotile")
+ if("tile_hull")
autotile = !autotile
- if("magnet")
+ if("traction_magnets")
toggle_magnet(!HAS_TRAIT_FROM(src, TRAIT_IMMOBILIZED, BUSY_FLOORBOT_TRAIT), FALSE)
- if("eject")
+ if("eject_tiles")
if(tilestack)
tilestack.forceMove(drop_location())
- if("linemode")
+ if("line_mode")
var/setdir = input("Select construction direction:") as null|anything in list("north","east","south","west","disable")
switch(setdir)
if("north")
@@ -191,7 +179,6 @@
targetdirection = 8
if("disable")
targetdirection = null
- update_controls()
/mob/living/simple_animal/bot/floorbot/handle_automated_action()
if(!..())
diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm
index 57112432d06f6..792a297a3007f 100644
--- a/code/modules/mob/living/simple_animal/bot/honkbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm
@@ -84,20 +84,6 @@
text_dehack = "You reboot [name] and restore the sound control system."
text_dehack_fail = "[name] refuses to accept your authority!"
-/mob/living/simple_animal/bot/honkbot/get_controls(mob/user)
- var/dat
- dat += hack(user)
- dat += showpai(user)
- dat += "Honkomatic Bike Horn Unit v1.0.7 controls
"
- dat += "
Status: [on ? "On" : "Off"]"
- dat += "
Behaviour controls are [locked ? "locked" : "unlocked"]"
- dat += "
Maintenance panel panel is [open ? "opened" : "closed"]"
-
- if(!locked || issilicon(user) || IsAdminGhost(user))
- dat += "
"
- dat += "
Auto Patrol: [auto_patrol ? "On" : "Off"]"
- return dat
-
/mob/living/simple_animal/bot/honkbot/proc/judgment_criteria()
var/final = NONE
if(check_records)
diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm
index e6dcf1a097850..30cba21274ccd 100644
--- a/code/modules/mob/living/simple_animal/bot/medbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/medbot.dm
@@ -156,97 +156,70 @@ GLOBAL_VAR(medibot_unique_id_gen)
/mob/living/simple_animal/bot/medbot/attack_paw(mob/user)
return attack_hand(user)
-/mob/living/simple_animal/bot/medbot/get_controls(mob/user)
- var/dat
- dat += hack(user)
- dat += showpai(user)
- dat += "Medical Unit Controls v1.1
"
- dat += "Status: [on ? "On" : "Off"]
"
- dat += "Maintenance panel panel is [open ? "opened" : "closed"]
"
- dat += "
Behaviour controls are [locked ? "locked" : "unlocked"]