Pretty simple virtual. Since there's no way to really tell if an actor can cross certain lines, I had to come up with this for the sake of not needing to recreate A_Chase by hand.
Returning false means the line is blocking. Side is the side of the line the actor is on, currently, at the time of calling.
This function occurs after most PIT_CheckLine checks, but before other sector updating code near the end, meaning it handles things like MaxStepHeight before it calls this function.
Example code here allows for monsters to cross over and out of damaging floors, since I have programmed them to take damage from damaging floors just like players do via the Tick() override.
Code: Select all
override bool CanCrossLine(Line crossing, int side)
{
// Already in a sector that's burning the monster, and may need to
// cross over some in order to reach ground without it, so allow it.
if (CurSector.DamageAmount > 0)
return true;
Line l = crossing;
// If walking away from the direction of the damage sector, allow
// walking over the line. Otherwise they can get stuck.
double ang = VectorAngle(l.delta.x, l.delta.y) + 90;
double delta = AbsAngle(ang, angle);
if (l.frontsector.DamageAmount < 1 && delta >= 90)
return true;
if (l.backsector.DamageAmount < 1 && delta <= 90)
return true;
// Crossing over the front side, so check the back sector.
if (side == Line.Front)
return (l.backsector.DamageAmount < 1);
// Vice versa.
return (l.frontsector.DamageAmount < 1);
}