Document Moved() and forwards old_locs (#59819)

- Passes the proper arguments on Moved(), forgot to do this on another PR.
- Documents the proc better.
- Cleans up code a little.
This commit is contained in:
Rohesie
2021-06-27 17:45:24 +01:00
committed by GitHub
parent 3316e2223f
commit 134f266f78
+14 -6
View File
@@ -385,7 +385,7 @@
var/list/old_locs
if(is_multi_tile_object && isturf(loc))
old_locs = locs.Copy()
old_locs = locs // locs is a special list, this is effectively the same as .Copy() but with less steps
for(var/atom/exiting_loc as anything in old_locs)
if(!exiting_loc.Exit(src, direction))
return
@@ -440,7 +440,7 @@
if(oldarea != newarea)
newarea.Entered(src, direction)
Moved(oldloc, direction)
Moved(oldloc, direction, FALSE, old_locs)
////////////////////////////////////////
@@ -542,13 +542,21 @@
if(. && has_buckled_mobs() && !handle_buckled_mob_movement(loc, direct, glide_size_override)) //movement failed due to buckled mob(s)
return FALSE
//Called after a successful Move(). By this point, we've already moved
/atom/movable/proc/Moved(atom/OldLoc, Dir, Forced = FALSE)
/**
* Called after a successful Move(). By this point, we've already moved.
* Arguments:
* * old_loc is the location prior to the move. Can be null to indicate nullspace.
* * movement_dir is the direction the movement took place. Can be NONE if it was some sort of teleport.
* * The forced flag indicates whether this was a forced move, which skips many checks of regular movement.
* * The old_locs is an optional argument, in case the moved movable was present in multiple locations before the movement.
**/
/atom/movable/proc/Moved(atom/old_loc, movement_dir, forced = FALSE, list/old_locs)
SHOULD_CALL_PARENT(TRUE)
if (!inertia_moving)
inertia_next_move = world.time + inertia_move_delay
newtonian_move(Dir)
newtonian_move(movement_dir)
if (length(client_mobs_in_contents))
update_parallax_contents()
@@ -556,7 +564,7 @@
if(move_stacks > 0)
return
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, OldLoc, Dir, Forced)
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, old_loc, movement_dir, forced, old_locs)
return TRUE