/mob/living/bot/cleanbot name = "Cleanbot" desc = "A little cleaning robot, he looks so excited!" icon_state = "cleanbot0" req_one_access = list(access_robotics, access_janitor) botcard_access = list(access_janitor, access_maint_tunnels) locked = 0 // Start unlocked so roboticist can set them to patrol. wait_if_pulled = 1 min_target_dist = 0 var/cleaning = 0 var/screwloose = 0 var/oddbutton = 0 var/blood = 1 var/list/target_types = list() /mob/living/bot/cleanbot/New() ..() get_targets() /mob/living/bot/cleanbot/handleIdle() if(!screwloose && !oddbutton && prob(5)) custom_emote(2, "makes an excited beeping booping sound!") if(screwloose && prob(5)) // Make a mess if(istype(loc, /turf/simulated)) var/turf/simulated/T = loc T.wet_floor() if(oddbutton && prob(5)) // Make a big mess visible_message("Something flies out of [src]. He seems to be acting oddly.") var/obj/effect/decal/cleanable/blood/gibs/gib = new /obj/effect/decal/cleanable/blood/gibs(loc) // TODO - I have a feeling weakrefs will not work in ignore_list, verify this ~Leshana var/weakref/g = weakref(gib) ignore_list += g spawn(600) ignore_list -= g /mob/living/bot/cleanbot/lookForTargets() for(var/obj/effect/decal/cleanable/D in view(world.view, src)) // There was some odd code to make it start with nearest decals, it's unnecessary, this works if(confirmTarget(D)) target = D return /mob/living/bot/cleanbot/confirmTarget(var/obj/effect/decal/cleanable/D) if(!..()) return 0 for(var/T in target_types) if(istype(D, T)) return 1 return 0 /mob/living/bot/cleanbot/handleAdjacentTarget() if(get_turf(target) == src.loc) UnarmedAttack(target) /mob/living/bot/cleanbot/UnarmedAttack(var/obj/effect/decal/cleanable/D, var/proximity) if(!..()) return if(!istype(D)) return if(D.loc != loc) return busy = 1 custom_emote(2, "begins to clean up \the [D]") update_icons() var/cleantime = istype(D, /obj/effect/decal/cleanable/dirt) ? 10 : 50 if(do_after(src, cleantime)) if(istype(loc, /turf/simulated)) var/turf/simulated/f = loc f.dirt = 0 if(!D) return qdel(D) if(D == target) target = null busy = 0 update_icons() /mob/living/bot/cleanbot/explode() on = 0 visible_message("[src] blows apart!") var/turf/Tsec = get_turf(src) new /obj/item/weapon/reagent_containers/glass/bucket(Tsec) new /obj/item/device/assembly/prox_sensor(Tsec) if(prob(50)) new /obj/item/robot_parts/l_arm(Tsec) var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread s.set_up(3, 1, src) s.start() qdel(src) return /mob/living/bot/cleanbot/update_icons() if(busy) icon_state = "cleanbot-c" else icon_state = "cleanbot[on]" /mob/living/bot/cleanbot/attack_hand(var/mob/user) var/dat dat += "Automatic Station Cleaner v1.0

" dat += "Status: [on ? "On" : "Off"]
" dat += "Behaviour controls are [locked ? "locked" : "unlocked"]
" dat += "Maintenance panel is [open ? "opened" : "closed"]" if(!locked || issilicon(user)) dat += "
Cleans Blood: [blood ? "Yes" : "No"]
" dat += "
Patrol station: [will_patrol ? "Yes" : "No"]
" if(open && !locked) dat += "Odd looking screw twiddled: [screwloose ? "Yes" : "No"]
" dat += "Weird button pressed: [oddbutton ? "Yes" : "No"]" user << browse("Cleaner v1.0 controls[dat]", "window=autocleaner") onclose(user, "autocleaner") return /mob/living/bot/cleanbot/Topic(href, href_list) if(..()) return usr.set_machine(src) add_fingerprint(usr) switch(href_list["operation"]) if("start") if(on) turn_off() else turn_on() if("blood") blood = !blood get_targets() if("patrol") will_patrol = !will_patrol patrol_path = null if("screw") screwloose = !screwloose usr << "You twiddle the screw." if("oddbutton") oddbutton = !oddbutton usr << "You press the weird button." attack_hand(usr) /mob/living/bot/cleanbot/emag_act(var/remaining_uses, var/mob/user) . = ..() if(!screwloose || !oddbutton) if(user) user << "The [src] buzzes and beeps." oddbutton = 1 screwloose = 1 return 1 /mob/living/bot/cleanbot/proc/get_targets() target_types = list() target_types += /obj/effect/decal/cleanable/blood/oil target_types += /obj/effect/decal/cleanable/vomit target_types += /obj/effect/decal/cleanable/crayon target_types += /obj/effect/decal/cleanable/liquid_fuel target_types += /obj/effect/decal/cleanable/mucus target_types += /obj/effect/decal/cleanable/dirt if(blood) target_types += /obj/effect/decal/cleanable/blood /* Assembly */ /obj/item/weapon/bucket_sensor desc = "It's a bucket. With a sensor attached." name = "proxy bucket" icon = 'icons/obj/aibots.dmi' icon_state = "bucket_proxy" force = 3.0 throwforce = 10.0 throw_speed = 2 throw_range = 5 w_class = ITEMSIZE_NORMAL var/created_name = "Cleanbot" /obj/item/weapon/bucket_sensor/attackby(var/obj/item/W, var/mob/user) ..() if(istype(W, /obj/item/robot_parts/l_arm) || istype(W, /obj/item/robot_parts/r_arm) || (istype(W, /obj/item/organ/external/arm) && ((W.name == "robotic left arm") || (W.name == "robotic right arm")))) user.drop_item() qdel(W) var/turf/T = get_turf(loc) var/mob/living/bot/cleanbot/A = new /mob/living/bot/cleanbot(T) A.name = created_name user << "You add the robot arm to the bucket and sensor assembly. Beep boop!" user.drop_from_inventory(src) qdel(src) else if(istype(W, /obj/item/weapon/pen)) var/t = sanitizeSafe(input(user, "Enter new robot name", name, created_name), MAX_NAME_LEN) if(!t) return if(!in_range(src, usr) && src.loc != usr) return created_name = t