Merge pull request #3502 from VampyrBytes/cleanSlips

Cleans up slipping code
This commit is contained in:
Fox McCloud
2016-02-07 15:11:23 -05:00
6 changed files with 38 additions and 94 deletions
+2 -10
View File
@@ -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
+2 -13
View File
@@ -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()
+4 -24
View File
@@ -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
@@ -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)
+6 -35
View File
@@ -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)
+21 -1
View File
@@ -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)
W.layer = initial(W.layer)
/mob/living/carbon/proc/slip(var/description, 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 << "<span class='notice'>You slipped on the [description]!</span>"
playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3)
if (stun)
Stun(stun)
Weaken(weaken)
return 1