Now this is just an example.
Code: Select all
BlockThingsIterator it = BlockThingsIterator.Create(self);
while (it.Next())
{
Actor mo = it.thing;
if (!mo || mo == self || mo is "PlayerPawn") // Ignore player actors.
continue;
double blockdist = radius + mo.radius;
if (abs(mo.pos.x - it.Position.X) >= blockdist || abs(mo.pos.y - it.Position.Y) >= blockdist)
continue;
// Q: Make this z-aware for everything? It never was before.
if (mo.pos.z + mo.height < pos.z || mo.pos.z > pos.z + height)
{
if (CurSector.PortalGroup != mo.CurSector.PortalGroup)
continue;
}
if (mo.bSHOOTABLE || mo.bVULNERABLE)
{ mo.DamageMobj(self, self, "Crush", 2000); }
}
it.thing is the actor that is checked (though for convenience I just used 'Actor mo = it.thing;') and did all those checks up there, but bear in mind those are distance checks included. You can ex-nay those if you need to.