A simple submission, adds a boolean parameter to Distance2D and Distance3D in zscript. If true, the result returns squared, otherwise returns square rooted.
Test code:
Code: Select all
// Pick a random monster in the map and print how far away it is, both squared and rooted.
Class a : Actor
{
Default
{
+NOINTERACTION
}
States
{
Spawn:
TNT1 A 1 NoDelay
{
double len, sq;
let it = ThinkerIterator.Create("Actor", Thinker.STAT_DEFAULT);
Actor mo = null;
while (mo = Actor(it.Next()))
{
if (mo.bISMONSTER)
{
len = Distance3D(mo);
sq = Distance3DSquared(mo);
Console.Printf("Regular: %.3f\nSquared: %.3f", len, sq);
break;
}
}
}
Stop;
}
}