Fixes runtime when cleaning turfs with soap

Partial fix of #11490
This commit is contained in:
mwerezak
2015-12-06 02:00:50 -05:00
parent de1f869af3
commit 87648e86ef
3 changed files with 28 additions and 16 deletions
+12 -2
View File
@@ -15,7 +15,15 @@
/*
* Soap
*/
/obj/item/weapon/soap/Crossed(AM as mob|obj) //EXACTLY the same as bananapeel for now, so it makes sense to put it in the same dm -- Urist
/obj/item/weapon/soap/New()
..()
create_reagents(5)
wet()
/obj/item/weapon/soap/proc/wet()
reagents.add_reagent("cleaner", 5)
/obj/item/weapon/soap/Crossed(AM as mob|obj)
if (istype(AM, /mob/living))
var/mob/living/M = AM
M.slip("the [src.name]",3)
@@ -32,7 +40,9 @@
else if(istype(target,/turf))
user << "<span class='notice'>You scrub \the [target.name] clean.</span>"
var/turf/T = target
T.clean(src)
T.clean(src, user)
else if(istype(target,/obj/structure/sink))
wet()
else
user << "<span class='notice'>You clean \the [target.name].</span>"
target.clean_blood()
+2 -14
View File
@@ -14,19 +14,7 @@
/obj/item/weapon/mop/New()
create_reagents(5)
//expects an atom containing the reagents used to clean the turf
/turf/proc/clean(atom/source)
if(source.reagents.has_reagent("water", 1))
clean_blood()
if(istype(src, /turf/simulated))
var/turf/simulated/T = src
T.dirt = 0
for(var/obj/effect/O in src)
if(istype(O,/obj/effect/rune) || istype(O,/obj/effect/decal/cleanable) || istype(O,/obj/effect/overlay))
qdel(O)
source.reagents.trans_to_turf(src, 1, 10) //10 is the multiplier for the reaction effect. probably needed to wet the floor properly.
create_reagents(30)
/obj/item/weapon/mop/afterattack(atom/A, mob/user, proximity)
if(!proximity) return
@@ -40,7 +28,7 @@
if(do_after(user, 40))
var/turf/T = get_turf(A)
if(T)
T.clean(src)
T.clean(src, user)
user << "<span class='notice'>You have finished mopping!</span>"