From 2f70aaadb3a47938cb36c895e45174637d68cb35 Mon Sep 17 00:00:00 2001 From: Perakp Date: Wed, 18 Dec 2013 22:31:07 +0200 Subject: [PATCH] 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