diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index e71b30706ca..5335cf9db6b 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -295,18 +295,21 @@
/mob/living/simple_animal/bot/attack_hand(mob/living/carbon/human/user, list/modifiers)
if(!user.combat_mode)
- interact(user)
+ ui_interact(user)
else
return ..()
/mob/living/simple_animal/bot/attack_ai(mob/user)
if(!topic_denied(user))
- interact(user)
+ ui_interact(user)
else
to_chat(user, span_warning("[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.open()
/mob/living/simple_animal/bot/AltClick(mob/user)
. = ..()
@@ -829,48 +832,50 @@ Pass a positive integer as an argument to override a bot's default speed.
D.open()
frustration = 0
-/mob/living/simple_animal/bot/proc/show_controls(mob/M)
- users |= M
- var/dat = ""
- dat = get_controls(M)
- var/datum/browser/popup = new(M,window_id,window_name,350,600)
- popup.set_content(dat)
- popup.open(use_onclose = FALSE)
- onclose(M,window_id,ref=src)
- return
+// Variables sent to TGUI
+/mob/living/simple_animal/bot/ui_data(mob/user)
+ var/list/data = list()
+ data["can_hack"] = (issilicon(user) || isAdminGhostAI(user))
+ data["custom_controls"] = list()
+ data["emagged"] = emagged
+ data["locked"] = locked
+ data["pai"] = list()
+ data["settings"] = list()
+ if(!locked || issilicon(user) || isAdminGhostAI(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"]["patrol_station"] = auto_patrol
+ return data
-/mob/living/simple_animal/bot/proc/update_controls()
- for(var/mob/M in users)
- show_controls(M)
-
-/mob/living/simple_animal/bot/proc/get_controls(mob/M)
- return "PROTOBOT - NOT FOR USE"
-
-/mob/living/simple_animal/bot/Topic(href, href_list)
- //No ..() to prevent strip panel showing up - Todo: make that saner
- if(href_list["close"])// HUE HUE
- if(usr in users)
- users.Remove(usr)
- return TRUE
-
- if(topic_denied(usr))
- to_chat(usr, span_warning("[src]'s interface is not responding!"))
- return TRUE
- add_fingerprint(usr)
-
- if((href_list["power"]) && (bot_core.allowed(usr) || !locked))
- if(on)
- turn_off()
- else
- turn_on()
-
- switch(href_list["operation"])
+// 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, span_warning("Access denied."))
+ return
+ if(action == "lock")
+ locked = !locked
+ if(locked && !(issilicon(usr) || isAdminGhostAI(usr)))
+ return
+ switch(action)
+ if("power")
+ on = !on
+ update_appearance()
+ if("maintenance")
+ open = !open
if("patrol")
auto_patrol = !auto_patrol
bot_reset()
- if("remote")
+ if("airplane")
remote_disabled = !remote_disabled
if("hack")
+ if(!(issilicon(usr) || isAdminGhostAI(usr)))
+ return
if(!emagged)
emagged = TRUE
hacked = TRUE
@@ -887,11 +892,13 @@ Pass a positive integer as an argument to override a bot's default speed.
to_chat(usr, span_notice("[text_dehack]"))
log_game("Safety lock of [src] was re-enabled by [key_name(usr)] in [AREACOORD(src)]")
bot_reset()
- if("ejectpai")
- if(paicard && (!locked || issilicon(usr) || isAdminGhostAI(usr)))
+ if("eject_pai")
+ if(locked && !(issilicon(usr) || isAdminGhostAI(usr)))
+ return
+ if(paicard)
to_chat(usr, span_notice("You eject [paicard] from [bot_name]."))
ejectpai(usr)
- update_controls()
+ return
/mob/living/simple_animal/bot/update_icon_state()
icon_state = "[initial(icon_state)][on]"
@@ -918,33 +925,6 @@ Pass a positive integer as an argument to override a bot's default speed.
return TRUE
return FALSE
-/mob/living/simple_animal/bot/proc/hack(mob/user)
- var/hack
- if(issilicon(user) || isAdminGhostAI(user)) //Allows silicons or admins to toggle the emag status of a bot.
- hack += "[emagged ? "Software compromised! Unit may exhibit dangerous or erratic behavior." : "Unit operating normally. Release safety lock?"]
"
- hack += "Harm Prevention Safety System: [emagged ? "DANGER" : "Engaged"]
"
- else if(!locked) //Humans with access can use this option to hide a bot from the AI's remote control panel and PDA control.
- hack += "Remote network control radio: [remote_disabled ? "Disconnected" : "Connected"]
"
- return hack
-
-/mob/living/simple_animal/bot/proc/showpai(mob/user)
- var/eject = ""
- if((!locked || issilicon(usr) || isAdminGhostAI(usr)))
- if(paicard || allow_pai)
- eject += "Personality card status: "
- if(paicard)
- if(client)
- eject += "Active"
- else
- eject += "Inactive"
- else if(!allow_pai || key)
- eject += "Unavailable"
- else
- eject += "Not inserted"
- eject += "
"
- eject += "
"
- return eject
-
/mob/living/simple_animal/bot/proc/insertpai(mob/user, obj/item/paicard/card)
if(paicard)
to_chat(user, span_warning("A [paicard] is already inserted!"))
diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm
index 8604f921b7c..0ff3f293da2 100644
--- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm
@@ -392,37 +392,33 @@
/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)
- dat += text({"
- Status: [on ? "On" : "Off"]
- Behaviour controls are [locked ? "locked" : "unlocked"]
- Maintenance panel panel is [open ? "opened" : "closed"]"})
- if(!locked || issilicon(user)|| isAdminGhostAI(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
+// Variables sent to TGUI
+/mob/living/simple_animal/bot/cleanbot/ui_data(mob/user)
+ var/list/data = ..()
-/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()
+ if(!locked || issilicon(user)|| isAdminGhostAI(user))
+ 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
+
+// Actions received from TGUI
+/mob/living/simple_animal/bot/cleanbot/ui_act(action, params)
+ . = ..()
+ if(. || (locked && !usr.has_unlimited_silicon_privilege))
+ return
+ switch(action)
+ if("clean_blood")
+ blood = !blood
+ if("pest_control")
+ pests = !pests
+ if("clean_trash")
+ trash = !trash
+ if("clean_graffiti")
+ drawn = !drawn
+ get_targets()
+ return
/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/firebot.dm b/code/modules/mob/living/simple_animal/bot/firebot.dm
index 255a52a3438..d1975393f65 100644
--- a/code/modules/mob/living/simple_animal/bot/firebot.dm
+++ b/code/modules/mob/living/simple_animal/bot/firebot.dm
@@ -107,23 +107,6 @@
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"]
"
- if(!locked || issilicon(user) || isAdminGhostAI(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
-
/mob/living/simple_animal/bot/firebot/emag_act(mob/user)
..()
if(emagged)
@@ -144,20 +127,29 @@
internal_ext.max_water = INFINITY
internal_ext.refill()
-/mob/living/simple_animal/bot/firebot/Topic(href, href_list)
- if(..())
- return TRUE
+// Variables sent to TGUI
+/mob/living/simple_animal/bot/firebot/ui_data(mob/user)
+ var/list/data = ..()
+ if(!locked || issilicon(user) || isAdminGhostAI(user))
+ data["custom_controls"]["extinguish_fires"] = extinguish_fires
+ data["custom_controls"]["extinguish_people"] = extinguish_people
+ data["custom_controls"]["stationary_mode"] = stationary_mode
+ return data
- switch(href_list["operation"])
+// Actions received from TGUI
+/mob/living/simple_animal/bot/firebot/ui_act(action, params)
+ . = ..()
+ if(. || (locked && !usr.has_unlimited_silicon_privilege))
+ 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_appearance()
+ update_appearance()
+ return
/mob/living/simple_animal/bot/firebot/proc/is_burning(atom/target)
if(ismob(target))
diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm
index 052572218f4..382b2342b06 100644
--- a/code/modules/mob/living/simple_animal/bot/floorbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm
@@ -85,36 +85,6 @@
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"]
"
- if(!locked || issilicon(user) || isAdminGhostAI(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
- if(targetdirection)
- bmode = dir2text(targetdirection)
- else
- bmode = "disabled"
- dat += "Line Mode : [bmode]
"
-
- return dat
-
/mob/living/simple_animal/bot/floorbot/attackby(obj/item/W , mob/user, params)
if(istype(W, /obj/item/stack/tile/iron))
to_chat(user, span_notice("The floorbot can produce normal tiles itself."))
@@ -161,26 +131,43 @@
if(change_icon)
update_icon()
-/mob/living/simple_animal/bot/floorbot/Topic(href, href_list)
- if(..())
- return TRUE
+// Variables sent to TGUI
+/mob/living/simple_animal/bot/floorbot/ui_data(mob/user)
+ var/list/data = ..()
+ if(!locked || issilicon(user) || isAdminGhostAI(user))
+ 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"]["tile_stack"] = 0
+ data["custom_controls"]["line_mode"] = FALSE
+ if(tilestack)
+ data["custom_controls"]["tile_stack"] = tilestack.amount
+ if(targetdirection)
+ data["custom_controls"]["line_mode"] = dir2text(targetdirection)
+ return data
- switch(href_list["operation"])
- if("replace")
+// Actions received from TGUI
+/mob/living/simple_animal/bot/floorbot/ui_act(action, params)
+ . = ..()
+ if(. || (locked && !usr.has_unlimited_silicon_privilege))
+ return
+ 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")
@@ -193,7 +180,7 @@
targetdirection = 8
if("disable")
targetdirection = null
- update_controls()
+ return
/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 fada1eb38a1..731ae36c6ee 100644
--- a/code/modules/mob/living/simple_animal/bot/honkbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm
@@ -84,24 +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 += text({"
-Honkomatic Bike Horn Unit v1.0.7 controls
-Status: []
-Behaviour controls are [locked ? "locked" : "unlocked"]
-Maintenance panel panel is [open ? "opened" : "closed"]"},
-
-"[on ? "On" : "Off"]" )
-
- if(!locked || issilicon(user) || isAdminGhostAI(user))
- dat += text({"
Auto Patrol: []"},
-
-"[auto_patrol ? "On" : "Off"]" )
- return dat
-
/mob/living/simple_animal/bot/honkbot/proc/judgement_criteria()
var/final = NONE
if(check_records)
diff --git a/code/modules/mob/living/simple_animal/bot/hygienebot.dm b/code/modules/mob/living/simple_animal/bot/hygienebot.dm
index 37e93a538e2..a32fc01ceaa 100644
--- a/code/modules/mob/living/simple_animal/bot/hygienebot.dm
+++ b/code/modules/mob/living/simple_animal/bot/hygienebot.dm
@@ -205,23 +205,6 @@
washing = FALSE
update_appearance()
-
-
-/mob/living/simple_animal/bot/hygienebot/get_controls(mob/user)
- var/list/dat = list()
- dat += hack(user)
- dat += showpai(user)
- dat += {"
- Hygienebot X2 controls
- Status: ["[on ? "On" : "Off"]"]
- Behaviour controls are [locked ? "locked" : "unlocked"]
- Maintenance panel is [open ? "opened" : "closed"]"}
-
- if(!locked || issilicon(user) || isAdminGhostAI(user))
- dat += {"
Auto Patrol: ["[auto_patrol ? "On" : "Off"]"]"}
-
- return dat.Join("")
-
/mob/living/simple_animal/bot/hygienebot/proc/check_purity(mob/living/L)
if((emagged) && L.stat != DEAD)
return FALSE
diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm
index 6bf288a6a8a..8395ec2fe5f 100644
--- a/code/modules/mob/living/simple_animal/bot/medbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/medbot.dm
@@ -152,67 +152,50 @@
/mob/living/simple_animal/bot/medbot/attack_paw(mob/user, list/modifiers)
return attack_hand(user, modifiers)
-/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"]