Advertisement
Chronos_Ouroboros

Untitled

Sep 18th, 2018
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. // targetRadius defines how far to look for enemies
  2. action void ShootEnemies (double targetRadius) {
  3. if (!target)
  4. return;
  5.  
  6. let it = BlockThingsIterator.Create (self, targetRadius);
  7.  
  8. while (it.Next () && it.thing != null) {
  9. let act = it.thing;
  10.  
  11. if (!act.bIsMonster && act.player == null) // Skip if not a monster
  12. continue;
  13. if (!act.bShootable || act.bNonShootable) // Skip if the monster can't be shot
  14. continue;
  15. if (act.bDormant || act.bInvulnerable || act.bNoDamage) // Skip if the monster is dormant or invulnerable
  16. continue;
  17. if (target.IsFriend (act)) // Skip if the monster and the shooter aren't hostile to eachother
  18. continue;
  19. if (Distance3D (act) > targetRadius) // Skip if the monster is further than targetRadius. *Shouldn't* be necessary, but who knows.
  20. continue;
  21.  
  22. // Yep, this is a monster, so shoot at it.
  23. A_SpawnProjectile ("DoomImpBall", spawnheight: height / 2., flags: CMF_TRACKOWNER, ptr: AAPTR_Tracer);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement