I have an actor who calls a function every tic (which I know full well is a costly thing to do, so I take responsibility) to see if the actor type I want to scan for (Clip, in the example above, but there are others I'm looking for in practice) exists anywhere on the playing field. If it does, I perform some operations on it, such as spawning another actor in its place if certain conditions exist -- like a more powerful but possibly less graceful version of the 'replaces' keyword.
This seems to work just fine for the most part, but I was playing a large map that features these actors:
Code: Select all
Actor SnowSpawner 27889
{
+NoBlockMap
+NoGravity
+NoSector
+NoInteraction
+NoClip
+CLIENTSIDEONLY
+SPAWNCEILING
Radius 1
Height 1
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIf(Args[2] > 0,"Circle")
TNT1 A 0 A_CheckSight("Unsighted")
TNT1 A 8 A_SpawnItemEx("SnowParticle",Random(-Args[0],-Args[0]),Random(-Args[0],-Args[0]),0,Random(0,1),Random(0,1),Random(-1,-3),0,128,Args[1])
Loop
Circle:
TNT1 A 0 A_CheckSight("Unsighted")
TNT1 A 8 A_SpawnItemEx("SnowParticle",Random(-Args[0],-Args[0]),0,0,Random(0,1),Random(0,1),Random(-1,-3),Random(0,360),128,Args[1])
Loop
Unsighted:
TNT1 A 1
Goto Spawn
}
}
Actor SnowParticle
{
+MISSILE
+NoBlockMap
Radius 1
Height 1
Projectile
RenderStyle Translucent
Alpha 0
Scale .7
States
{
Spawn:
SNOP AAAAAAA 2 A_FadeIn
SNOP A 3
Wait
Death:
SNOP AAAAAA 1 A_FadeOut(0.2)
stop
}
}
...and in many areas, hundreds (if not thousands) of SnowParticles exist together. Even if I were to comment out the body of my while loop, leaving just while((mo=Inventory(it.Next(true)))!=null){}, that alone will bring my machine to a crawl. Heck, even without my ThinkerIterator (playing this map by itself), it can cause a touch of slowdown in some spots from the sheer number of actors.