Skip to content

Commit

Permalink
Fix Move() from null (#1809)
Browse files Browse the repository at this point in the history
Co-authored-by: amylizzle <amylizzle@users.noreply.github.com>
  • Loading branch information
amylizzle and amylizzle committed May 28, 2024
1 parent c0974d2 commit dac497b
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 dac497b

Please sign in to comment.