fill empty lines

This commit is contained in:
ineed bots
2024-04-04 16:58:39 -06:00
parent ad4f073e91
commit 324d72b001
9 changed files with 3719 additions and 3718 deletions
+189 -189
View File
File diff suppressed because it is too large Load Diff
+583 -583
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1618 -1618
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+225 -225
View File
File diff suppressed because it is too large Load Diff
+143 -143
View File
@@ -16,21 +16,21 @@ init()
{
setdvar( "bots_main_debug", 0 );
}
if ( !getdvarint( "bots_main_debug" ) )
{
return;
}
if ( !getdvarint( "developer" ) )
{
setdvar( "developer_script", 1 );
setdvar( "developer", 1 );
setdvar( "sv_mapRotation", "map " + getdvar( "mapname" ) );
exitlevel( false );
}
setdvar( "bots_main", 0 );
setdvar( "bots_main_menu", 0 );
setdvar( "bots_manage_fill_mode", 0 );
@@ -38,32 +38,32 @@ init()
setdvar( "bots_manage_add", 0 );
setdvar( "bots_manage_fill_kick", 1 );
setdvar( "bots_manage_fill_spec", 1 );
if ( getdvar( "bots_main_debug_distance" ) == "" )
{
setdvar( "bots_main_debug_distance", 512.0 );
}
if ( getdvar( "bots_main_debug_cone" ) == "" )
{
setdvar( "bots_main_debug_cone", 0.65 );
}
if ( getdvar( "bots_main_debug_minDist" ) == "" )
{
setdvar( "bots_main_debug_minDist", 32.0 );
}
if ( getdvar( "bots_main_debug_drawThrough" ) == "" )
{
setdvar( "bots_main_debug_drawThrough", false );
}
setdvar( "player_sustainAmmo", 1 );
level.waypoints = [];
level.waypointcount = 0;
level waittill( "connected", player );
player thread onPlayerSpawned();
}
@@ -71,7 +71,7 @@ init()
onPlayerSpawned()
{
self endon( "disconnect" );
for ( ;; )
{
self waittill( "spawned_player" );
@@ -83,11 +83,11 @@ startDev()
{
self endon( "disconnect" );
self endon( "death" );
level.wptolink = -1;
level.autolink = false;
self.nearest = -1;
self takeallweapons();
self giveweapon( "m16_gl_mp" ); // to knife windows
self giveweapon( "javelin_mp" ); // to mark jav spots
@@ -100,7 +100,7 @@ startDev()
self maps\mp\perks\_perks::giveperk( "specialty_marathon" );
self maps\mp\perks\_perks::giveperk( "specialty_lightweight" );
self freezecontrols( false );
self thread watchAddWaypointCommand();
self thread watchDeleteAllWaypointsCommand();
self thread watchDeleteWaypointCommand();
@@ -111,7 +111,7 @@ startDev()
self thread watchAutoLinkCommand();
self thread updateWaypointsStats();
self thread watchAstarCommand();
self thread sayExtras();
}
@@ -135,29 +135,29 @@ watchAstarCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "astar", "+gostand" );
self.astar = undefined;
for ( ;; )
{
self waittill( "astar" );
if ( isdefined( self.astar ) )
{
self iprintln( "Clear AStar" );
self.astar = undefined;
self waittill( "astar" );
}
self iprintln( "Start AStar" );
self.astar = spawnstruct();
self.astar.start = self.origin;
self waittill( "astar" );
self iprintln( "End AStar" );
self.astar.goal = self.origin;
self.astar.nodes = AStarSearch( self.astar.start, self.astar.goal, undefined, true );
self iprintln( "AStar size: " + self.astar.nodes.size );
}
@@ -167,7 +167,7 @@ updateWaypointsStats()
{
self endon( "disconnect" );
self endon( "death" );
self initHudElem( "TotalWps:", 102, 5 );
totalWpsHud = self initHudElem( "", 180, 5 );
self initHudElem( "NearestWP:", 102, 15 );
@@ -178,102 +178,102 @@ updateWaypointsStats()
type = self initHudElem( "", 160, 35 );
self initHudElem( "ToLink:", 102, 45 );
wpToLink = self initHudElem( "", 160, 45 );
infotext = self initHudElem2();
self initHudElem3();
self initHudElem4();
for ( time = 0;; time += 0.05 )
{
wait 0.05;
totalWpsHud settext( level.waypointcount );
closest = -1;
myEye = self geteye();
myAngles = self getplayerangles();
for ( i = 0; i < level.waypointcount; i++ )
{
if ( closest == -1 || closer( self.origin, level.waypoints[ i ].origin, level.waypoints[ closest ].origin ) )
{
closest = i;
}
wpOrg = level.waypoints[ i ].origin + ( 0, 0, 25 );
if ( distance( level.waypoints[ i ].origin, self.origin ) < getdvarfloat( "bots_main_debug_distance" ) && ( bullettracepassed( myEye, wpOrg, false, self ) || getdvarint( "bots_main_debug_drawThrough" ) ) )
{
for ( h = level.waypoints[ i ].children.size - 1; h >= 0; h-- )
{
line( wpOrg, level.waypoints[ level.waypoints[ i ].children[ h ] ].origin + ( 0, 0, 25 ), ( 1, 0, 1 ) );
}
if ( getConeDot( wpOrg, myEye, myAngles ) > getdvarfloat( "bots_main_debug_cone" ) )
{
print3d( wpOrg, i, ( 1, 0, 0 ), 2 );
}
if ( isdefined( level.waypoints[ i ].angles ) && level.waypoints[ i ].type != "stand" )
{
line( wpOrg, wpOrg + anglestoforward( level.waypoints[ i ].angles ) * 64, ( 1, 1, 1 ) );
}
if ( isdefined( level.waypoints[ i ].jav_point ) )
{
line( wpOrg, level.waypoints[ i ].jav_point, ( 0, 0, 0 ) );
}
}
}
self.nearest = closest;
nearestWP settext( self.nearest );
children settext( buildChildCountString( self.nearest ) );
type settext( buildTypeString( self.nearest ) );
wpToLink settext( level.wptolink );
infotext.x = infotext.x - 2;
if ( infotext.x <= -800 )
{
infotext.x = 800;
}
if ( self usebuttonpressed() && time > 2 )
{
time = 0;
self iprintlnbold( self.nearest + " children: " + buildChildString( self.nearest ) );
}
if ( isdefined( self.astar ) )
{
if ( isdefined( self.astar.start ) )
{
print3d( self.astar.start + ( 0, 0, 35 ), "start", ( 0, 0, 1 ), 2 );
}
if ( isdefined( self.astar.goal ) )
{
print3d( self.astar.goal + ( 0, 0, 35 ), "goal", ( 0, 0, 1 ), 2 );
}
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 ) );
prev = level.waypoints[ node ].origin + ( 0, 0, 35 );
}
line( prev, self.astar.goal + ( 0, 0, 35 ), ( 0, 1, 1 ) );
}
}
@@ -284,9 +284,9 @@ watchLoadWaypointsCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+actionslot 2}]", "+actionslot 2" );
for ( ;; )
{
self waittill( "[{+actionslot 2}]" );
@@ -298,9 +298,9 @@ watchAddWaypointCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+smoke}]", "+smoke" );
for ( ;; )
{
self waittill( "[{+smoke}]" );
@@ -312,13 +312,13 @@ watchAutoLinkCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+frag}]", "+frag" );
for ( ;; )
{
self waittill( "[{+frag}]" );
if ( level.autolink )
{
self iprintlnbold( "Auto link disabled" );
@@ -338,9 +338,9 @@ watchLinkWaypointCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+melee}]", "+melee" );
for ( ;; )
{
self waittill( "[{+melee}]" );
@@ -352,9 +352,9 @@ watchunlinkWaypointCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+reload}]", "+reload" );
for ( ;; )
{
self waittill( "[{+reload}]" );
@@ -366,9 +366,9 @@ watchDeleteWaypointCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+actionslot 3}]", "+actionslot 3" );
for ( ;; )
{
self waittill( "[{+actionslot 3}]" );
@@ -380,9 +380,9 @@ watchDeleteAllWaypointsCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+actionslot 4}]", "+actionslot 4" );
for ( ;; )
{
self waittill( "[{+actionslot 4}]" );
@@ -394,72 +394,72 @@ watchSaveWaypointsCommand()
{
self endon( "death" );
self endon( "disconnect" );
self notifyonplayercommand( "[{+actionslot 1}]", "+actionslot 1" );
for ( ;; )
{
self waittill( "[{+actionslot 1}]" );
self checkForWarnings();
wait 1;
logprint( "***********ABiliTy's WPDump**************\n\n" );
logprint( "\n\n\n\n" );
mpnm = getMapName( getdvar( "mapname" ) );
logprint( "\n\n" + mpnm + "()\n{\n/*" );
logprint( "*/waypoints = [];\n/*" );
for ( i = 0; i < level.waypointcount; i++ )
{
logprint( "*/waypoints[ " + i + " ] = spawnstruct();\n/*" );
logprint( "*/waypoints[ " + i + " ].origin = " + level.waypoints[ i ].origin + ";\n/*" );
logprint( "*/waypoints[ " + i + " ].type = \"" + level.waypoints[ i ].type + "\";\n/*" );
for ( c = 0; c < level.waypoints[ i ].children.size; c++ )
{
logprint( "*/waypoints[ " + i + " ].children[ " + c + " ] = " + level.waypoints[ i ].children[ c ] + ";\n/*" );
}
if ( isdefined( level.waypoints[ i ].angles ) && ( level.waypoints[ i ].type == "claymore" || level.waypoints[ i ].type == "tube" || ( level.waypoints[ i ].type == "crouch" && level.waypoints[ i ].children.size == 1 ) || level.waypoints[ i ].type == "climb" || level.waypoints[ i ].type == "grenade" ) )
{
logprint( "*/waypoints[ " + i + " ].angles = " + level.waypoints[ i ].angles + ";\n/*" );
}
if ( isdefined( level.waypoints[ i ].jav_point ) && level.waypoints[ i ].type == "javelin" )
{
logprint( "*/waypoints[ " + i + " ].jav_point = " + level.waypoints[ i ].jav_point + ";\n/*" );
}
}
logprint( "*/return waypoints;\n}\n\n\n\n" );
filename = "waypoints/" + getdvar( "mapname" ) + "_wp.csv";
println( "********* Start Bot Warfare WPDump *********" );
println( level.waypointcount );
BotBuiltinFileWrite( filename, level.waypointcount + "\n", "write" );
for ( i = 0; i < level.waypointcount; i++ )
{
str = "";
wp = level.waypoints[ i ];
str += wp.origin[ 0 ] + " " + wp.origin[ 1 ] + " " + wp.origin[ 2 ] + ",";
for ( h = 0; h < wp.children.size; h++ )
{
str += wp.children[ h ];
if ( h < wp.children.size - 1 )
{
str += " ";
}
}
str += "," + wp.type + ",";
if ( isdefined( wp.angles ) )
{
str += wp.angles[ 0 ] + " " + wp.angles[ 1 ] + " " + wp.angles[ 2 ] + ",";
@@ -468,7 +468,7 @@ watchSaveWaypointsCommand()
{
str += ",";
}
if ( isdefined( wp.jav_point ) )
{
str += wp.jav_point[ 0 ] + " " + wp.jav_point[ 1 ] + " " + wp.jav_point[ 2 ] + ",";
@@ -477,13 +477,13 @@ watchSaveWaypointsCommand()
{
str += ",";
}
println( str );
BotBuiltinFileWrite( filename, str + "\n", "append" );
}
println( "\n\n\n\n\n\n" );
self iprintln( "Saved!!! to " + filename );
}
}
@@ -494,9 +494,9 @@ LoadWaypoints()
self iprintlnbold( "Loading WPS..." );
load_waypoints();
level.waypointcount = level.waypoints.size;
wait 1;
self checkForWarnings();
}
@@ -506,12 +506,12 @@ checkForWarnings()
{
self iprintln( "WARNING: waypointCount is " + level.waypointcount );
}
if ( level.waypointcount != level.waypoints.size )
{
self iprintln( "WARNING: waypointCount is not " + level.waypoints.size );
}
for ( i = 0; i < level.waypointcount; i++ )
{
if ( !isdefined( level.waypoints[ i ] ) )
@@ -519,7 +519,7 @@ checkForWarnings()
self iprintln( "WARNING: waypoint " + i + " is undefined" );
continue;
}
if ( level.waypoints[ i ].children.size <= 0 )
{
self iprintln( "WARNING: waypoint " + i + " childCount is " + level.waypoints[ i ].children.size );
@@ -535,7 +535,7 @@ checkForWarnings()
for ( h = level.waypoints[ i ].children.size - 1; h >= 0; h-- )
{
child = level.waypoints[ i ].children[ h ];
if ( !isdefined( level.waypoints[ child ] ) )
{
self iprintln( "WARNING: waypoint " + i + " child " + child + " is undefined" );
@@ -547,43 +547,43 @@ checkForWarnings()
}
}
}
if ( !isdefined( level.waypoints[ i ].type ) )
{
self iprintln( "WARNING: waypoint " + i + " type is undefined" );
continue;
}
if ( level.waypoints[ i ].type == "javelin" && !isdefined( level.waypoints[ i ].jav_point ) )
{
self iprintln( "WARNING: waypoint " + i + " jav_point is undefined" );
}
if ( !isdefined( level.waypoints[ i ].angles ) && ( level.waypoints[ i ].type == "claymore" || level.waypoints[ i ].type == "tube" || ( level.waypoints[ i ].type == "crouch" && level.waypoints[ i ].children.size == 1 ) || level.waypoints[ i ].type == "climb" || level.waypoints[ i ].type == "grenade" ) )
{
self iprintln( "WARNING: waypoint " + i + " angles is undefined" );
}
}
// check reachability, assume bidirectional graph
wpIdx = randomint( level.waypointcount );
for ( i = 0; i < level.waypointcount; i++ )
{
if ( i % 5 == 0 )
{
wait 0.05;
}
astar = AStarSearch( level.waypoints[ wpIdx ].origin, level.waypoints[ i ].origin, undefined, true );
if ( astar.size <= 0 )
{
self iprintln( "WARNING: waypoint " + wpIdx + " has no path to waypoint " + i );
}
}
self iprintln( "Waypoint warnings check completed." );
}
@@ -595,17 +595,17 @@ UnLinkWaypoint( nwp )
level.wptolink = -1;
return;
}
if ( level.wptolink == -1 || nwp == level.wptolink )
{
level.wptolink = nwp;
self iprintln( "Waypoint unlink Started " + nwp );
return;
}
level.waypoints[ nwp ].children = array_remove( level.waypoints[ nwp ].children, level.wptolink );
level.waypoints[ level.wptolink ].children = array_remove( level.waypoints[ level.wptolink ].children, nwp );
self iprintln( "Waypoint " + nwp + " Broken to " + level.wptolink );
level.wptolink = -1;
}
@@ -618,33 +618,33 @@ LinkWaypoint( nwp )
level.wptolink = -1;
return;
}
if ( level.wptolink == -1 || nwp == level.wptolink )
{
level.wptolink = nwp;
self iprintln( "Waypoint Link Started " + nwp );
return;
}
weGood = true;
for ( i = level.waypoints[ level.wptolink ].children.size - 1; i >= 0; i-- )
{
child = level.waypoints[ level.wptolink ].children[ i ];
if ( child == nwp )
{
weGood = false;
break;
}
}
if ( weGood )
{
for ( i = level.waypoints[ nwp ].children.size - 1; i >= 0; i-- )
{
child = level.waypoints[ nwp ].children[ i ];
if ( child == level.wptolink )
{
weGood = false;
@@ -652,17 +652,17 @@ LinkWaypoint( nwp )
}
}
}
if ( !weGood )
{
self iprintln( "Waypoint Link Cancelled " + nwp + " and " + level.wptolink + " already linked." );
level.wptolink = -1;
return;
}
level.waypoints[ level.wptolink ].children[ level.waypoints[ level.wptolink ].children.size ] = nwp;
level.waypoints[ nwp ].children[ level.waypoints[ nwp ].children.size ] = level.wptolink;
self iprintln( "Waypoint " + nwp + " Linked to " + level.wptolink );
level.wptolink = -1;
}
@@ -674,16 +674,16 @@ DeleteWaypoint( nwp )
self iprintln( "No close enough waypoint to delete." );
return;
}
level.wptolink = -1;
for ( i = level.waypoints[ nwp ].children.size - 1; i >= 0; i-- )
{
child = level.waypoints[ nwp ].children[ i ];
level.waypoints[ child ].children = array_remove( level.waypoints[ child ].children, nwp );
}
for ( i = 0; i < level.waypointcount; i++ )
{
for ( h = level.waypoints[ i ].children.size - 1; h >= 0; h-- )
@@ -694,7 +694,7 @@ DeleteWaypoint( nwp )
}
}
}
for ( entry = 0; entry < level.waypointcount; entry++ )
{
if ( entry == nwp )
@@ -704,24 +704,24 @@ DeleteWaypoint( nwp )
level.waypoints[ entry ] = level.waypoints[ entry + 1 ];
entry++;
}
level.waypoints[ entry ] = undefined;
break;
}
}
level.waypointcount--;
self iprintln( "DelWp " + nwp );
}
AddWaypoint()
{
level.waypoints[ level.waypointcount ] = spawnstruct();
pos = self getorigin();
level.waypoints[ level.waypointcount ].origin = pos;
if ( isdefined( self.javelintargetpoint ) )
{
level.waypoints[ level.waypointcount ].type = "javelin";
@@ -746,25 +746,25 @@ AddWaypoint()
{
level.waypoints[ level.waypointcount ].type = self getstance();
}
level.waypoints[ level.waypointcount ].angles = self getplayerangles();
level.waypoints[ level.waypointcount ].children = [];
if ( level.waypoints[ level.waypointcount ].type == "javelin" )
{
level.waypoints[ level.waypointcount ].jav_point = self.javelintargetpoint;
}
self iprintln( level.waypoints[ level.waypointcount ].type + " Waypoint " + level.waypointcount + " Added at " + pos );
if ( level.autolink )
{
if ( level.wptolink == -1 )
{
level.wptolink = level.waypointcount - 1;
}
level.waypointcount++;
self LinkWaypoint( level.waypointcount - 1 );
}
@@ -778,7 +778,7 @@ DeleteAllWaypoints()
{
level.waypoints = [];
level.waypointcount = 0;
self iprintln( "DelAllWps" );
}
@@ -788,9 +788,9 @@ buildChildCountString( wp )
{
return "";
}
wpstr = level.waypoints[ wp ].children.size + "";
return wpstr;
}
@@ -800,9 +800,9 @@ buildChildString( wp )
{
return "";
}
wpstr = "";
for ( i = 0; i < level.waypoints[ wp ].children.size; i++ )
{
if ( i != 0 )
@@ -814,7 +814,7 @@ buildChildString( wp )
wpstr = wpstr + level.waypoints[ wp ].children[ i ];
}
}
return wpstr;
}
@@ -824,7 +824,7 @@ buildTypeString( wp )
{
return "";
}
return level.waypoints[ wp ].type;
}
@@ -853,9 +853,9 @@ initHudElem( txt, xl, yl )
hud.glowcolor = ( 0, 0, 0 );
hud.glowalpha = 1;
hud.color = ( 1.0, 1.0, 1.0 );
self thread destroyOnDeath( hud );
return hud;
}
@@ -877,9 +877,9 @@ initHudElem2()
infotext.glowcolor = ( 0, 0, 0 );
infotext.glowalpha = 1;
infotext.color = ( 1.0, 1.0, 1.0 );
self thread destroyOnDeath( infotext );
return infotext;
}
@@ -892,9 +892,9 @@ initHudElem3()
bar.vertalign = "bottom";
bar.y = 30;
bar.foreground = true;
self thread destroyOnDeath( bar );
return bar;
}
@@ -909,8 +909,8 @@ initHudElem4()
OptionsBG.vertalign = "top";
OptionsBG setshader( "black", 200, 60 );
OptionsBG.alpha = 0.4;
self thread destroyOnDeath( OptionsBG );
return OptionsBG;
}