From 9af501b0622fd36f6330f42ddcde3baef2fa609c Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 22 Mar 2020 22:40:37 +0100 Subject: [PATCH] Makes floor cluwnes slippery tiles not stay there till the end of times --- code/game/turfs/simulated.dm | 19 +++++++++++++------ code/game/turfs/simulated/floor/mineral.dm | 2 +- code/game/turfs/simulated/floor/misc_floor.dm | 2 +- code/game/turfs/simulated/floor/plating.dm | 2 +- .../simple_animal/hostile/floorcluwne.dm | 4 ++-- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index 6c10921e6bd..669f9a255a8 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -35,7 +35,12 @@ assume_air(lowertemp) qdel(hotspot) -/turf/simulated/proc/MakeSlippery(wet_setting = TURF_WET_WATER, infinite = FALSE) // 1 = Water, 2 = Lube, 3 = Ice, 4 = Permafrost +/* + * Makes a turf slippery using the given parameters + * @param wet_setting The type of slipperyness used + * @param time Time the turf is slippery. If null it will pick a random time between 790 and 820 ticks. If INFINITY then it won't dry up ever +*/ +/turf/simulated/proc/MakeSlippery(wet_setting = TURF_WET_WATER, time = null) // 1 = Water, 2 = Lube, 3 = Ice, 4 = Permafrost if(wet >= wet_setting) return wet = wet_setting @@ -55,13 +60,15 @@ else wet_overlay = image('icons/effects/water.dmi', src, "wet_static") overlays += wet_overlay - if(!infinite) - spawn(rand(790, 820)) // Purely so for visual effect - if(!istype(src, /turf/simulated)) //Because turfs don't get deleted, they change, adapt, transform, evolve and deform. they are one and they are all. - return - MakeDry(wet_setting) + if(time == INFINITY) + return + if(time == null) + time = rand(790, 820) + addtimer(CALLBACK(src, /turf/simulated./proc/MakeDry, wet_setting), time) /turf/simulated/proc/MakeDry(wet_setting = TURF_WET_WATER) + if(!istype(src, /turf/simulated)) //Because turfs don't get deleted, they change, adapt, transform, evolve and deform. they are one and they are all. + return if(wet > wet_setting) return wet = TURF_DRY diff --git a/code/game/turfs/simulated/floor/mineral.dm b/code/game/turfs/simulated/floor/mineral.dm index 5eb387abbae..ffb1cce0b5c 100644 --- a/code/game/turfs/simulated/floor/mineral.dm +++ b/code/game/turfs/simulated/floor/mineral.dm @@ -186,7 +186,7 @@ /turf/simulated/floor/mineral/bananium/lubed/Initialize(mapload) . = ..() - MakeSlippery(TURF_WET_LUBE, TRUE) + MakeSlippery(TURF_WET_LUBE, INFINITY) /turf/simulated/floor/mineral/bananium/lubed/pry_tile(obj/item/C, mob/user, silent = FALSE) //I want to get off Mr Honk's Wild Ride if(ishuman(user)) diff --git a/code/game/turfs/simulated/floor/misc_floor.dm b/code/game/turfs/simulated/floor/misc_floor.dm index 33ae636090d..0ca6494497c 100644 --- a/code/game/turfs/simulated/floor/misc_floor.dm +++ b/code/game/turfs/simulated/floor/misc_floor.dm @@ -118,7 +118,7 @@ /turf/simulated/floor/lubed/Initialize(mapload) . = ..() - MakeSlippery(TURF_WET_LUBE, TRUE) + MakeSlippery(TURF_WET_LUBE, INFINITY) /turf/simulated/floor/lubed/pry_tile(obj/item/C, mob/user, silent = FALSE) //I want to get off Mr Honk's Wild Ride if(ishuman(user)) diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm index 85b03d3378d..332786e291c 100644 --- a/code/game/turfs/simulated/floor/plating.dm +++ b/code/game/turfs/simulated/floor/plating.dm @@ -353,7 +353,7 @@ /turf/simulated/floor/plating/ice/Initialize(mapload) . = ..() - MakeSlippery(TURF_WET_PERMAFROST, TRUE) + MakeSlippery(TURF_WET_PERMAFROST, INFINITY) /turf/simulated/floor/plating/ice/try_replace_tile(obj/item/stack/tile/T, mob/user, params) return diff --git a/code/modules/mob/living/simple_animal/hostile/floorcluwne.dm b/code/modules/mob/living/simple_animal/hostile/floorcluwne.dm index c0dfa097f16..cf55824542a 100644 --- a/code/modules/mob/living/simple_animal/hostile/floorcluwne.dm +++ b/code/modules/mob/living/simple_animal/hostile/floorcluwne.dm @@ -285,7 +285,7 @@ if(prob(6)) for(var/turf/simulated/floor/O in range(src, 6)) - O.MakeSlippery(TURF_WET_WATER, 10) + O.MakeSlippery(TURF_WET_WATER, 10 SECONDS) playsound(src, 'sound/effects/clownstep1.ogg', 30, 1) if(prob(5)) @@ -323,7 +323,7 @@ if(!eating) addtimer(CALLBACK(src, /mob/living/simple_animal/hostile/floor_cluwne/.proc/Grab, H), 70) for(var/turf/simulated/floor/O in range(src, 6)) - O.MakeSlippery(TURF_WET_LUBE, 20) + O.MakeSlippery(TURF_WET_LUBE, 20 SECONDS) playsound(src, 'sound/effects/meteorimpact.ogg', 30, 1) eating = TRUE