Currently I have this crude proc that I call, that cause objects to bounce away from the object bounced:
Repulse(var/atom/A,var/BUMPED=FALSE)
if(isturf(src))return
//world<<"A=[A] src=[src]"
//world<<"get_dir(A,src)=[get_dir(A,src)] A.dir=[A.dir] NORTH=[NORTH] SOUTH=[SOUTH] BUMPED=[BUMPED]"
if(REPULSING) return
switch(get_dir(src,A))
if(NORTH)
if(src.dir==SOUTH) return
if(SOUTH)
if(src.dir==NORTH) return
if(WEST)
if(src.dir==EAST) return
if(EAST)
if(src.dir==WEST) return
if(NORTHEAST)
if(src.dir==SOUTHWEST) return
if(NORTHWEST)
if(src.dir==SOUTHEAST) return
if(SOUTHWEST)
if(src.dir==NORTHEAST) return
if(SOUTHEAST)
if(src.dir==NORTHWEST) return
REPULSING=TRUE
var/RepulseDir = A.GetTrueDir(src) //we want src to go backward
world<<"A=[A] src=[src] BUMPED=[BUMPED] RepulseDir=[RepulseDir]"
var/count=0
var/test=src.Bumped(A,RepulseDir,0)
var/test2=A.Bump(src,RepulseDir,0)
while(test/*src.Bumped(A,RepulseDir)*/>0||test2/*A.Bump(src,RepulseDir)*/>0)
count++
if(count>=A.step_size) break
src:PixelMove(RepulseDir,1)
world<<"in loop test=[test] test2=[test2] RepulseDir=[RepulseDir] count=[count]"
test=src.Bumped(A,RepulseDir,0)
test2=A.Bump(src,RepulseDir,0)
REPULSING=FALSE
At first I didn't think I needed this function, but since an object can pass through an object if it's pixel_step size is too large, then I need a way to check for time (ex: every 1 pixel, instead of every 4).
I'm currently using a crude while loop to do this, and I don't know if there's a more efficient way.
So are there other universal methods for dealing with what to do after a collision is detected?