Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // targetRadius defines how far to look for enemies
- action void ShootEnemies (double targetRadius) {
- if (!target)
- return;
- let it = BlockThingsIterator.Create (self, targetRadius);
- while (it.Next () && it.thing != null) {
- let act = it.thing;
- if (!act.bIsMonster && act.player == null) // Skip if not a monster
- continue;
- if (!act.bShootable || act.bNonShootable) // Skip if the monster can't be shot
- continue;
- if (act.bDormant || act.bInvulnerable || act.bNoDamage) // Skip if the monster is dormant or invulnerable
- continue;
- if (target.IsFriend (act)) // Skip if the monster and the shooter aren't hostile to eachother
- continue;
- if (Distance3D (act) > targetRadius) // Skip if the monster is further than targetRadius. *Shouldn't* be necessary, but who knows.
- continue;
- // Yep, this is a monster, so shoot at it.
- A_SpawnProjectile ("DoomImpBall", spawnheight: height / 2., flags: CMF_TRACKOWNER, ptr: AAPTR_Tracer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement