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.
This commit is contained in:
Erki
2020-06-24 23:12:08 +03:00
committed by GitHub
parent ed347c1adc
commit 014c38f282
2 changed files with 13 additions and 4 deletions
+8 -4
View File
@@ -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