diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 38452c3d5bd..83139e4d2a1 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -227,7 +227,7 @@ var/list/mob/living/forced_ambiance_list = new var/area/oldarea = L.lastarea if((oldarea.has_gravity == 0) && (newarea.has_gravity == 1) && (L.m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together. thunk(L) - L.make_floating(0) + L.update_floating( L.Check_Dense_Object() ) L.lastarea = newarea play_ambience(L) @@ -260,21 +260,10 @@ var/list/mob/living/forced_ambiance_list = new /area/proc/gravitychange(var/gravitystate = 0, var/area/A) A.has_gravity = gravitystate - if(gravitystate) - for(var/mob/living/carbon/human/M in A) + for(var/mob/M in A) + if(has_gravity) thunk(M) - for(var/mob/M1 in A) - M1.make_floating(0) - else - for(var/mob/M in A) - 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) + M.update_floating( M.Check_Dense_Object() ) /area/proc/thunk(mob) if(istype(get_turf(mob), /turf/space)) // Can't fall onto nothing. diff --git a/code/modules/mob/animations.dm b/code/modules/mob/animations.dm index ac4224dc436..9bff0fbbe99 100644 --- a/code/modules/mob/animations.dm +++ b/code/modules/mob/animations.dm @@ -77,10 +77,36 @@ note dizziness decrements automatically in the mob's Life() proc. pixel_y = old_y -//handles up-down floaty effect in space +//handles up-down floaty effect in space and zero-gravity /mob/var/is_floating = 0 /mob/var/floatiness = 0 +/mob/proc/update_floating(var/dense_object=0) + + if(anchored||buckled) + make_floating(0) + return + + var/turf/turf = get_turf(src) + if(!istype(turf,/turf/space)) + var/area/A = turf.loc + if(istype(A) && A.has_gravity) + make_floating(0) + return + else if (Check_Shoegrip()) + make_floating(0) + return + else + make_floating(1) + return + + if(dense_object && Check_Shoegrip()) + make_floating(0) + return + + make_floating(1) + return + /mob/proc/make_floating(var/n) floatiness = n diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index a1bb3244890..e3c92f708d1 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1361,3 +1361,8 @@ ..() if(update_hud) handle_regular_hud_updates() + +/mob/living/carbon/human/Check_Shoegrip() + if(istype(shoes, /obj/item/clothing/shoes/magboots) && (shoes.flags & NOSLIP)) //magboots + dense_object = no floating + return 1 + return 0 \ No newline at end of file diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 3cffc1a57a2..04041316421 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -449,17 +449,10 @@ /mob/proc/Process_Spacemove(var/check_drift = 0) if(!Check_Dense_Object()) //Nothing to push off of so end here - make_floating(1) + update_floating(0) 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) + update_floating(1) if(restrained()) //Check to see if we can do things return 0 @@ -477,6 +470,8 @@ /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 + var/shoegrip + for(var/turf/turf in oview(1,src)) if(istype(turf,/turf/space)) continue @@ -484,14 +479,9 @@ if(istype(turf,/turf/simulated/floor)) // Floors don't count if they don't have gravity var/area/A = turf.loc if(istype(A) && A.has_gravity == 0) - var/can_walk = 0 - - if(ishuman(src)) // Only humans can wear magboots, so we give them a chance to. - var/mob/living/carbon/human/H = src - if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags & NOSLIP)) - can_walk = 1 - - if(!can_walk) + if(shoegrip == null) + shoegrip = Check_Shoegrip() //Shoegrip is only ever checked when a zero-gravity floor is encountered to reduce load + if(!shoegrip) continue dense_object++ @@ -511,6 +501,8 @@ return dense_object +/mob/proc/Check_Shoegrip() + return 0 /mob/proc/Process_Spaceslipping(var/prob_slip = 5) //Setup slipage