1
0
mirror of https://github.com/ineedbots/iw5_bot_warfare.git synced 2025-09-01 10:37:25 +00:00

Cleanup trace for bones

Cleanup waypointcount
cleanup str concat
This commit is contained in:
ineed bots
2024-04-04 13:19:51 -06:00
parent f31a306b0a
commit 1bf8314acd
3 changed files with 96 additions and 72 deletions

View File

@@ -77,7 +77,7 @@ init()
level.waypoints = [];
}
level.waypointcount = 0;
level.waypointcount = level.waypoints.size;
level waittill( "connected", player );
player thread onPlayerSpawned();
@@ -153,29 +153,29 @@ watchAstarCommand()
self endon( "death" );
self notifyonplayercommand( "astar", "+gostand" );
self.astar = undefined;
for ( ;; )
{
self waittill( "astar" );
if ( 1 )
if ( isdefined( self.astar ) )
{
continue;
self iprintln( "Clear AStar" );
self.astar = undefined;
self waittill( "astar" );
}
self iprintln( "Start AStar" );
self.astar = undefined;
astar = spawnstruct();
astar.start = self.origin;
self.astar = spawnstruct();
self.astar.start = self.origin;
self waittill( "astar" );
self iprintln( "End AStar" );
astar.goal = self.origin;
self.astar.goal = self.origin;
astar.nodes = AStarSearch( astar.start, astar.goal, undefined, true );
self iprintln( "AStar size: " + astar.nodes.size );
self.astar = astar;
self.astar.nodes = AStarSearch( self.astar.start, self.astar.goal, undefined, true );
self iprintln( "AStar size: " + self.astar.nodes.size );
}
}
@@ -405,30 +405,45 @@ updateWaypointsStats()
if ( isdefined( self.astar ) )
{
// print3d(self.astar.start + (0, 0, 35), "start", (0,0,1), 2);
// print3d(self.astar.goal + (0, 0, 35), "goal", (0,0,1), 2);
if ( timeToUpdate )
if ( isdefined( self.astar.start ) )
{
drawPath( self.astar.start );
drawPath( self.astar.goal );
}
prev = self.astar.start + ( 0, 0, 35 );
for ( i = self.astar.nodes.size - 1; i >= 0; i-- )
{
node = self.astar.nodes[ i ];
// print3d( self.astar.start + ( 0, 0, 35 ), "start", ( 0, 0, 1 ), 2 );
// line(prev, level.waypoints[ node ].origin + (0, 0, 35), (0,1,1));
if ( timeToUpdate )
{
drawPath( level.waypoints[ node ].origin );
drawPath( self.astar.start );
}
prev = level.waypoints[ node ].origin + ( 0, 0, 35 );
}
// line(prev, self.astar.goal + (0, 0, 35), (0,1,1));
if ( isdefined( self.astar.goal ) )
{
// print3d( self.astar.goal + ( 0, 0, 35 ), "goal", ( 0, 0, 1 ), 2 );
if ( timeToUpdate )
{
drawPath( self.astar.goal );
}
}
if ( isdefined( self.astar.start ) && isdefined( self.astar.goal ) && isdefined( self.astar.nodes ) )
{
prev = self.astar.start + ( 0, 0, 35 );
for ( i = self.astar.nodes.size - 1; i >= 0; i-- )
{
node = self.astar.nodes[ i ];
// line(prev, level.waypoints[ node ].origin + (0, 0, 35), (0,1,1));
if ( timeToUpdate )
{
drawPath( level.waypoints[ node ].origin );
}
prev = level.waypoints[ node ].origin + ( 0, 0, 35 );
}
// line(prev, self.astar.goal + (0, 0, 35), (0,1,1));
}
}
}
}
@@ -646,6 +661,7 @@ LoadWaypoints()
// self DeleteAllWaypoints();
self iprintlnbold( "Loading WPS..." );
load_waypoints();
level.waypointcount = level.waypoints.size;
wait 1;
@@ -934,7 +950,7 @@ DeleteAllWaypoints()
self iprintln( "DelAllWps" );
}
buildChildCountString ( wp )
buildChildCountString( wp )
{
if ( wp == -1 )
{