function bool CheckCollision(Actor A, float DSM, vector newLoc) // Credit to Feralidragon for this function
{
local bool isColliding;
local float CRadius, CHeight;
CRadius = A.CollisionRadius;
CHeight = A.CollisionHeight;
A.SetCollisionSize(A.CollisionRadius * DSM, A.CollisionHeight * DSM);
isColliding = !A.SetLocation(newLoc);
A.SetCollisionSize(CRadius, CHeight);
if (bDebugMode)
{
if (isColliding)
log("RMS: Can NOT grow = "$A$" DrawScaleMult = "$DSM);
else
log("RMS: Can grow = "$A$" DrawScaleMult = "$DSM);
}
return isColliding;
}
function CheckReSize(Actor Other)
{
local float F;
local Vector V;
F = FMax(MinMSize, (FRand()*MaxMSize));
V = Other.Location;
if (F > 1.0)
{
While ( (F > MinMSize) && (CheckCollision(Other, F, V)) )
{ F = FMax(MinMSize, F - ScaleDown); if (bDebugMode) { log("RMS: Scaledown -> "$F); } }
}
Other.DrawScale = Other.DrawScale * F;
Other.Mass = Other.Mass * F;
if (ScriptedPawn(Other).Shadow != None)
{ ScriptedPawn(Other).Shadow.DrawScale = ScriptedPawn(Other).Shadow.DrawScale * F; }
ScriptedPawn(Other).Health = FClamp(ScriptedPawn(Other).Health * F, MinMHealth, MaxMHealth);
Other.SetCollisionSize((Other.CollisionRadius * F), (Other.CollisionHeight * F));
if ((bDebugMode) && (Other.DrawScale != Other.default.DrawScale))
{ log("RMS: Pawn size randomized.... "$Other$" DrawScale = "$Other.DrawScale$" Health = "$Pawn(Other).Health); }
if ((bDebugMode) && (Other.DrawScale == Other.default.DrawScale))
{ log("RMS: Pawn size NOT randomized.... "$Other$" DrawScale = "$Other.DrawScale); }
}