big connect_loc fix. teleporters dont cause runtimes and movables registered to things entering their turf no longer have themselves entering their turf sent to them (#59065)

This commit is contained in:
Kylerace
2021-05-13 23:42:33 -07:00
committed by GitHub
parent b67a6be383
commit b95a6af896
6 changed files with 27 additions and 26 deletions
-2
View File
@@ -384,8 +384,6 @@
#define COMPONENT_MOVABLE_BLOCK_PRE_MOVE (1<<0)
///from base of atom/movable/Moved(): (/atom, dir)
#define COMSIG_MOVABLE_MOVED "movable_moved"
///from base of atom/movable/update_loc(): (/atom/oldloc)
#define COMSIG_MOVABLE_LOCATION_CHANGE "location_changed"
///from base of atom/movable/Cross(): (/atom/movable)
#define COMSIG_MOVABLE_CROSS "movable_cross"
///from base of atom/movable/Move(): (/atom/movable)
+3 -3
View File
@@ -24,7 +24,7 @@
src.connections = connections
RegisterSignal(tracked, COMSIG_MOVABLE_LOCATION_CHANGE, .proc/on_moved, override=TRUE)
RegisterSignal(tracked, COMSIG_MOVABLE_MOVED, .proc/on_moved, override = TRUE)
update_signals(listener, tracked)
/datum/element/connect_loc/Detach(datum/listener, atom/movable/tracked, list/connections)
@@ -34,7 +34,7 @@
unregister_all(listener)
else if(targets[tracked.loc]) // Detach can happen multiple times due to qdel
unregister_signals(listener, tracked, tracked.loc)
UnregisterSignal(tracked, COMSIG_MOVABLE_LOCATION_CHANGE)
UnregisterSignal(tracked, COMSIG_MOVABLE_MOVED)
/datum/element/connect_loc/proc/update_signals(datum/listener, atom/movable/tracked)
var/existing = length(targets[tracked.loc])
@@ -62,7 +62,7 @@
unregister_signals(listener, tracked, location)
else
continue
UnregisterSignal(tracked, COMSIG_MOVABLE_LOCATION_CHANGE)
UnregisterSignal(tracked, COMSIG_MOVABLE_MOVED)
/datum/element/connect_loc/proc/unregister_signals(datum/listener, atom/movable/tracked, atom/old_loc)
if (length(targets[old_loc]) <= 1)
+20 -17
View File
@@ -2,6 +2,9 @@
layer = OBJ_LAYER
glide_size = 8
appearance_flags = TILE_BOUND|PIXEL_SCALE
///how many times a this movable was moved since Moved() was last called
var/move_stacks = 0
var/last_move = null
var/last_move_time = 0
var/anchored = FALSE
@@ -359,18 +362,9 @@
* most of the time you want forceMove()
*/
/atom/movable/proc/abstract_move(atom/new_loc)
var/atom/old_loc = update_loc(new_loc)
Moved(old_loc)
/**
* meant to be used for all location changes. any instances of setting loc directly (for movables) should instead use this
* do NOT use this directly, use either Move() or abstract_move() or forceMove()
*/
/atom/movable/proc/update_loc(atom/new_loc)
SHOULD_NOT_OVERRIDE(TRUE)
var/old_loc = loc
var/atom/old_loc = loc
loc = new_loc
SEND_SIGNAL(src, COMSIG_MOVABLE_LOCATION_CHANGE, old_loc)
Moved(old_loc)
////////////////////////////////////////
// Here's where we rewrite how byond handles movement except slightly different
@@ -400,8 +394,9 @@
var/atom/oldloc = loc
var/area/oldarea = get_area(oldloc)
var/area/newarea = get_area(newloc)
move_stacks++
update_loc(newloc)
loc = newloc
. = TRUE
oldloc.Exited(src, newloc)
@@ -412,6 +407,8 @@
if(oldarea != newarea)
newarea.Entered(src, oldloc)
Moved(oldloc, direct)
////////////////////////////////////////
/atom/movable/Move(atom/newloc, direct, glide_size_override = 0)
@@ -487,8 +484,6 @@
last_move = 0
return
if(.)
Moved(oldloc, direct)
if(. && pulling && pulling == pullee && pulling != moving_from_pull) //we were pulling a thing and didn't lose it during our move.
if(pulling.anchored)
stop_pulling()
@@ -517,13 +512,19 @@
//Called after a successful Move(). By this point, we've already moved
/atom/movable/proc/Moved(atom/OldLoc, Dir, Forced = FALSE)
SHOULD_CALL_PARENT(TRUE)
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, OldLoc, Dir, Forced)
if (!inertia_moving)
inertia_next_move = world.time + inertia_move_delay
newtonian_move(Dir)
if (length(client_mobs_in_contents))
update_parallax_contents()
move_stacks--
if(move_stacks > 0)
return
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, OldLoc, Dir, Forced)
return TRUE
@@ -634,6 +635,7 @@
/atom/movable/proc/doMove(atom/destination)
. = FALSE
move_stacks++
if(destination)
if(pulledby)
pulledby.stop_pulling()
@@ -642,9 +644,10 @@
var/area/old_area = get_area(oldloc)
var/area/destarea = get_area(destination)
update_loc(destination)
moving_diagonally = 0
loc = destination
if(!same_loc)
if(oldloc)
oldloc.Exited(src, destination)
@@ -672,7 +675,7 @@
oldloc.Exited(src, null)
if(old_area)
old_area.Exited(src, null)
update_loc(null)
loc = null
/atom/movable/proc/onTransitZ(old_z,new_z)
SEND_SIGNAL(src, COMSIG_MOVABLE_Z_CHANGED, old_z, new_z)
+1 -1
View File
@@ -8,7 +8,7 @@
/obj/effect/temp_visual/point/Initialize(mapload, set_invis = 0)
. = ..()
var/atom/old_loc = loc
update_loc(get_turf(src))
abstract_move(get_turf(src))
pixel_x = old_loc.pixel_x
pixel_y = old_loc.pixel_y
invisibility = set_invis
+1 -1
View File
@@ -4,7 +4,7 @@
/obj/effect/buildmode_line/New(client/C, atom/atom_a, atom/atom_b, linename)
name = linename
update_loc(get_turf(atom_a))
abstract_move(get_turf(atom_a))
I = image('icons/misc/mark.dmi', src, "line", 19.0)
var/x_offset = ((atom_b.x * 32) + atom_b.pixel_x) - ((atom_a.x * 32) + atom_a.pixel_x)
var/y_offset = ((atom_b.y * 32) + atom_b.pixel_y) - ((atom_a.y * 32) + atom_a.pixel_y)
+2 -2
View File
@@ -105,7 +105,7 @@ All ShuttleMove procs go here
if(loc != oldT) // This is for multi tile objects
return
update_loc(newT)
abstract_move(newT)
return TRUE
@@ -385,7 +385,7 @@ All ShuttleMove procs go here
if(loc != oldT) // This is for multi tile objects
return
update_loc(newT)
abstract_move(newT)
return TRUE