diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 6f13e31e9e..01ef9def17 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -147,8 +147,7 @@ if(W.loc == my_target) break sleep(2) - var/area/a = get_area(usr.loc) - if((istype(usr.loc, /turf/space)) || (a.has_gravity == 0)) + if((istype(usr.loc, /turf/space)) || (usr.lastarea.has_gravity == 0)) user.inertia_dir = get_dir(target, user) step(user, user.inertia_dir) diff --git a/code/game/throwing.dm b/code/game/throwing.dm index a781481cc2..30167bdcab 100644 --- a/code/game/throwing.dm +++ b/code/game/throwing.dm @@ -64,9 +64,9 @@ item.layer = initial(item.layer) src.visible_message("\red [src] has thrown [item].") - - var/area/a = get_area(src.loc) - if((istype(src.loc, /turf/space)) || (a.has_gravity == 0)) + if(!src.lastarea) + src.lastarea = get_area(src.loc) + if((istype(src.loc, /turf/space)) || (src.lastarea.has_gravity == 0)) src.inertia_dir = get_dir(target, src) step(src, inertia_dir) diff --git a/code/game/turf.dm b/code/game/turf.dm index d576926f2b..c531fbefc8 100644 --- a/code/game/turf.dm +++ b/code/game/turf.dm @@ -82,9 +82,9 @@ /turf/Entered(atom/movable/M as mob|obj) var/loopsanity = 10 if(ismob(M)) - - var/area/a = get_area(M.loc) - if(a.has_gravity == 0) + if(!M:lastarea) + M:lastarea = get_area(M.loc) + if(M:lastarea.has_gravity == 0) inertial_drift(M) /* diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index d5c661a51d..28e32c4677 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -166,8 +166,10 @@ //if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV)) // if(!mob.Process_Spacemove(0)) return 0 - var/area/a = get_area(mob.loc) - if((istype(mob.loc, /turf/space)) || (a.has_gravity == 0)) + if(!mob.lastarea) + mob.lastarea = get_area(mob.loc) + + if((istype(mob.loc, /turf/space)) || (mob.lastarea.has_gravity == 0)) if(!mob.Process_Spacemove(0)) return 0 @@ -344,16 +346,13 @@ if(istype(turf,/turf/space)) continue - - var/area/a = get_area(turf) - if(istype(src,/mob/living/carbon/human/)) // Only humans can wear magboots, so we give them a chance to. - if((istype(turf,/turf/simulated/floor)) && (a.has_gravity == 0) && !(istype(src:shoes, /obj/item/clothing/shoes/magboots) && (src:shoes:flags & NOSLIP))) + if((istype(turf,/turf/simulated/floor)) && (src.lastarea.has_gravity == 0) && !(istype(src:shoes, /obj/item/clothing/shoes/magboots) && (src:shoes:flags & NOSLIP))) continue else - if((istype(turf,/turf/simulated/floor)) && (a.has_gravity == 0)) // No one else gets a chance. + if((istype(turf,/turf/simulated/floor)) && (src.lastarea.has_gravity == 0)) // No one else gets a chance. continue diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 382dbe4cc6..4888f663ab 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -26,6 +26,7 @@ var/starting_loc = pick(newplayer_start) if(!starting_loc) starting_loc = locate(1,1,1) loc = starting_loc + lastarea = starting_loc sight |= SEE_TURFS