From 66527ab763d8a143e6dbb55c92569d458bc8581d Mon Sep 17 00:00:00 2001 From: RavingManiac Date: Tue, 30 Sep 2014 23:18:04 +0800 Subject: [PATCH] gravitychange() now makes all affected mobs have the floating animation unless magbooted, etc. New mob proc Check_Dense_Object() seperated from Process_Spacemove(), checks for adjacent objects or turfs that can be pushed off, also handles magboots on gravity-less floors. --- code/game/area/areas.dm | 10 ++++++ code/modules/mob/mob_movement.dm | 59 +++++++++++++++----------------- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 1019aed79c2..f5c9edb9bf1 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -329,6 +329,16 @@ thunk(M) for(var/mob/M1 in SubA) M1.make_floating(0) + else + for(var/mob/M in SubA) + if(M.Check_Dense_Object() && istype(src,/mob/living/carbon/human/)) + var/mob/living/carbon/human/H = src + if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags & NOSLIP)) //magboots + dense_object = no floaty effect + H.make_floating(0) + else + H.make_floating(1) + else + M.make_floating(1) /area/proc/thunk(mob) if(istype(mob,/mob/living/carbon/human/)) // Only humans can wear magboots, so we give them a chance to. diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 87babf9a7e0..ee7ae00560e 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -403,11 +403,33 @@ ///Return 1 for movement 0 for none /mob/proc/Process_Spacemove(var/check_drift = 0) - /* - if(istype(src,/mob/living/carbon)) - if(src.l_hand && src.r_hand) - return 0 - */ + if(!Check_Dense_Object()) //Nothing to push off of so end here + make_floating(1) + return 0 + + if(istype(src,/mob/living/carbon/human/)) + var/mob/living/carbon/human/H = src + if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags & NOSLIP)) //magboots + dense_object = no floaty effect + make_floating(0) + else + make_floating(1) + else + make_floating(1) + + if(restrained()) //Check to see if we can do things + return 0 + + //Check to see if we slipped + if(prob(Process_Spaceslipping(5))) + src << "\blue You slipped!" + src.inertia_dir = src.last_move + step(src, src.inertia_dir) + return 0 + //If not then we can reset inertia and move + inertia_dir = 0 + return 1 + +/mob/proc/Check_Dense_Object() //checks for anything to push off in the vicinity. also handles magboots on gravity-less floors tiles var/dense_object = 0 for(var/turf/turf in oview(1,src)) @@ -447,32 +469,7 @@ dense_object++ break - //Nothing to push off of so end here - if(!dense_object) - make_floating(1) - return 0 - - if(istype(src,/mob/living/carbon/human/)) - var/mob/living/carbon/human/H = src - if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags & NOSLIP)) //magboots + dense_object = no floaty effect - make_floating(0) - else - make_floating(1) - else - make_floating(1) - - if(restrained()) //Check to see if we can do things - return 0 - - //Check to see if we slipped - if(prob(Process_Spaceslipping(5))) - src << "\blue You slipped!" - src.inertia_dir = src.last_move - step(src, src.inertia_dir) - return 0 - //If not then we can reset inertia and move - inertia_dir = 0 - return 1 + return dense_object /mob/proc/Process_Spaceslipping(var/prob_slip = 5)