makes /turf/Enter() faster, and also makes CollidedWith async (#31217)

* makes /turf/Enter faster, maybe

* waitfor false on atom/collidedwith
This commit is contained in:
vuonojenmustaturska
2017-10-03 12:32:58 +03:00
committed by CitadelStationBot
parent 22b6f538d6
commit ebca0173f3
2 changed files with 16 additions and 21 deletions
+1
View File
@@ -189,6 +189,7 @@
/atom/proc/CollidedWith(atom/movable/AM)
set waitfor = FALSE
return
// Convenience proc to see if a container is open for chemistry handling
+15 -21
View File
@@ -121,8 +121,6 @@
return FALSE
/turf/Enter(atom/movable/mover as mob|obj, atom/forget as mob|obj|turf|area)
if (!mover)
return TRUE
// First, make sure it can leave its square
if(isturf(mover.loc))
// Nothing but border objects stop you from leaving a tile, only one loop is needed
@@ -131,32 +129,28 @@
mover.Collide(obstacle)
return FALSE
var/list/large_dense = list()
//Next, check objects to block entry that are on the border
for(var/atom/movable/border_obstacle in src)
if(border_obstacle.flags_1 & ON_BORDER_1)
if(!border_obstacle.CanPass(mover, mover.loc, 1) && (forget != border_obstacle))
mover.Collide(border_obstacle)
return FALSE
else
large_dense += border_obstacle
//Then, check the turf itself
if (!src.CanPass(mover, src))
mover.Collide(src)
return FALSE
//Finally, check objects/mobs to block entry that are not on the border
var/atom/movable/tompost_bump
var/atom/movable/topmost_bump
var/top_layer = FALSE
for(var/atom/movable/obstacle in large_dense)
//Next, check objects to block entry that are on the border
for(var/atom/movable/obstacle in src)
if(!obstacle.CanPass(mover, mover.loc, 1) && (forget != obstacle))
if(obstacle.layer > top_layer)
tompost_bump = obstacle
top_layer = obstacle.layer
if(tompost_bump)
mover.Collide(tompost_bump)
if(obstacle.flags_1 & ON_BORDER_1)
mover.Collide(obstacle)
return FALSE
else
if(obstacle.layer > top_layer)
topmost_bump = obstacle
top_layer = obstacle.layer
if(topmost_bump)
mover.Collide(topmost_bump)
return FALSE
return TRUE //Nothing found to block so return success!