From b54cab665a154a756213e054874b08e702300003 Mon Sep 17 00:00:00 2001 From: Perakp Date: Wed, 18 Dec 2013 15:03:03 +0200 Subject: [PATCH 1/3] No slipping when lying down MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - No slipping when lying down - Doesn’t change slipping mechanics otherwise. --- code/game/objects/effects/effect_system.dm | 11 +---- code/game/objects/items/devices/PDA/PDA.dm | 21 ++++------ .../game/objects/items/weapons/clown_items.dm | 21 ++-------- code/game/turfs/simulated.dm | 42 ++++--------------- code/modules/mob/living/carbon/carbon.dm | 29 +++++++++++++ .../mob/living/carbon/human/human_movement.dm | 8 +++- .../mob/living/carbon/metroid/metroid.dm | 6 +++ code/modules/mob/mob_movement.dm | 5 ++- 8 files changed, 66 insertions(+), 77 deletions(-) diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 128fe3850a1..5ccb8c7951d 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -845,15 +845,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)) - 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(5, 2, src, 1) /datum/effect/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 8ba2e3f6d59..b8dd3495559 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -960,20 +960,13 @@ 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:honk_charges < 5) - src.cartridge:honk_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 + if(M.slip(8, 5, src)) + if (ishuman(M) && (M.real_name != src.owner)) + if (istype(src.cartridge, /obj/item/weapon/cartridge/clown)) + var/obj/item/weapon/cartridge/clown/cart = src.cartridge + if(cart.honk_charges < 5) + cart.honk_charges++ //AI verb and proc for sending PDA messages. diff --git a/code/game/objects/items/weapons/clown_items.dm b/code/game/objects/items/weapons/clown_items.dm index 47d1846e6ad..3e3e2a8cfb1 100644 --- a/code/game/objects/items/weapons/clown_items.dm +++ b/code/game/objects/items/weapons/clown_items.dm @@ -10,30 +10,17 @@ */ /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)) - return + var/mob/living/carbon/M = AM + M.slip(4, 2, src, 1) - 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) /* * 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)) - return - - M.stop_pulling() - M << "\blue You slipped on the [name]!" - playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) - M.Stun(3) - M.Weaken(2) + var/mob/living/carbon/M = AM + M.slip(3, 2, src, 1) /obj/item/weapon/soap/afterattack(atom/target, mob/user as mob, proximity) if(!proximity) return diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index 7bd7b596a96..2c34cecf6c1 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -54,41 +54,13 @@ playsound(src, "clownstep", 20, 1) switch (src.wet) - if(1) - if(istype(M, /mob/living/carbon/human)) // Added check since monkeys don't have shoes - 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(8) - M.Weaken(5) - else - M.inertia_dir = 0 - return - else if(!istype(M, /mob/living/carbon/slime)) - if (M.m_intent == "run") - 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(8) - M.Weaken(5) - else - M.inertia_dir = 0 - return + if(1) //wet floor + if(!M.slip(8, 5, null, 2)) + M.inertia_dir = 0 + return + + if(2) //lube + M.slip(0, 10, null, 3) - if(2) //lube //can cause infinite loops - needs work - if(!istype(M, /mob/living/carbon/slime)) - 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.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(10) ..() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index d9e5925f20e..70edd1bdbc5 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -547,3 +547,32 @@ else if(prob(50)) return "trails_1" return "trails_2" + +/* + * 0)clown pda == no slip when walking, lube=0 + * 1)banana peels, soap and foam == slip when walking, lube=1 + * 2)Wet floor == no slip when walking, take a step, lube=2 + * 3)Lube == always slips, sliding effect, lube=3 + */ +/mob/living/carbon/slip(var/s_amount, var/w_amount, var/obj/O, var/lube) + if (m_intent=="walk" && (lube==0 || lube==2)) + return 0 + if(!lying) + stop_pulling() + if(lube==2 || lube==3) + step(src, src.dir) + if(lube==3) + for(var/i=1, i<5, i++) + spawn (i) + if(src) + step(src, src.dir) + take_organ_damage(2) + if(O) + src << "You slipped on the [O.name]!" + else + src << "You slipped!" + playsound(loc, 'sound/misc/slip.ogg', 50, 1, -3) + Stun(s_amount) + Weaken(w_amount) + return 1 + return 0 // no success. Used in clown pda and wet floors \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index ce3f80398ad..844ae402ae7 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -18,7 +18,7 @@ if(shoes) tally += shoes.slowdown - + if(back) tally += back.slowdown @@ -64,3 +64,9 @@ prob_slip = round(prob_slip) return(prob_slip) + + +/mob/living/carbon/human/slip(var/s_amount, var/w_amount, var/obj/O, var/lube) + if(isobj(src.shoes) && src.shoes.flags&NOSLIP && lube!=3) + return 0 + .=..() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index 7e967fbf1f9..58028dea45c 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -966,6 +966,12 @@ mob/living/carbon/slime/var/temperature_resistance = T0C+75 /mob/living/carbon/slime/getTrail() return null +/mob/living/carbon/slimes/slip(var/s_amount, var/w_amount, var/obj/O, var/lube) + if(lube>=2) + return 0 + .=..() + + //////////////////////////////Old shit from metroids/RoRos, and the old cores, would not take much work to re-add them//////////////////////// /* diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 9f107361df7..b947beb1267 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -442,4 +442,7 @@ M.start_pulling(t) else step(pulling, get_dir(pulling.loc, A)) - return \ No newline at end of file + return + +/mob/proc/slip(var/s_amount, var/w_amount, var/obj/O, var/lube) + return From b4c8f4ccf374246422453a55dfd6ce656725274f Mon Sep 17 00:00:00 2001 From: Perakp Date: Wed, 18 Dec 2013 15:10:28 +0200 Subject: [PATCH 2/3] I spend four hours merging my commits and I find this MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - if it was any other programming language it wouldn’t have even compiled. --- code/modules/mob/living/carbon/metroid/metroid.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index 58028dea45c..74d86eeb28e 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -966,7 +966,7 @@ mob/living/carbon/slime/var/temperature_resistance = T0C+75 /mob/living/carbon/slime/getTrail() return null -/mob/living/carbon/slimes/slip(var/s_amount, var/w_amount, var/obj/O, var/lube) +/mob/living/carbon/slime/slip(var/s_amount, var/w_amount, var/obj/O, var/lube) if(lube>=2) return 0 .=..() From 2f70aaadb3a47938cb36c895e45174637d68cb35 Mon Sep 17 00:00:00 2001 From: Perakp Date: Wed, 18 Dec 2013 22:31:07 +0200 Subject: [PATCH 3/3] Removes magic numbers and an useless check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - it shouldn’t runtime. --- code/game/objects/effects/effect_system.dm | 2 +- code/game/objects/items/devices/PDA/PDA.dm | 2 +- .../game/objects/items/weapons/clown_items.dm | 4 ++-- code/game/turfs/simulated.dm | 4 ++-- code/modules/mob/living/carbon/carbon.dm | 19 ++++++++----------- .../mob/living/carbon/human/human_movement.dm | 2 +- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 5ccb8c7951d..2fef944acf8 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -846,7 +846,7 @@ steam.start() -- spawns the effect if (istype(AM, /mob/living/carbon)) var/mob/living/carbon/M = AM - M.slip(5, 2, src, 1) + M.slip(5, 2, src) /datum/effect/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 b8dd3495559..792bfa55b74 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -961,7 +961,7 @@ 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/living/carbon/M = AM - if(M.slip(8, 5, src)) + if(M.slip(8, 5, src, NO_SLIP_WHEN_WALKING)) if (ishuman(M) && (M.real_name != src.owner)) if (istype(src.cartridge, /obj/item/weapon/cartridge/clown)) var/obj/item/weapon/cartridge/clown/cart = src.cartridge diff --git a/code/game/objects/items/weapons/clown_items.dm b/code/game/objects/items/weapons/clown_items.dm index 3e3e2a8cfb1..4ca4d3160c1 100644 --- a/code/game/objects/items/weapons/clown_items.dm +++ b/code/game/objects/items/weapons/clown_items.dm @@ -11,7 +11,7 @@ /obj/item/weapon/bananapeel/Crossed(AM as mob|obj) if (istype(AM, /mob/living/carbon)) var/mob/living/carbon/M = AM - M.slip(4, 2, src, 1) + M.slip(4, 2, src) /* @@ -20,7 +20,7 @@ /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/living/carbon/M = AM - M.slip(3, 2, src, 1) + M.slip(3, 2, src) /obj/item/weapon/soap/afterattack(atom/target, mob/user as mob, proximity) if(!proximity) return diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index 2c34cecf6c1..fab95d2400e 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -55,12 +55,12 @@ switch (src.wet) if(1) //wet floor - if(!M.slip(8, 5, null, 2)) + if(!M.slip(8, 5, null, (NO_SLIP_WHEN_WALKING|STEP))) M.inertia_dir = 0 return if(2) //lube - M.slip(0, 10, null, 3) + M.slip(0, 10, null, (STEP|SLIDE|GALOSHES_DONT_HELP)) ..() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 70edd1bdbc5..4f829ca40be 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -548,24 +548,21 @@ return "trails_1" return "trails_2" -/* - * 0)clown pda == no slip when walking, lube=0 - * 1)banana peels, soap and foam == slip when walking, lube=1 - * 2)Wet floor == no slip when walking, take a step, lube=2 - * 3)Lube == always slips, sliding effect, lube=3 - */ +var/const/NO_SLIP_WHEN_WALKING = 1 +var/const/STEP = 2 +var/const/SLIDE = 4 +var/const/GALOSHES_DONT_HELP = 8 /mob/living/carbon/slip(var/s_amount, var/w_amount, var/obj/O, var/lube) - if (m_intent=="walk" && (lube==0 || lube==2)) + if (m_intent=="walk" && (lube&NO_SLIP_WHEN_WALKING)) return 0 if(!lying) stop_pulling() - if(lube==2 || lube==3) + if(lube&STEP) step(src, src.dir) - if(lube==3) + if(lube&SLIDE) for(var/i=1, i<5, i++) spawn (i) - if(src) - step(src, src.dir) + step(src, src.dir) take_organ_damage(2) if(O) src << "You slipped on the [O.name]!" diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 844ae402ae7..edb6e5b37ab 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -67,6 +67,6 @@ /mob/living/carbon/human/slip(var/s_amount, var/w_amount, var/obj/O, var/lube) - if(isobj(src.shoes) && src.shoes.flags&NOSLIP && lube!=3) + if(isobj(shoes) && (shoes.flags&NOSLIP) && !(lube&GALOSHES_DONT_HELP)) return 0 .=..() \ No newline at end of file