From 014c38f28251611a5d5e2fcdeab1a73c83edf5c2 Mon Sep 17 00:00:00 2001 From: Erki Date: Wed, 24 Jun 2020 23:12:08 +0300 Subject: [PATCH] Remove potential edgecases from gravity/slip code (#9194) The old code relies on lastarea being up to date. This doesn't really make sense, and can lead to edge cases; we should just be checking the turf the mob is on. --- code/modules/mob/mob_movement.dm | 12 ++++++++---- html/changelogs/skull132_gravity.yml | 5 +++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 html/changelogs/skull132_gravity.yml diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 6d73cefa615..9b374c83d55 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -467,12 +467,16 @@ //If there's no gravity then there's no up or down so naturally you can't stand on anything. //For the same reason lattices in space don't count - those are things you grip, presumably. /mob/proc/check_solid_ground() - if(istype(loc, /turf/space)) + var/turf/T = get_turf(src) + + if (!T) // nullspace so sure, have gravity. + return 1 + else if (istype(T, /turf/space)) return 0 - if(!lastarea) - lastarea = get_area(loc) - if(!lastarea.has_gravity()) + var/area/A = T.loc + + if (!A.has_gravity()) return 0 return 1 diff --git a/html/changelogs/skull132_gravity.yml b/html/changelogs/skull132_gravity.yml new file mode 100644 index 00000000000..e3034c55ad6 --- /dev/null +++ b/html/changelogs/skull132_gravity.yml @@ -0,0 +1,5 @@ +author: Skull132 +delete-after: True + +changes: + - tweak: "Adjust some gravity behaviour, maybe fix a few bugs."