In game things are ugly if we do very long range paths - some times this is not what we need, speaking about run-time control.
class PathsLinker expands BrushBuilder;
var() bool bLogNewNav, bLogTweakPoint, bGenerateDecoUC, bLogActors, bComputeDistance,
bCheckDuplicates, bLogBrushBuildLag, bTestReach;
var() int NumBrush;
var LevelInfo MyMap;
final function FindLevel()
{
SetPropertyText("MyMap","MyLevel.LevelInfo0");
if( MyMap==None )
SetPropertyText("MyMap","MyLevel.LevelInfo1");
if( MyMap==None )
SetPropertyText("MyMap","MyLevel.LevelInfo2");
if( MyMap==None )
Warn("Couldn't find levelinfo!");
}
event bool Build()
{
FindLevel();
if( MyMap == None )
GoTo NoMap;
if (bLogNewNav)
LogSpawnSelected();
if (bLogTweakPoint)
LogVectorialEtc();
if (bGenerateDecoUC)
GenerateNonStaticDeco();
if (bLogActors)
LogWrappedNames();
if (bComputeDistance)
ComputeTheseTwo();
if (bCheckDuplicates)
FindCrappedActors();
if (bLogBrushBuildLag)
{
if ( NumBrush == 0 )
return BadParameters("NumBrush parameter should not be 0.");
FindLaggerBuild();
}
if (bTestReach)
TestTheseTwo();
GoTo Ending;
NoMap:
log ("No Map Environment for Operating...",'PathsLinker');
return BadParameters("Did not find a clean Level...");
Ending:
}
final function TestTheseTwo()
{
local Actor A, A1, A2;
local GunlocScout S;
foreach MyMap.AllActors(class'Actor',A)
{
if ( A.bSelected && A1 == None )
{
A1 = A;
continue;
}
if ( A.bSelected && A2 == None )
{
A2 = A;
break;
}
}
if ( A1 != None && A2 != None )
{
S = MyMap.Spawn(class'GunlocScout',,,A1.Location);
if (S == None) Goto UnabletoOperate;
else
{
if (S.CheckReachability( A1,A2 ))
{
Log ("Route is OK from"@A1.Name@"to"@A2.Name@"having distance"@VSize(A1.Location-A2.Location)@"UU.");
S.SetLocation(A2.Location);
if (S.CheckReachability( A2,A1 ))
{
Log ("Route is OK from"@A2.Name@"to"@A1.Name@"having distance"@VSize(A2.Location-A1.Location)@"UU.");
}
else
{
Log ("Route from "$A2.Name$" to "$A1.Name$" doesn't seem reachable.");
S.bCanFly = True;
if (S.CheckReachability( A2,A1 ))
Log("Flight is required for navigating from"@A2.Name@"to"@A1.Name);
}
}
else
{
Log ("Route from "$A1.Name$" to "$A2.Name$" doesn't seem reachable.");
S.bCanFly = True;
if (S.CheckReachability( A1,A2 ))
Log("Flight is required for navigating from"@A1.Name@"to"@A2.Name);
S.bCanFly = False;
S.SetLocation(A2.Location);
if (S.CheckReachability( A2,A1 ))
{
Log ("Route is OK from"@A2.Name@"to"@A1.Name@"having distance"@VSize(A2.Location-A1.Location)@"UU.");
}
else
{
S.bCanFly = True;
if (S.CheckReachability( A2,A1 ))
Log("Flight is required for navigating from"@A2.Name@"to"@A1.Name);
else
Log ("Route from "$A2.Name$" to "$A1.Name$" doesn't seem reachable.");
}
}
S.Destroy();
}
Goto DoneHere;
}
UnabletoOperate:
log ("Bad Selection... I'm sorry about that...");
DoneHere:
}
final function FindLaggerBuild()
{
local Brush B;
local INT i;
foreach MyMap.AllActors(class 'Brush',B)
{
i++;
if (i == NumBrush)
{
log ("Suspect Brush pausing build process ="@B.Name);
break;
}
}
}
final function FindCrappedActors()
{
local Actor A, A1;
local Int i, j;
foreach MyMap.AllActors(class'Actor',A)
{
foreach MyMap.AllActors(class'Actor',A1,A.Tag)
{
if ( string(A.Name) == string(A1.Name) )
{
i++;
}
}
if ( i > 1 )
{
j++;
log (A.Name@"was found"@i@"times.");
}
i = 0;
}
if ( j > 0 )
log ("Found"@j@"duplicated Actors.");
else
log ("This Level doesn't seems to have duplicated actors at this check.");
}
final function ComputeTheseTwo()
{
local Actor A, A1, A2;
foreach MyMap.AllActors(class'Actor',A)
{
if ( A.bSelected && A1 == None )
{
A1 = A;
continue;
}
if ( A.bSelected && A2 == None )
{
A2 = A;
break;
}
}
if ( A1 != None && A2 != None )
{
log ("Distance between"@A1.Name@"and"@A2.Name@"="@VSize(A1.Location-A2.Location)@"UU.");
A1 = None; A2 = None;
}
else
log("You must have 2 selected actors...");
}
final function LogWrappedNames()
{
local int I;
local Actor A;
foreach MyMap.AllActors(class'Actor',A)
{
I++;
log (A.Name@"is number"@I@".",'OrderOfActors');
}
log ( "Logged "$I$" actors..." );
}
final function LogSpawnSelected()
{
local Actor A;
local bool bRotated;
foreach MyMap.AllActors(class'Actor',A)
{
if (A.bSelected)
{
if ( A.Rotation.Pitch != 0 )
{
log ("NewRot.Pitch="$A.Rotation.Pitch$";",'UcCopy');
bRotated = True;
}
if ( A.Rotation.Roll != 0 )
{
log ("NewRot.Roll="$A.Rotation.Roll$";",'UcCopy');
bRotated = True;
}
if ( A.Rotation.Yaw != 0 )
{
log ("NewRot.Yaw="$A.Rotation.Yaw$";",'UcCopy');
bRotated = True;
}
if ( bRotated && NavigationPoint(A) == None )
log ( "Spawn(class'"$A.Tag$"',,,vect("$int(A.Location.X)$","$int(A.Location.Y)$","$int(A.Location.Z)$"),NewRot);",'UcCopy' );
else
log ( "Spawn(class'"$A.Tag$"',,,vect("$int(A.Location.X)$","$int(A.Location.Y)$","$int(A.Location.Z)$"));",'UcCopy' );
bRotated = False;
}
}
}
final function LogVectorialEtc()
{
local Actor A;
local string str, sto;
local int I;
I=0;
foreach MyMap.AllActors(class'Actor',A)
{
I++;
if (A.bSelected)
{
if (A.IsA('NavigationPoint'))
{
log ( "foreach NavigationActors(class'"$GetClassName(A)$"',"$Left(GetClassName(A),2)$",30,vect("$int(A.Location.X)$","$int(A.Location.Y)$","$int(A.Location.Z)$"))",'UcCopy');
log ("{",'UcCopy');
log (" if (string("$Left(GetClassName(A),2)$".Name) ~= "$CHR(34)$A.Name$CHR(34)$")",'UcCopy');
log (" {",'UcCopy');
log (" ",'UcCopy');
log (" break;",'UcCopy');
log (" }",'UcCopy');
log ("}",'UcCopy');
}
else
{
log (" if (string(A.Name) ~= "$CHR(34)$A.Name$CHR(34)$") // Position "$I,'UcCopy');
log (" {",'UcCopy');
log (" ",'UcCopy');
log (" continue;",'UcCopy');
log (" }",'UcCopy');
}
str = "";
sto = "";
}
}
I = 0;
}
final function GenerateNonStaticDeco()
{
local Actor A;
local string str, sto;
local int I;
foreach MyMap.AllActors(class'Actor',A)
{
if (A.bSelected)
{
if ( A.IsA('Decoration') )
{
log ("class E_"$GetClassName(A)$" expands "$GetClassName(A)$";",'UcCopy');
log (" ",'UcCopy');
log ("defaultproperties",'UcCopy');
log ("{",'UcCopy');
log (" bStatic=False",'UcCopy');
log (" bNoDelete=False",'UcCopy');
log (" bMovable=True",'UcCopy');
log (" bGameRelevant=True",'UcCopy');
log (" bCollideWorld=False",'UcCopy');
log (" bCollideActors=False",'UcCopy');
log (" bCollideWhenPlacing=False",'UcCopy');
log (" ScaleGlow=240",'UcCopy');
log (" RemoteRole=ROLE_None",'UcCopy');
log ("}",'UcCopy');
}
}
}
}
function String GetClassName(Actor AnActor)
{
Local string FullName, ClassName, Temp;
Local int pos, I, J;
Temp="None";
if (AnActor == None) return Temp;
FullName="";
pos=-1;
FullName=string(AnActor.Class);
ClassName=string(AnActor.Class);
// log (FullName);
pos = InStr(FullName, ".");
// log (pos);
if ( InStr(FullName, ".") > 0 )
{
FullName=Left(FullName, InStr(FullName, "."));
I = Len(FullName);
J = Len(string(AnActor.Class));
FullName = Right(ClassName,J-(I+1));
}
// log ("GetClassName::"@FullName@"for"@AnActor.Name);
return FullName;
/*
if (anActor == None)
return string(None);
return string(anActor.Class.Outer);
*/
// return string(anActor.Class.Outer);
}
defaultproperties
{
BitmapFilename="PathsLinker"
ToolTip="Paths Linker"
}