mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-16 02:24:11 +01:00
[MIRROR] Simplebot TGUI conversion [MDB IGNORE] (#9452)
* Simplebot TGUI conversion * Update medbot.dm Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
@@ -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?"]<BR>"
|
||||
hack += "Harm Prevention Safety System: <A href='?src=[REF(src)];operation=hack'>[emagged ? "<span class='bad'>DANGER</span>" : "Engaged"]</A><BR>"
|
||||
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: <A href='?src=[REF(src)];operation=remote'>[remote_disabled ? "Disconnected" : "Connected"]</A><BR>"
|
||||
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 += "<A href='?src=[REF(src)];operation=ejectpai'>Active</A>"
|
||||
else
|
||||
eject += "<A href='?src=[REF(src)];operation=ejectpai'>Inactive</A>"
|
||||
else if(!allow_pai || key)
|
||||
eject += "Unavailable"
|
||||
else
|
||||
eject += "Not inserted"
|
||||
eject += "<BR>"
|
||||
eject += "<BR>"
|
||||
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!"))
|
||||
|
||||
@@ -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: <A href='?src=[REF(src)];power=1'>[on ? "On" : "Off"]</A><BR>
|
||||
Behaviour controls are [locked ? "locked" : "unlocked"]<BR>
|
||||
Maintenance panel panel is [open ? "opened" : "closed"]"})
|
||||
if(!locked || issilicon(user)|| isAdminGhostAI(user))
|
||||
dat += "<BR>Clean Blood: <A href='?src=[REF(src)];operation=blood'>[blood ? "Yes" : "No"]</A>"
|
||||
dat += "<BR>Clean Trash: <A href='?src=[REF(src)];operation=trash'>[trash ? "Yes" : "No"]</A>"
|
||||
dat += "<BR>Clean Graffiti: <A href='?src=[REF(src)];operation=drawn'>[drawn ? "Yes" : "No"]</A>"
|
||||
dat += "<BR>Exterminate Pests: <A href='?src=[REF(src)];operation=pests'>[pests ? "Yes" : "No"]</A>"
|
||||
dat += "<BR><BR>Patrol Station: <A href='?src=[REF(src)];operation=patrol'>[auto_patrol ? "Yes" : "No"]</A>"
|
||||
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)
|
||||
|
||||
@@ -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 += "<TT><B>Mobile Fire Extinguisher v1.0</B></TT><BR><BR>"
|
||||
dat += "Status: <A href='?src=[REF(src)];power=1'>[on ? "On" : "Off"]</A><BR>"
|
||||
dat += "Maintenance panel panel is [open ? "opened" : "closed"]<BR>"
|
||||
|
||||
dat += "Behaviour controls are [locked ? "locked" : "unlocked"]<BR>"
|
||||
if(!locked || issilicon(user) || isAdminGhostAI(user))
|
||||
dat += "Extinguish Fires: <A href='?src=[REF(src)];operation=extinguish_fires'>[extinguish_fires ? "Yes" : "No"]</A><BR>"
|
||||
dat += "Extinguish People: <A href='?src=[REF(src)];operation=extinguish_people'>[extinguish_people ? "Yes" : "No"]</A><BR>"
|
||||
dat += "Patrol Station: <A href='?src=[REF(src)];operation=patrol'>[auto_patrol ? "Yes" : "No"]</A><BR>"
|
||||
dat += "Stationary Mode: <a href='?src=[REF(src)];operation=stationary_mode'>[stationary_mode ? "Yes" : "No"]</a><br>"
|
||||
|
||||
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))
|
||||
|
||||
@@ -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 += "<TT><B>Floor Repairer Controls v1.1</B></TT><BR><BR>"
|
||||
dat += "Status: <A href='?src=[REF(src)];power=1'>[on ? "On" : "Off"]</A><BR>"
|
||||
dat += "Maintenance panel panel is [open ? "opened" : "closed"]<BR>"
|
||||
dat += "Special tiles: "
|
||||
if(tilestack)
|
||||
dat += "<A href='?src=[REF(src)];operation=eject'>Loaded \[[tilestack.amount]/[maxtiles]\]</a><BR>"
|
||||
else
|
||||
dat += "None Loaded<BR>"
|
||||
|
||||
dat += "Behaviour controls are [locked ? "locked" : "unlocked"]<BR>"
|
||||
if(!locked || issilicon(user) || isAdminGhostAI(user))
|
||||
dat += "Add tiles to new hull plating: <A href='?src=[REF(src)];operation=autotile'>[autotile ? "Yes" : "No"]</A><BR>"
|
||||
dat += "Place floor tiles: <A href='?src=[REF(src)];operation=place'>[placetiles ? "Yes" : "No"]</A><BR>"
|
||||
dat += "Replace existing floor tiles with custom tiles: <A href='?src=[REF(src)];operation=replace'>[replacetiles ? "Yes" : "No"]</A><BR>"
|
||||
dat += "Repair damaged tiles and platings: <A href='?src=[REF(src)];operation=fix'>[fixfloors ? "Yes" : "No"]</A><BR>"
|
||||
dat += "Traction Magnets: <A href='?src=[REF(src)];operation=magnet'>[HAS_TRAIT_FROM(src, TRAIT_IMMOBILIZED, BUSY_FLOORBOT_TRAIT) ? "Engaged" : "Disengaged"]</A><BR>"
|
||||
dat += "Patrol Station: <A href='?src=[REF(src)];operation=patrol'>[auto_patrol ? "Yes" : "No"]</A><BR>"
|
||||
var/bmode
|
||||
if(targetdirection)
|
||||
bmode = dir2text(targetdirection)
|
||||
else
|
||||
bmode = "disabled"
|
||||
dat += "Line Mode : <A href='?src=[REF(src)];operation=linemode'>[bmode]</A><BR>"
|
||||
|
||||
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(!..())
|
||||
|
||||
@@ -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({"
|
||||
<TT><B>Honkomatic Bike Horn Unit v1.0.7 controls</B></TT><BR><BR>
|
||||
Status: []<BR>
|
||||
Behaviour controls are [locked ? "locked" : "unlocked"]<BR>
|
||||
Maintenance panel panel is [open ? "opened" : "closed"]"},
|
||||
|
||||
"<A href='?src=[REF(src)];power=[TRUE]'>[on ? "On" : "Off"]</A>" )
|
||||
|
||||
if(!locked || issilicon(user) || isAdminGhostAI(user))
|
||||
dat += text({"<BR> Auto Patrol: []"},
|
||||
|
||||
"<A href='?src=[REF(src)];operation=patrol'>[auto_patrol ? "On" : "Off"]</A>" )
|
||||
return dat
|
||||
|
||||
/mob/living/simple_animal/bot/honkbot/proc/judgement_criteria()
|
||||
var/final = NONE
|
||||
if(check_records)
|
||||
|
||||
@@ -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 += {"
|
||||
<TT><B>Hygienebot X2 controls</B></TT><BR><BR>
|
||||
Status: ["<A href='?src=[REF(src)];power=[TRUE]'>[on ? "On" : "Off"]</A>"]<BR>
|
||||
Behaviour controls are [locked ? "locked" : "unlocked"]<BR>
|
||||
Maintenance panel is [open ? "opened" : "closed"]"}
|
||||
|
||||
if(!locked || issilicon(user) || isAdminGhostAI(user))
|
||||
dat += {"<BR> Auto Patrol: ["<A href='?src=[REF(src)];operation=patrol'>[auto_patrol ? "On" : "Off"]</A>"]"}
|
||||
|
||||
return dat.Join("")
|
||||
|
||||
/mob/living/simple_animal/bot/hygienebot/proc/check_purity(mob/living/L)
|
||||
if((emagged) && L.stat != DEAD)
|
||||
return FALSE
|
||||
|
||||
@@ -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 += "<TT><B>Medical Unit Controls v1.1</B></TT><BR><BR>"
|
||||
dat += "Status: <A href='?src=[REF(src)];power=1'>[on ? "On" : "Off"]</A><BR>"
|
||||
dat += "Maintenance panel panel is [open ? "opened" : "closed"]<BR>"
|
||||
dat += "<br>Behaviour controls are [locked ? "locked" : "unlocked"]<hr>"
|
||||
// Variables sent to TGUI
|
||||
/mob/living/simple_animal/bot/medbot/ui_data(mob/user)
|
||||
var/list/data = ..()
|
||||
if(!locked || issilicon(user) || isAdminGhostAI(user))
|
||||
dat += "<TT>Healing Threshold: "
|
||||
dat += "<a href='?src=[REF(src)];adj_threshold=-10'>--</a> "
|
||||
dat += "<a href='?src=[REF(src)];adj_threshold=-5'>-</a> "
|
||||
dat += "[heal_threshold] "
|
||||
dat += "<a href='?src=[REF(src)];adj_threshold=5'>+</a> "
|
||||
dat += "<a href='?src=[REF(src)];adj_threshold=10'>++</a>"
|
||||
dat += "</TT><br>"
|
||||
dat += "The speaker switch is [shut_up ? "off" : "on"]. <a href='?src=[REF(src)];togglevoice=[1]'>Toggle</a><br>"
|
||||
dat += "Critical Patient Alerts: <a href='?src=[REF(src)];critalerts=1'>[declare_crit ? "Yes" : "No"]</a><br>"
|
||||
dat += "Patrol Station: <a href='?src=[REF(src)];operation=patrol'>[auto_patrol ? "Yes" : "No"]</a><br>"
|
||||
dat += "Stationary Mode: <a href='?src=[REF(src)];stationary=1'>[stationary_mode ? "Yes" : "No"]</a><br>"
|
||||
//Skyrat Edit Removal - Medibot Nerf - dat += "<a href='?src=[REF(src)];hptech=1'>Search for Technological Advancements</a><br>"
|
||||
data["custom_controls"]["heal_threshold"] = heal_threshold
|
||||
data["custom_controls"]["speaker"] = !shut_up
|
||||
data["custom_controls"]["crit_alerts"] = declare_crit
|
||||
data["custom_controls"]["stationary_mode"] = stationary_mode
|
||||
data["custom_controls"]["sync_tech"] = TRUE
|
||||
return data
|
||||
|
||||
return dat
|
||||
|
||||
/mob/living/simple_animal/bot/medbot/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["adj_threshold"])
|
||||
var/adjust_num = text2num(href_list["adj_threshold"])
|
||||
heal_threshold += adjust_num
|
||||
if(heal_threshold < 5)
|
||||
heal_threshold = 5
|
||||
if(heal_threshold > 75)
|
||||
heal_threshold = 75
|
||||
|
||||
else if(href_list["togglevoice"])
|
||||
shut_up = !shut_up
|
||||
|
||||
else if(href_list["critalerts"])
|
||||
declare_crit = !declare_crit
|
||||
|
||||
else if(href_list["stationary"])
|
||||
stationary_mode = !stationary_mode
|
||||
path = list()
|
||||
update_appearance()
|
||||
/* Skyrat Edit Removal - Medibot Nerf
|
||||
else if(href_list["hptech"])
|
||||
var/oldheal_amount = heal_amount
|
||||
var/tech_boosters
|
||||
for(var/i in linked_techweb.researched_designs)
|
||||
var/datum/design/surgery/healing/D = SSresearch.techweb_design_by_id(i)
|
||||
if(!istype(D))
|
||||
continue
|
||||
tech_boosters++
|
||||
if(tech_boosters)
|
||||
heal_amount = (round(tech_boosters/2,0.1)*initial(heal_amount))+initial(heal_amount) //every 2 tend wounds tech gives you an extra 100% healing, adjusting for unique branches (combo is bonus)
|
||||
if(oldheal_amount < heal_amount)
|
||||
speak("New knowledge found! Surgical efficacy improved to [round(heal_amount/initial(heal_amount)*100)]%!")
|
||||
Skyrat Edit End */
|
||||
update_controls()
|
||||
// Actions received from TGUI
|
||||
/mob/living/simple_animal/bot/medbot/ui_act(action, params)
|
||||
. = ..()
|
||||
if(. || (locked && !usr.has_unlimited_silicon_privilege))
|
||||
return
|
||||
switch(action)
|
||||
if("heal_threshold")
|
||||
var/adjust_num = round(text2num(params["threshold"]))
|
||||
heal_threshold = adjust_num
|
||||
if(heal_threshold < 5)
|
||||
heal_threshold = 5
|
||||
if(heal_threshold > 75)
|
||||
heal_threshold = 75
|
||||
if("speaker")
|
||||
shut_up = !shut_up
|
||||
if("crit_alerts")
|
||||
declare_crit = !declare_crit
|
||||
if("stationary_mode")
|
||||
stationary_mode = !stationary_mode
|
||||
path = list()
|
||||
update_appearance()
|
||||
if("sync_tech")
|
||||
var/oldheal_amount = heal_amount
|
||||
var/tech_boosters
|
||||
for(var/index in linked_techweb.researched_designs)
|
||||
var/datum/design/surgery/healing/design = SSresearch.techweb_design_by_id(index)
|
||||
if(!istype(design))
|
||||
continue
|
||||
tech_boosters++
|
||||
if(tech_boosters)
|
||||
heal_amount = (round(tech_boosters/2,0.1)*initial(heal_amount))+initial(heal_amount) //every 2 tend wounds tech gives you an extra 100% healing, adjusting for unique branches (combo is bonus)
|
||||
if(oldheal_amount < heal_amount)
|
||||
speak("New knowledge found! Surgical efficacy improved to [round(heal_amount/initial(heal_amount)*100)]%!")
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/bot/medbot/attackby(obj/item/W as obj, mob/user as mob, params)
|
||||
|
||||
@@ -348,56 +348,6 @@
|
||||
if("ejectpai")
|
||||
ejectpairemote(user)
|
||||
|
||||
// TODO: remove this; PDAs currently depend on it
|
||||
/mob/living/simple_animal/bot/mulebot/get_controls(mob/user)
|
||||
var/ai = issilicon(user)
|
||||
var/dat
|
||||
dat += "<h3>Multiple Utility Load Effector Mk. V</h3>"
|
||||
dat += "<b>ID:</b> [id]<BR>"
|
||||
dat += "<b>Power:</b> [on ? "On" : "Off"]<BR>"
|
||||
dat += "<h3>Status</h3>"
|
||||
dat += "<div class='statusDisplay'>"
|
||||
switch(mode)
|
||||
if(BOT_IDLE)
|
||||
dat += "<span class='good'>Ready</span>"
|
||||
if(BOT_DELIVER)
|
||||
dat += "<span class='good'>[mode_name[BOT_DELIVER]]</span>"
|
||||
if(BOT_GO_HOME)
|
||||
dat += "<span class='good'>[mode_name[BOT_GO_HOME]]</span>"
|
||||
if(BOT_BLOCKED)
|
||||
dat += "<span class='average'>[mode_name[BOT_BLOCKED]]</span>"
|
||||
if(BOT_NAV,BOT_WAIT_FOR_NAV)
|
||||
dat += "<span class='average'>[mode_name[BOT_NAV]]</span>"
|
||||
if(BOT_NO_ROUTE)
|
||||
dat += "<span class='bad'>[mode_name[BOT_NO_ROUTE]]</span>"
|
||||
dat += "</div>"
|
||||
|
||||
var/load_message = get_load_name()
|
||||
dat += "<b>Current Load:</b> <i>[load_message ? load_message : "None"]</i><BR>"
|
||||
dat += "<b>Destination:</b> [!destination ? "<i>None</i>" : destination]<BR>"
|
||||
dat += "<b>Power level:</b> [cell ? cell.percent() : 0]%"
|
||||
|
||||
if(locked && !ai && !isAdminGhostAI(user))
|
||||
dat += " <br /><div class='notice'>Controls are locked</div><A href='byond://?src=[REF(src)];op=unlock'>Unlock Controls</A>"
|
||||
else
|
||||
dat += " <br /><div class='notice'>Controls are unlocked</div><A href='byond://?src=[REF(src)];op=lock'>Lock Controls</A><BR><BR>"
|
||||
|
||||
dat += "<A href='byond://?src=[REF(src)];op=power'>Toggle Power</A><BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=stop'>Stop</A><BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=go'>Proceed</A><BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=home'>Return to Home</A><BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=destination'>Set Destination</A><BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=setid'>Set Bot ID</A><BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=sethome'>Set Home</A><BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=autoret'>Toggle Auto Return Home</A> ([auto_return ? "On":"Off"])<BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=autopick'>Toggle Auto Pickup Crate</A> ([auto_pickup ? "On":"Off"])<BR>"
|
||||
dat += "<A href='byond://?src=[REF(src)];op=report'>Toggle Delivery Reporting</A> ([report_delivery ? "On" : "Off"])<BR>"
|
||||
if(load)
|
||||
dat += "<A href='byond://?src=[REF(src)];op=unload'>Unload Now</A><BR>"
|
||||
dat += "<div class='notice'>The maintenance hatch is closed.</div>"
|
||||
|
||||
return dat
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/proc/buzz(type)
|
||||
switch(type)
|
||||
if(SIGH)
|
||||
|
||||
@@ -136,54 +136,34 @@
|
||||
text_dehack = "You reboot [name] and restore the target identification."
|
||||
text_dehack_fail = "[name] refuses to accept your authority!"
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/get_controls(mob/user)
|
||||
var/dat
|
||||
dat += hack(user)
|
||||
dat += showpai(user)
|
||||
dat += text({"
|
||||
<TT><B>Securitron v1.6 controls</B></TT><BR><BR>
|
||||
Status: []<BR>
|
||||
Behaviour controls are [locked ? "locked" : "unlocked"]<BR>
|
||||
Maintenance panel panel is [open ? "opened" : "closed"]"},
|
||||
|
||||
"<A href='?src=[REF(src)];power=1'>[on ? "On" : "Off"]</A>")
|
||||
|
||||
// Variables sent to TGUI
|
||||
/mob/living/simple_animal/bot/secbot/ui_data(mob/user)
|
||||
var/list/data = ..()
|
||||
if(!locked || issilicon(user) || isAdminGhostAI(user))
|
||||
dat += text({"<BR>
|
||||
Arrest Unidentifiable Persons: []<BR>
|
||||
Arrest for Unauthorized Weapons: []<BR>
|
||||
Arrest for Warrant: []<BR>
|
||||
Operating Mode: []<BR>
|
||||
Report Arrests[]<BR>
|
||||
Auto Patrol: []"},
|
||||
data["custom_controls"]["check_id"] = security_mode_flags & SECBOT_CHECK_IDS
|
||||
data["custom_controls"]["check_weapons"] = security_mode_flags & SECBOT_CHECK_WEAPONS
|
||||
data["custom_controls"]["check_warrants"] = security_mode_flags & SECBOT_CHECK_RECORDS
|
||||
data["custom_controls"]["handcuff_targets"] = security_mode_flags & SECBOT_HANDCUFF_TARGET
|
||||
data["custom_controls"]["arrest_alert"] = security_mode_flags & SECBOT_DECLARE_ARRESTS
|
||||
return data
|
||||
|
||||
"<A href='?src=[REF(src)];operation=idcheck'>[security_mode_flags & SECBOT_CHECK_IDS ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=[REF(src)];operation=weaponscheck'>[security_mode_flags & SECBOT_CHECK_WEAPONS ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=[REF(src)];operation=ignorerec'>[security_mode_flags & SECBOT_CHECK_RECORDS ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=[REF(src)];operation=switchmode'>[security_mode_flags & SECBOT_HANDCUFF_TARGET ? "Arrest" : "Detain"]</A>",
|
||||
"<A href='?src=[REF(src)];operation=declarearrests'>[security_mode_flags & SECBOT_DECLARE_ARRESTS ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=[REF(src)];operation=patrol'>[auto_patrol ? "On" : "Off"]</A>")
|
||||
|
||||
return dat
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/Topic(href, href_list)
|
||||
// Actions received from TGUI
|
||||
/mob/living/simple_animal/bot/secbot/ui_act(action, params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return TRUE
|
||||
|
||||
switch(href_list["operation"])
|
||||
if("idcheck")
|
||||
if(. || (locked && !usr.has_unlimited_silicon_privilege))
|
||||
return
|
||||
switch(action)
|
||||
if("check_id")
|
||||
security_mode_flags ^= SECBOT_CHECK_IDS
|
||||
if("weaponscheck")
|
||||
if("check_weapons")
|
||||
security_mode_flags ^= SECBOT_CHECK_WEAPONS
|
||||
if("ignorerec")
|
||||
if("check_warrants")
|
||||
security_mode_flags ^= SECBOT_CHECK_RECORDS
|
||||
if("switchmode")
|
||||
if("handcuff_targets")
|
||||
security_mode_flags ^= SECBOT_HANDCUFF_TARGET
|
||||
if("declarearrests")
|
||||
if("arrest_alert")
|
||||
security_mode_flags ^= SECBOT_DECLARE_ARRESTS
|
||||
|
||||
update_controls()
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/proc/retaliate(mob/living/carbon/human/attacking_human)
|
||||
var/judgement_criteria = judgement_criteria()
|
||||
|
||||
@@ -28,20 +28,6 @@
|
||||
. = ..()
|
||||
update_appearance()
|
||||
|
||||
/mob/living/simple_animal/bot/vibebot/get_controls(mob/user)
|
||||
var/list/dat = list()
|
||||
dat += hack(user)
|
||||
dat += showpai(user)
|
||||
dat += "<TT><B>DiscoMatic Vibebot v1.0</B></TT><BR><BR>"
|
||||
dat += "Status: <A href='?src=[REF(src)];power=1'>[on ? "On" : "Off"]</A><BR>"
|
||||
dat += "Maintenance panel panel is [open ? "opened" : "closed"]<BR>"
|
||||
|
||||
dat += "Behaviour controls are [locked ? "locked" : "unlocked"]<BR>"
|
||||
if(!locked || issilicon(user) || isAdminGhostAI(user))
|
||||
dat += "Patrol Station: <A href='?src=[REF(src)];operation=patrol'>[auto_patrol ? "Yes" : "No"]</A><BR>"
|
||||
|
||||
return dat.Join("")
|
||||
|
||||
/mob/living/simple_animal/bot/vibebot/turn_off()
|
||||
. = ..()
|
||||
remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
import { multiline } from '../../common/string';
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, Icon, LabeledControls, NoticeBox, Section, Slider, Stack, Tooltip } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
type SimpleBotContext = {
|
||||
can_hack: number;
|
||||
locked: number;
|
||||
emagged: number;
|
||||
pai: Pai;
|
||||
settings: Settings;
|
||||
custom_controls: Controls;
|
||||
};
|
||||
|
||||
type Pai = {
|
||||
allow_pai: number;
|
||||
card_inserted: number;
|
||||
};
|
||||
|
||||
type Settings = {
|
||||
power: number;
|
||||
airplane_mode: number;
|
||||
maintenance_lock: number;
|
||||
patrol_station: number;
|
||||
};
|
||||
|
||||
type Controls = {
|
||||
[Control: string]: [Value: number];
|
||||
};
|
||||
|
||||
export const SimpleBot = (_, context) => {
|
||||
const { data } = useBackend<SimpleBotContext>(context);
|
||||
const { can_hack, locked } = data;
|
||||
const access = (!locked || can_hack);
|
||||
|
||||
return (
|
||||
<Window width={450} height={300}>
|
||||
<Window.Content>
|
||||
<Stack fill vertical>
|
||||
<Stack.Item>
|
||||
<Section title="Settings" buttons={<TabDisplay />}>
|
||||
{!access
|
||||
? (<NoticeBox>Locked!</NoticeBox>)
|
||||
: (<SettingsDisplay />)}
|
||||
</Section>
|
||||
</Stack.Item>
|
||||
{access && (
|
||||
<Stack.Item grow>
|
||||
<Section fill scrollable title="Controls">
|
||||
<ControlsDisplay />
|
||||
</Section>
|
||||
</Stack.Item>
|
||||
)}
|
||||
</Stack>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
|
||||
/** Creates a lock button at the top of the controls */
|
||||
const TabDisplay = (_, context) => {
|
||||
const { act, data } = useBackend<SimpleBotContext>(context);
|
||||
const { can_hack, locked, pai } = data;
|
||||
const { allow_pai } = pai;
|
||||
|
||||
return (
|
||||
<>
|
||||
{!!can_hack && <HackButton />}
|
||||
{!!allow_pai && <PaiButton />}
|
||||
<Button
|
||||
color="transparent"
|
||||
icon={locked ? 'lock' : 'lock-open'}
|
||||
onClick={() => act('lock')}
|
||||
selected={locked}
|
||||
tooltip={`${locked ? 'Unlock' : 'Lock'} the control panel.`}>
|
||||
Controls Lock
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
/** If user is a bad silicon, they can press this button to hack the bot */
|
||||
const HackButton = (_, context) => {
|
||||
const { act, data } = useBackend<SimpleBotContext>(context);
|
||||
const { can_hack, emagged } = data;
|
||||
|
||||
return (
|
||||
<Button
|
||||
color="danger"
|
||||
disabled={!can_hack}
|
||||
icon={emagged ? 'bug' : 'lock'}
|
||||
onClick={() => act('hack')}
|
||||
selected={!emagged}
|
||||
tooltip={
|
||||
!emagged
|
||||
? 'Unlocks the safety protocols.'
|
||||
: 'Resets the bot operating system.'
|
||||
}>
|
||||
{emagged ? 'Malfunctional' : 'Safety Lock'}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
/** Creates a button indicating PAI status and offers the eject action */
|
||||
const PaiButton = (_, context) => {
|
||||
const { act, data } = useBackend<SimpleBotContext>(context);
|
||||
const { card_inserted } = data.pai;
|
||||
|
||||
if (!card_inserted) {
|
||||
return (
|
||||
<Button
|
||||
color="transparent"
|
||||
icon="robot"
|
||||
tooltip={multiline`Insert an active PAI card to control this device.`}>
|
||||
No PAI Inserted
|
||||
</Button>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Button
|
||||
disabled={!card_inserted}
|
||||
icon="eject"
|
||||
onClick={() => act('eject_pai')}
|
||||
tooltip={multiline`Ejects the current PAI.`}>
|
||||
Eject PAI
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/** Displays the bot's standard settings: Power, patrol, etc. */
|
||||
const SettingsDisplay = (_, context) => {
|
||||
const { act, data } = useBackend<SimpleBotContext>(context);
|
||||
const { settings } = data;
|
||||
const { airplane_mode, patrol_station, power, maintenance_lock } = settings;
|
||||
|
||||
return (
|
||||
<LabeledControls>
|
||||
<LabeledControls.Item label="Power">
|
||||
<Tooltip content={`Powers ${power ? 'off' : 'on'} the bot.`}>
|
||||
<Icon
|
||||
size={2}
|
||||
name="power-off"
|
||||
color={power ? 'good' : 'gray'}
|
||||
onClick={() => act('power')}
|
||||
/>
|
||||
</Tooltip>
|
||||
</LabeledControls.Item>
|
||||
<LabeledControls.Item label="Airplane Mode">
|
||||
<Tooltip
|
||||
content={`${
|
||||
!airplane_mode ? 'Disables' : 'Enables'
|
||||
} remote access via console.`}>
|
||||
<Icon
|
||||
size={2}
|
||||
name="plane"
|
||||
color={airplane_mode ? 'yellow' : 'gray'}
|
||||
onClick={() => act('airplane')}
|
||||
/>
|
||||
</Tooltip>
|
||||
</LabeledControls.Item>
|
||||
<LabeledControls.Item label="Patrol Station">
|
||||
<Tooltip
|
||||
content={`${
|
||||
patrol_station ? 'Disables' : 'Enables'
|
||||
} automatic station patrol.`}>
|
||||
<Icon
|
||||
size={2}
|
||||
name="map-signs"
|
||||
color={patrol_station ? 'good' : 'gray'}
|
||||
onClick={() => act('patrol')}
|
||||
/>
|
||||
</Tooltip>
|
||||
</LabeledControls.Item>
|
||||
<LabeledControls.Item label="Maintenance Lock">
|
||||
<Tooltip
|
||||
content={
|
||||
maintenance_lock
|
||||
? 'Opens the maintenance hatch for repairs.'
|
||||
: 'Closes the maintenance hatch.'
|
||||
}>
|
||||
<Icon
|
||||
size={2}
|
||||
name="toolbox"
|
||||
color={maintenance_lock ? 'yellow' : 'gray'}
|
||||
onClick={() => act('maintenance')}
|
||||
/>
|
||||
</Tooltip>
|
||||
</LabeledControls.Item>
|
||||
</LabeledControls>
|
||||
);
|
||||
};
|
||||
|
||||
/** Iterates over custom controls.
|
||||
* Calls the helper to identify which button to use.
|
||||
*/
|
||||
const ControlsDisplay = (_, context) => {
|
||||
const { data } = useBackend<SimpleBotContext>(context);
|
||||
const { custom_controls } = data;
|
||||
|
||||
return (
|
||||
<LabeledControls wrap>
|
||||
{Object.entries(custom_controls).map((control) => {
|
||||
return (
|
||||
<LabeledControls.Item
|
||||
pb={2}
|
||||
key={control[0]}
|
||||
label={control[0]
|
||||
.replace('_', ' ')
|
||||
.replace(/(^\w{1})|(\s+\w{1})/g, (letter) =>
|
||||
letter.toUpperCase())}>
|
||||
<ControlHelper control={control} />
|
||||
</LabeledControls.Item>
|
||||
);
|
||||
})}
|
||||
</LabeledControls>
|
||||
);
|
||||
};
|
||||
|
||||
/** Helper function which identifies which button to create.
|
||||
* Might need some fine tuning if you are using more advanced controls.
|
||||
*/
|
||||
const ControlHelper = (props, context) => {
|
||||
const { act } = useBackend<SimpleBotContext>(context);
|
||||
const { control } = props;
|
||||
if (control[0] === 'sync_tech') {
|
||||
/** Control is for sync - this is medbot specific */
|
||||
return <MedbotSync />;
|
||||
} else if (control[0] === 'heal_threshold') {
|
||||
/** Control is a threshold - this is medbot specific */
|
||||
return <MedbotThreshold control={control} />;
|
||||
} else if (control[0] === 'tile_stack') {
|
||||
return <FloorbotTiles control={control} />;
|
||||
} else if (control[0] === 'line_mode') {
|
||||
return <FloorbotLine control={control} />;
|
||||
} else {
|
||||
/** Control is a boolean of some type */
|
||||
return (
|
||||
<Icon
|
||||
color={control[1] ? 'good' : 'gray'}
|
||||
name={control[1] ? 'toggle-on' : 'toggle-off'}
|
||||
size={2}
|
||||
onClick={() => act(control[0])}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/** Small button to sync medbots with research. */
|
||||
const MedbotSync = (_, context) => {
|
||||
const { act } = useBackend<SimpleBotContext>(context);
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
content={multiline`Synchronize surgical data with research network.
|
||||
Improves Tending Efficiency.`}>
|
||||
<Icon
|
||||
color="purple"
|
||||
name="cloud-download-alt"
|
||||
size={2}
|
||||
onClick={() => act('sync_tech')}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
/** Slider button for medbot healing thresholds */
|
||||
const MedbotThreshold = (props, context) => {
|
||||
const { act } = useBackend<SimpleBotContext>(context);
|
||||
const { control } = props;
|
||||
|
||||
return (
|
||||
<Tooltip content="Adjusts the sensitivity for damage treatment.">
|
||||
<Slider
|
||||
minValue={5}
|
||||
maxValue={75}
|
||||
ranges={{
|
||||
good: [-Infinity, 15],
|
||||
average: [15, 55],
|
||||
bad: [55, Infinity],
|
||||
}}
|
||||
step={5}
|
||||
unit="%"
|
||||
value={control[1]}
|
||||
onChange={(_, value) => act(control[0], { threshold: value })}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
/** Tile stacks for floorbots - shows number and eject button */
|
||||
const FloorbotTiles = (props, context) => {
|
||||
const { act } = useBackend<SimpleBotContext>(context);
|
||||
const { control } = props;
|
||||
|
||||
return (
|
||||
<Button
|
||||
disabled={!control[1]}
|
||||
icon={control[1] ? 'eject' : ''}
|
||||
onClick={() => act('eject_tiles')}
|
||||
tooltip="Number of floor tiles contained in the bot.">
|
||||
{control[1] ? `${control[1]}` : 'Empty'}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
/** Direction indicator for floorbot when line mode is chosen. */
|
||||
const FloorbotLine = (props, context) => {
|
||||
const { act } = useBackend<SimpleBotContext>(context);
|
||||
const { control } = props;
|
||||
|
||||
return (
|
||||
<Tooltip content="Enables straight line tiling mode.">
|
||||
<Icon
|
||||
color={control[1] ? 'good' : 'gray'}
|
||||
name={control[1] ? 'compass' : 'toggle-off'}
|
||||
onClick={() => act('line_mode')}
|
||||
size={!control[1] ? 2 : 1.5}>
|
||||
{' '}
|
||||
{control[1] ? control[1].toString().charAt(0).toUpperCase() : ''}
|
||||
</Icon>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user