fixes a connect_loc runtime related to abstract_move (#59969)

This commit is contained in:
Kylerace
2021-07-10 17:40:53 -07:00
committed by GitHub
parent b1e23185a3
commit ca02dc622b
2 changed files with 20 additions and 13 deletions
+6 -2
View File
@@ -3,7 +3,7 @@
glide_size = 8
appearance_flags = TILE_BOUND|PIXEL_SCALE
///how many times a this movable was moved since Moved() was last called
///how many times a this movable had movement procs called on it since Moved() was last called
var/move_stacks = 0
var/last_move = null
var/last_move_time = 0
@@ -368,6 +368,7 @@
*/
/atom/movable/proc/abstract_move(atom/new_loc)
var/atom/old_loc = loc
move_stacks++
loc = new_loc
Moved(old_loc)
@@ -566,8 +567,11 @@
update_parallax_contents()
move_stacks--
if(move_stacks > 0)
if(move_stacks > 0) //we want only the first Moved() call in the stack to send this signal, all the other ones have an incorrect old_loc
return
if(move_stacks < 0)
stack_trace("move_stacks is negative in Moved()!")
move_stacks = 0 //setting it to 0 so that we dont get every movable with negative move_stacks runtiming on every movement
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, old_loc, movement_dir, forced, old_locs)
+14 -11
View File
@@ -329,7 +329,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/Move(NewLoc, direct, glide_size_override = 32)
if(updatedir)
setDir(direct)//only update dir if we actually need it, so overlays won't spin on base sprites that don't have directions of their own
var/oldloc = loc
if(glide_size_override)
set_glide_size(glide_size_override)
@@ -337,17 +336,21 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
abstract_move(NewLoc)
update_parallax_contents()
else
abstract_move(get_turf(src)) //Get out of closets and such as a ghost
if((direct & NORTH) && y < world.maxy)
y++
else if((direct & SOUTH) && y > 1)
y--
if((direct & EAST) && x < world.maxx)
x++
else if((direct & WEST) && x > 1)
x--
var/turf/destination = get_turf(src)
Moved(oldloc, direct)
if((direct & NORTH) && y < world.maxy)
destination = get_step(destination, NORTH)
else if((direct & SOUTH) && y > 1)
destination = get_step(destination, SOUTH)
if((direct & EAST) && x < world.maxx)
destination = get_step(destination, EAST)
else if((direct & WEST) && x > 1)
destination = get_step(destination, WEST)
abstract_move(destination)//Get out of closets and such as a ghost
/mob/dead/observer/forceMove(atom/destination)
abstract_move(destination) // move like the wind