From 7198f98058384c00a7d84c61e62f839851fdc730 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Thu, 16 Jul 2015 01:44:30 -0400 Subject: [PATCH] Improves support for rags as reagent containers Rags now hold just under half a glass worth of reagents. Fixes rags wiping down a mob while smothering them. Rags can now be wrung out over a container or the floor, emptying it's contents. When wiping down stuff, a small amount of the rag's contents are splashed onto the atom. --- code/game/objects/structures/watercloset.dm | 4 +- .../detectivework/footprints_and_rag.dm | 93 +++++++++++++++---- 2 files changed, 79 insertions(+), 18 deletions(-) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 7ffe7280308..b9dcb3047dc 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -395,7 +395,7 @@ if (istype(RG) && RG.is_open_container()) RG.reagents.add_reagent("water", min(RG.volume - RG.reagents.total_volume, RG.amount_per_transfer_from_this)) user.visible_message("[user] fills \the [RG] using \the [src].","You fill \the [RG] using \the [src].") - return + return 1 else if (istype(O, /obj/item/weapon/melee/baton)) var/obj/item/weapon/melee/baton/B = O @@ -413,7 +413,7 @@ user.visible_message( \ "[user] was stunned by \his wet [O]!", \ "[user] was stunned by \his wet [O]!") - return + return 1 // Short of a rewrite, this is necessary to stop monkeycubes being washed. else if(istype(O, /obj/item/weapon/reagent_containers/food/snacks/monkeycube)) return diff --git a/code/modules/detectivework/footprints_and_rag.dm b/code/modules/detectivework/footprints_and_rag.dm index aedf6e4c9f6..e2fc94cb6b2 100644 --- a/code/modules/detectivework/footprints_and_rag.dm +++ b/code/modules/detectivework/footprints_and_rag.dm @@ -14,33 +14,94 @@ var/track_blood = 0 /obj/item/weapon/reagent_containers/glass/rag - name = "damp rag" + name = "rag" desc = "For cleaning up messes, you suppose." w_class = 1 icon = 'icons/obj/toy.dmi' icon_state = "rag" amount_per_transfer_from_this = 5 possible_transfer_amounts = list(5) - volume = 5 + volume = 10 can_be_placed_into = null flags = OPENCONTAINER | NOBLUDGEON +/obj/item/weapon/reagent_containers/glass/rag/New() + ..() + update_name() + /obj/item/weapon/reagent_containers/glass/rag/attack_self(mob/user as mob) - return + remove_contents(user) + +/obj/item/weapon/reagent_containers/glass/rag/attackby() + . = ..() + update_name() + +/obj/item/weapon/reagent_containers/glass/rag/proc/update_name() + if(reagents.total_volume) + name = "damp [initial(name)]" + else + name = "dry [initial(name)]" + +/obj/item/weapon/reagent_containers/glass/rag/proc/remove_contents(mob/user, atom/trans_dest = null) + if(!trans_dest && !user.loc) + return + + if(reagents.total_volume) + var/target_text = trans_dest? "\the [trans_dest]" : "\the [user.loc]" + user.visible_message("\The [user] begins to wring out [src] over [target_text].", "\The [user] wrings out [src] over [target_text].", "You finish to wringing out [src].") + update_name() + +/obj/item/weapon/reagent_containers/glass/rag/proc/wipe_down(atom/A, mob/user) + if(!reagents.total_volume) + user << "The [initial(name)] is dry!" + else + user.visible_message("\The [user] starts to wipe down [A] with [src]!") + reagents.splash(A, 1) //get a small amount of liquid on the thing we're wiping. + update_name() + if(do_after(user,30)) + user.visible_message("\The [user] finishes wiping off the [A]!") + A.clean_blood() /obj/item/weapon/reagent_containers/glass/rag/attack(atom/target as obj|turf|area, mob/user as mob , flag) - if(ismob(target) && target.reagents && reagents.total_volume) - user.visible_message("\red \The [target] has been smothered with \the [src] by \the [user]!", "\red You smother \the [target] with \the [src]!", "You hear some struggling and muffled cries of surprise") - reagents.trans_to_mob(target, reagents.total_volume, CHEM_INGEST) + if(ismob(target) && reagents.total_volume) + if(user.zone_sel.selecting == "mouth") + user.visible_message( + "\The [user] smothers [target] with [src]!", + "You smother [target] with [src]!", + "You hear some struggling and muffled cries of surprise" + ) + reagents.trans_to_mob(target, amount_per_transfer_from_this, CHEM_INGEST) //it's inhaled, really... maybe this should be CHEM_BLOOD? + update_name() + else + wipe_down(target, user) return - else - ..() - + return ..() + /obj/item/weapon/reagent_containers/glass/rag/afterattack(atom/A as obj|turf|area, mob/user as mob, proximity) - if(!proximity) return - if(istype(A) && src in user) - user.visible_message("[user] starts to wipe down [A] with [src]!") - if(do_after(user,30)) - user.visible_message("[user] finishes wiping off the [A]!") - A.clean_blood() - return + if(!proximity) + return + + if(istype(A, /obj/structure/reagent_dispensers)) + if(!reagents.get_free_space()) + user << "\The [src] is already soaked." + return + + if(A.reagents && A.reagents.trans_to_obj(src, reagents.maximum_volume)) + user.visible_message("\The [user] soaks [src] using [A].", "You soak [src] using [A].") + update_name() + return + + if(istype(A) && (src in user)) + if(A.is_open_container()) + remove_contents(user, A) + else if(!ismob(A)) //mobs are handled in attack() - this prevents us from wiping down people while smothering them. + wipe_down(A, user) + return +