diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 0478b375a99..b731acc296f 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -208,7 +208,7 @@ on = TRUE REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, "depowered") set_light(initial(light_range)) - update_icon(UPDATE_ICON_STATE | UPDATE_OVERLAYS) + update_icon() update_controls() diag_hud_set_botstat() return TRUE @@ -218,7 +218,7 @@ ADD_TRAIT(src, TRAIT_IMMOBILIZED, "depowered") set_light(0) bot_reset() // Resets an AI's call, should it exist. - update_icon(UPDATE_ICON_STATE | UPDATE_OVERLAYS) + update_icon() update_controls() /mob/living/simple_animal/bot/Initialize(mapload) diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 10090833b57..0ecf75e9a7f 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -3,7 +3,7 @@ name = "\improper Cleanbot" desc = "A little cleaning robot, he looks so excited!" icon = 'icons/obj/aibots.dmi' - icon_state = "cleanbot0" + icon_state = "cleanbot" density = FALSE anchored = FALSE health = 25 @@ -29,6 +29,7 @@ var/failed_steps var/next_dest var/next_dest_loc + var/area/area_locked var/static/list/clean_dirt = list( /obj/effect/decal/cleanable/vomit, /obj/effect/decal/cleanable/blood/gibs/robot, @@ -41,7 +42,8 @@ /obj/effect/decal/cleanable/flour, /obj/effect/decal/cleanable/ash, /obj/effect/decal/cleanable/greenglow, - /obj/effect/decal/cleanable/dirt + /obj/effect/decal/cleanable/dirt, + /obj/effect/decal/cleanable/glass ) var/static/list/clean_blood = list( /obj/effect/decal/cleanable/blood, @@ -50,7 +52,7 @@ /mob/living/simple_animal/bot/cleanbot/Initialize(mapload) . = ..() - icon_state = "cleanbot[on]" + update_icon(UPDATE_OVERLAYS) clean_dirt = typecacheof(clean_dirt) clean_blood = typecacheof(clean_blood) @@ -59,19 +61,26 @@ access_card.access += J.get_access() prev_access = access_card.access -/mob/living/simple_animal/bot/cleanbot/turn_on() - ..() - icon_state = "cleanbot[on]" +/mob/living/simple_animal/bot/cleanbot/update_icon_state() + return -/mob/living/simple_animal/bot/cleanbot/turn_off() - ..() - icon_state = "cleanbot[on]" +/mob/living/simple_animal/bot/cleanbot/update_overlays() + . = ..() + if(!on) + . += "clean_off" + return + if(mode == BOT_CLEANING) + . += "clean_brush" + . += "clean[area_locked ? "_restrict" : ""]_work" + return + . += "clean_[area_locked ? "restrict" : "on"]" /mob/living/simple_animal/bot/cleanbot/bot_reset() ..() ignore_list.Cut() //Allows the bot to clean targets it previously ignored due to being unreachable. target = null oldloc = null + area_locked = null /mob/living/simple_animal/bot/cleanbot/set_custom_texts() text_hack = "You corrupt [name]'s cleaning software." @@ -100,8 +109,14 @@ to_chat(user, "[src] buzzes and beeps.") /mob/living/simple_animal/bot/cleanbot/process_scan(obj/effect/decal/cleanable/D) - if(is_type_in_typecache(D, clean_dirt) || blood && is_type_in_typecache(D, clean_blood)) + if(!(is_type_in_typecache(D, clean_dirt) || blood && is_type_in_typecache(D, clean_blood))) + return FALSE + if(!area_locked) return D + var/area/target_area = get_area(D) + if(target_area == area_locked) + return D + return FALSE /mob/living/simple_animal/bot/cleanbot/handle_automated_action() if(!..()) @@ -157,11 +172,18 @@ oldloc = loc +/mob/living/simple_animal/bot/cleanbot/proc/assign_area() + if(area_locked) + area_locked = null + else + area_locked = get_area(loc) + update_icon(UPDATE_OVERLAYS) + /mob/living/simple_animal/bot/cleanbot/proc/start_clean(obj/effect/decal/cleanable/target) anchored = TRUE - icon_state = "cleanbot-c" visible_message("[src] begins to clean up [target]") mode = BOT_CLEANING + update_icon(UPDATE_OVERLAYS) addtimer(CALLBACK(src, PROC_REF(do_clean), target), 5 SECONDS) /mob/living/simple_animal/bot/cleanbot/proc/do_clean(obj/effect/decal/cleanable/target) @@ -170,7 +192,7 @@ QDEL_NULL(target) anchored = FALSE mode = BOT_IDLE - icon_state = "cleanbot[on]" + update_icon(UPDATE_OVERLAYS) /mob/living/simple_animal/bot/cleanbot/explode() on = FALSE @@ -200,6 +222,7 @@ /mob/living/simple_animal/bot/cleanbot/ui_data(mob/user) var/list/data = ..() data["cleanblood"] = blood + data["area"] = get_area_name(area_locked) return data /mob/living/simple_animal/bot/cleanbot/ui_act(action, params) @@ -225,6 +248,8 @@ remote_disabled = !remote_disabled if("blood") blood =!blood + if("area") + assign_area() if("ejectpai") ejectpai() diff --git a/icons/obj/aibots.dmi b/icons/obj/aibots.dmi index ec433a4a2ca..e89bd271970 100644 Binary files a/icons/obj/aibots.dmi and b/icons/obj/aibots.dmi differ diff --git a/tgui/packages/tgui/interfaces/BotClean.js b/tgui/packages/tgui/interfaces/BotClean.js index f509c9dd207..0a3ca915ee2 100644 --- a/tgui/packages/tgui/interfaces/BotClean.js +++ b/tgui/packages/tgui/interfaces/BotClean.js @@ -1,5 +1,5 @@ import { useBackend } from '../backend'; -import { Button, Section } from '../components'; +import { Button, Section, Box, LabeledList } from '../components'; import { Window } from '../layouts'; import { BotStatus } from './common/BotStatus'; @@ -16,9 +16,10 @@ export const BotClean = (props, context) => { remote_disabled, painame, cleanblood, + area, } = data; return ( - +
@@ -30,6 +31,18 @@ export const BotClean = (props, context) => { onClick={() => act('blood')} />
+
+
{painame && (