Skip to content

Commit

Permalink
fix move from null
Browse files Browse the repository at this point in the history
  • Loading branch information
amylizzle committed May 24, 2024
1 parent dede5b1 commit e1f7076
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions DMCompiler/DMStandard/Types/Atoms/Movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,26 @@
if (Dir != 0)
dir = Dir

if (!loc.Exit(src, NewLoc))
return FALSE
// Ensure the atoms on the turf also permit this exit
for (var/atom/movable/exiting in loc)
if (!exiting.Uncross(src))
if(!isnull(loc))
if (!loc.Exit(src, NewLoc))
return FALSE
// Ensure the atoms on the turf also permit this exit
for (var/atom/movable/exiting in loc)
if (!exiting.Uncross(src))
return FALSE

if (NewLoc.Enter(src, loc))
var/atom/oldloc = loc
var/area/oldarea = oldloc.loc
var/area/oldarea = oldloc?.loc
var/area/newarea = NewLoc.loc
loc = NewLoc

// First, call Exited() on the old area
if (newarea != oldarea)
oldarea.Exited(src, loc)
oldarea?.Exited(src, loc)

// Second, call Exited() on the old turf and Uncrossed() on its contents
oldloc.Exited(src, loc)
oldloc?.Exited(src, loc)
for (var/atom/movable/uncrossed in oldloc)
uncrossed.Uncrossed(src)

Expand Down

0 comments on commit e1f7076

Please sign in to comment.