diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 9548eea30ee..ee383613a68 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -985,16 +985,8 @@ steam.start() -- spawns the effect return if (istype(AM, /mob/living/carbon)) - var/mob/M = AM - if (istype(M, /mob/living/carbon/human) && (istype(M:shoes, /obj/item/clothing/shoes) && M:shoes.flags&NOSLIP) || M.buckled) - return - if (istype (M, /mob/living/carbon/human) && M:species.bodyflags & FEET_NOSLIP) - return - M.stop_pulling() - M << "\blue You slipped on the foam!" - playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) - M.Stun(5) - M.Weaken(2) + var/mob/living/carbon/M = AM + M.slip("foam", 5, 2) /datum/effect/system/foam_spread diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index a9e94d6077b..697e2c9e867 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -1214,19 +1214,8 @@ var/global/list/obj/item/device/pda/PDAs = list() /obj/item/device/pda/clown/Crossed(AM as mob|obj) //Clown PDA is slippery. if (istype(AM, /mob/living/carbon)) - var/mob/M = AM - if ((istype(M, /mob/living/carbon/human) && (istype(M:shoes, /obj/item/clothing/shoes) && M:shoes.flags&NOSLIP)) || M.m_intent == "walk") - return - - if ((istype(M, /mob/living/carbon/human) && (M.real_name != src.owner) && (istype(src.cartridge, /obj/item/weapon/cartridge/clown)))) - if (src.cartridge.charges < 5) - src.cartridge.charges++ - - M.stop_pulling() - M << "\blue You slipped on the PDA!" - playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) - M.Stun(8) - M.Weaken(5) + var/mob/living/carbon/M = AM + M.slip("pda", 8, 5, 0, 1) /obj/item/device/pda/proc/available_pdas() var/list/names = list() diff --git a/code/game/objects/items/weapons/clown_items.dm b/code/game/objects/items/weapons/clown_items.dm index d58fe73b587..a655efa125c 100644 --- a/code/game/objects/items/weapons/clown_items.dm +++ b/code/game/objects/items/weapons/clown_items.dm @@ -22,36 +22,16 @@ /obj/item/weapon/bananapeel/Crossed(AM as mob|obj) if (istype(AM, /mob/living/carbon)) - var/mob/M = AM - if (istype(M, /mob/living/carbon/human) && (isobj(M:shoes) && M:shoes.flags&NOSLIP) || M.buckled) - return - if(istype(M, /mob/living/carbon/human) && M:species.bodyflags & FEET_NOSLIP) - return - if(M.flying) - return - - M.stop_pulling() - M << "\blue You slipped on the [name]!" - playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) - M.Stun(4) - M.Weaken(2) + var/mob/living/carbon/M = AM + M.slip("banana peel", 4, 2) /* * 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 if (istype(AM, /mob/living/carbon)) - var/mob/M = AM - if (istype(M, /mob/living/carbon/human) && (isobj(M:shoes) && M:shoes.flags&NOSLIP) || M.buckled) - return - if(M.flying) - return - - M.stop_pulling() - M << "\blue You slipped on the [name]!" - playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) - M.Stun(4) - M.Weaken(2) + var/mob/living/carbon/M = AM + M.slip("soap", 4, 2) /obj/item/weapon/soap/afterattack(atom/target, mob/user as mob, proximity) if(!proximity) return diff --git a/code/game/objects/items/weapons/grenades/clowngrenade.dm b/code/game/objects/items/weapons/grenades/clowngrenade.dm index 3066c762cd3..8525a27378c 100644 --- a/code/game/objects/items/weapons/grenades/clowngrenade.dm +++ b/code/game/objects/items/weapons/grenades/clowngrenade.dm @@ -62,8 +62,8 @@ Crossed(AM as mob|obj) var/burned = rand(2,5) - if(istype(AM, /mob/living)) - var/mob/living/M = AM + if(istype(AM, /mob/living/carbon)) + var/mob/living/carbon/M = AM if(ishuman(M)) if(isobj(M:shoes)) if((M:shoes.flags&NOSLIP) || (M:species.bodyflags & FEET_NOSLIP)) @@ -73,16 +73,8 @@ M.take_overall_damage(0, max(0, (burned - 2))) if(!istype(M, /mob/living/carbon/slime) && !isrobot(M)) - M.stop_pulling() - step(M, M.dir) - spawn(1) step(M, M.dir) - spawn(2) step(M, M.dir) - spawn(3) step(M, M.dir) - spawn(4) step(M, M.dir) + M.slip("banana peel!", 0, 7, 4) M.take_organ_damage(2) // Was 5 -- TLE - M << "\blue You slipped on \the [name]!" - playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) - M.Weaken(7) M.take_overall_damage(0, burned) throw_impact(atom/hit_atom) diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index f3fd7b38dd1..15751f0a9d8 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -95,50 +95,21 @@ bloodDNA = null - var/noslip = 0 - for (var/obj/structure/stool/bed/chair/C in contents) - if (C.buckled_mob == M) - noslip = 1 - if (noslip) - return // no slipping while sitting in a chair, plz switch (src.wet) if(TURF_WET_WATER) - if ((M.m_intent == "run") && !(istype(M:shoes, /obj/item/clothing/shoes) && M.shoes.flags&NOSLIP)) - M.stop_pulling() - step(M, M.dir) - M << "\blue You slipped on the wet floor!" - playsound(src, 'sound/misc/slip.ogg', 50, 1, -3) - M.Stun(4) - M.Weaken(2) - else + if (!(M.slip("wet floor", 4, 2, 1))) M.inertia_dir = 0 return - - if(TURF_WET_LUBE) //lube //can cause infinite loops - needs work - if(!M.buckled) - M.stop_pulling() - step(M, M.dir) - spawn(1) step(M, M.dir) - spawn(2) step(M, M.dir) - spawn(3) step(M, M.dir) - spawn(4) step(M, M.dir) + if(TURF_WET_LUBE) //lube + if(M.slip("floor", 0, 7, 4, 0, 1)) M.take_organ_damage(2) // Was 5 -- TLE - M << "\blue You slipped on the floor!" - playsound(src, 'sound/misc/slip.ogg', 50, 1, -3) - M.Weaken(7) + if(TURF_WET_ICE) // Ice - if ((M.m_intent == "run") && !(istype(M:shoes, /obj/item/clothing/shoes) && M:shoes.flags&NOSLIP) && prob(30)) - M.stop_pulling() - step(M, M.dir) - M << "\blue You slipped on the icy floor!" - playsound(src, 'sound/misc/slip.ogg', 50, 1, -3) - M.Stun(4) - M.Weaken(2) - else + if (!(prob(30) && M.slip("icy floor", 4, 2, 1, 1))) M.inertia_dir = 0 - return + //returns 1 if made bloody, returns 0 otherwise /turf/simulated/add_blood(mob/living/carbon/human/M as mob) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 0701b394113..18b8fd5633e 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -759,4 +759,24 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, W.loc = loc W.dropped(src) if (W) - W.layer = initial(W.layer) \ No newline at end of file + W.layer = initial(W.layer) + + +/mob/living/carbon/proc/slip(var/slippery, var/stun, var/weaken, var/tilesSlipped, var/walkSafely, var/slipAny) + if (flying || buckled || (walkSafely && m_intent == "walk")) + return + if (!(slipAny)) + if (istype(src, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = src + if ((isobj(H.shoes) && H.shoes.flags & NOSLIP) || H.species.bodyflags & FEET_NOSLIP) + return + if (tilesSlipped) + for(var/t = 0, t<=tilesSlipped, t++) + spawn (t) step(src, src.dir) + stop_pulling() + src << "You slipped on the [slippery]!" + playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) + if (stun) + Stun(stun) + Weaken(weaken) + return 1 \ No newline at end of file