//TG style Janicart /obj/structure/janitorialcart name = "janitorial cart" desc = "This is the alpha and omega of sanitation." icon = 'icons/obj/janitor.dmi' icon_state = "cart" anchored = 0 density = 1 face_while_pulling = FALSE container_type = OPENCONTAINER //copypaste sorry var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite var/obj/item/storage/bag/trash/mybag = null var/obj/item/mop/mymop = null var/obj/item/reagent_containers/spray/cleaner/myspray = null var/obj/item/lightreplacer/myreplacer = null var/signs = 0 var/const/max_signs = 4 /obj/structure/janitorialcart/Initialize(mapload) . = ..() create_reagents(100) GLOB.janitorial_equipment += src /obj/structure/janitorialcart/Destroy() GLOB.janitorial_equipment -= src QDEL_NULL(mybag) QDEL_NULL(mymop) QDEL_NULL(myspray) QDEL_NULL(myreplacer) return ..() /obj/structure/janitorialcart/proc/put_in_cart(obj/item/I, mob/user) user.drop_item() I.forceMove(src) updateUsrDialog() to_chat(user, "You put [I] into [src].") return /obj/structure/janitorialcart/on_reagent_change() update_icon() /obj/structure/janitorialcart/attackby(obj/item/I, mob/user, params) var/fail_msg = "There is already one of those in [src]." if(!I.is_robot_module()) if(istype(I, /obj/item/mop)) var/obj/item/mop/m=I if(m.reagents.total_volume < m.reagents.maximum_volume) m.wet_mop(src, user) return if(!mymop) m.janicart_insert(user, src) else to_chat(user, fail_msg) else if(istype(I, /obj/item/storage/bag/trash)) if(!mybag) var/obj/item/storage/bag/trash/t=I t.janicart_insert(user, src) else to_chat(user, fail_msg) else if(istype(I, /obj/item/reagent_containers/spray/cleaner)) if(!myspray) put_in_cart(I, user) myspray=I update_icon() else to_chat(user, fail_msg) else if(istype(I, /obj/item/lightreplacer)) if(!myreplacer) var/obj/item/lightreplacer/l=I l.janicart_insert(user,src) else to_chat(user, fail_msg) else if(istype(I, /obj/item/caution)) if(signs < max_signs) put_in_cart(I, user) signs++ update_icon() else to_chat(user, "[src] can't hold any more signs.") else if(istype(I, /obj/item/crowbar)) user.visible_message("[user] begins to empty the contents of [src].") if(do_after(user, 30 * I.toolspeed, target = src)) to_chat(usr, "You empty the contents of [src]'s bucket onto the floor.") reagents.reaction(src.loc) src.reagents.clear_reagents() else if(istype(I, /obj/item/wrench)) if(!anchored && !isinspace()) playsound(src.loc, I.usesound, 50, 1) user.visible_message( \ "[user] tightens \the [src]'s casters.", \ " You have tightened \the [src]'s casters.", \ "You hear ratchet.") anchored = 1 else if(anchored) playsound(src.loc, I.usesound, 50, 1) user.visible_message( \ "[user] loosens \the [src]'s casters.", \ " You have loosened \the [src]'s casters.", \ "You hear ratchet.") anchored = 0 else if(mybag) mybag.attackby(I, user, params) else to_chat(usr, "You cannot interface your modules [src]!") /obj/structure/janitorialcart/attack_hand(mob/user) user.set_machine(src) var/dat if(mybag) dat += "[mybag.name]
" if(mymop) dat += "[mymop.name]
" if(myspray) dat += "[myspray.name]
" if(myreplacer) dat += "[myreplacer.name]
" if(signs) dat += "[signs] sign\s
" var/datum/browser/popup = new(user, "janicart", name, 240, 160) popup.set_content(dat) popup.open() /obj/structure/janitorialcart/Topic(href, href_list) if(!in_range(src, usr)) return if(!isliving(usr)) return var/mob/living/user = usr if(href_list["garbage"]) if(mybag) user.put_in_hands(mybag) to_chat(user, "You take [mybag] from [src].") mybag = null if(href_list["mop"]) if(mymop) user.put_in_hands(mymop) to_chat(user, "You take [mymop] from [src].") mymop = null if(href_list["spray"]) if(myspray) user.put_in_hands(myspray) to_chat(user, "You take [myspray] from [src].") myspray = null if(href_list["replacer"]) if(myreplacer) user.put_in_hands(myreplacer) to_chat(user, "You take [myreplacer] from [src].") myreplacer = null if(href_list["sign"]) if(signs) var/obj/item/caution/Sign = locate() in src if(Sign) user.put_in_hands(Sign) to_chat(user, "You take \a [Sign] from [src].") signs-- else WARNING("Signs ([signs]) didn't match contents") signs = 0 update_icon() updateUsrDialog() /obj/structure/janitorialcart/update_icon() overlays = null if(mybag) overlays += "cart_garbage" if(mymop) overlays += "cart_mop" if(myspray) overlays += "cart_spray" if(myreplacer) overlays += "cart_replacer" if(signs) overlays += "cart_sign[signs]" if(reagents.total_volume > 0) var/image/reagentsImage = image(icon,src,"cart_reagents0") reagentsImage.alpha = 150 switch((reagents.total_volume/reagents.maximum_volume)*100) if(1 to 25) reagentsImage.icon_state = "cart_reagents1" if(26 to 50) reagentsImage.icon_state = "cart_reagents2" if(51 to 75) reagentsImage.icon_state = "cart_reagents3" if(76 to 100) reagentsImage.icon_state = "cart_reagents4" reagentsImage.icon += mix_color_from_reagents(reagents.reagent_list) add_overlay(reagentsImage)