fix comments format

This commit is contained in:
ineed bots 2023-12-20 15:17:57 -06:00
parent 7156b3e9bc
commit 0fd65658ed
3 changed files with 50 additions and 50 deletions

View File

@ -28,77 +28,77 @@ init()
if ( getcvar( "bots_main_GUIDs" ) == "" ) if ( getcvar( "bots_main_GUIDs" ) == "" )
{ {
setcvar( "bots_main_GUIDs", "" ); //guids of players who will be given host powers, comma seperated setcvar( "bots_main_GUIDs", "" ); // guids of players who will be given host powers, comma seperated
} }
if ( getcvar( "bots_main_firstIsHost" ) == "" ) if ( getcvar( "bots_main_firstIsHost" ) == "" )
{ {
setcvar( "bots_main_firstIsHost", true ); //first player to connect is a host setcvar( "bots_main_firstIsHost", true ); // first player to connect is a host
} }
if ( getcvar( "bots_main_waitForHostTime" ) == "" ) if ( getcvar( "bots_main_waitForHostTime" ) == "" )
{ {
setcvar( "bots_main_waitForHostTime", 10.0 ); //how long to wait to wait for the host player setcvar( "bots_main_waitForHostTime", 10.0 ); // how long to wait to wait for the host player
} }
if ( getcvar( "bots_main_kickBotsAtEnd" ) == "" ) if ( getcvar( "bots_main_kickBotsAtEnd" ) == "" )
{ {
setcvar( "bots_main_kickBotsAtEnd", false ); //kicks the bots at game end setcvar( "bots_main_kickBotsAtEnd", false ); // kicks the bots at game end
} }
if ( getcvar( "bots_manage_add" ) == "" ) if ( getcvar( "bots_manage_add" ) == "" )
{ {
setcvar( "bots_manage_add", 0 ); //amount of bots to add to the game setcvar( "bots_manage_add", 0 ); // amount of bots to add to the game
} }
if ( getcvar( "bots_manage_fill" ) == "" ) if ( getcvar( "bots_manage_fill" ) == "" )
{ {
setcvar( "bots_manage_fill", 0 ); //amount of bots to maintain setcvar( "bots_manage_fill", 0 ); // amount of bots to maintain
} }
if ( getcvar( "bots_manage_fill_spec" ) == "" ) if ( getcvar( "bots_manage_fill_spec" ) == "" )
{ {
setcvar( "bots_manage_fill_spec", true ); //to count for fill if player is on spec team setcvar( "bots_manage_fill_spec", true ); // to count for fill if player is on spec team
} }
if ( getcvar( "bots_manage_fill_mode" ) == "" ) if ( getcvar( "bots_manage_fill_mode" ) == "" )
{ {
setcvar( "bots_manage_fill_mode", 0 ); //fill mode, 0 adds everyone, 1 just bots, 2 maintains at maps, 3 is 2 with 1 setcvar( "bots_manage_fill_mode", 0 ); // fill mode, 0 adds everyone, 1 just bots, 2 maintains at maps, 3 is 2 with 1
} }
if ( getcvar( "bots_manage_fill_kick" ) == "" ) if ( getcvar( "bots_manage_fill_kick" ) == "" )
{ {
setcvar( "bots_manage_fill_kick", false ); //kick bots if too many setcvar( "bots_manage_fill_kick", false ); // kick bots if too many
} }
if ( getcvar( "bots_team" ) == "" ) if ( getcvar( "bots_team" ) == "" )
{ {
setcvar( "bots_team", "autoassign" ); //which team for bots to join setcvar( "bots_team", "autoassign" ); // which team for bots to join
} }
if ( getcvar( "bots_team_amount" ) == "" ) if ( getcvar( "bots_team_amount" ) == "" )
{ {
setcvar( "bots_team_amount", 0 ); //amount of bots on axis team setcvar( "bots_team_amount", 0 ); // amount of bots on axis team
} }
if ( getcvar( "bots_team_force" ) == "" ) if ( getcvar( "bots_team_force" ) == "" )
{ {
setcvar( "bots_team_force", false ); //force bots on team setcvar( "bots_team_force", false ); // force bots on team
} }
if ( getcvar( "bots_team_mode" ) == "" ) if ( getcvar( "bots_team_mode" ) == "" )
{ {
setcvar( "bots_team_mode", 0 ); //counts just bots when 1 setcvar( "bots_team_mode", 0 ); // counts just bots when 1
} }
if ( getcvar( "bots_skill" ) == "" ) if ( getcvar( "bots_skill" ) == "" )
{ {
setcvar( "bots_skill", 0 ); //0 is random, 1 is easy 7 is hard, 8 is custom, 9 is completely random setcvar( "bots_skill", 0 ); // 0 is random, 1 is easy 7 is hard, 8 is custom, 9 is completely random
} }
if ( getcvar( "bots_skill_axis_hard" ) == "" ) if ( getcvar( "bots_skill_axis_hard" ) == "" )
{ {
setcvar( "bots_skill_axis_hard", 0 ); //amount of hard bots on axis team setcvar( "bots_skill_axis_hard", 0 ); // amount of hard bots on axis team
} }
if ( getcvar( "bots_skill_axis_med" ) == "" ) if ( getcvar( "bots_skill_axis_med" ) == "" )
@ -131,42 +131,42 @@ init()
setcvar( "bots_loadout_rank", -1 ); setcvar( "bots_loadout_rank", -1 );
} }
if ( getcvar( "bots_play_move" ) == "" ) //bots move if ( getcvar( "bots_play_move" ) == "" ) // bots move
{ {
setcvar( "bots_play_move", true ); setcvar( "bots_play_move", true );
} }
if ( getcvar( "bots_play_knife" ) == "" ) //bots knife if ( getcvar( "bots_play_knife" ) == "" ) // bots knife
{ {
setcvar( "bots_play_knife", true ); setcvar( "bots_play_knife", true );
} }
if ( getcvar( "bots_play_fire" ) == "" ) //bots fire if ( getcvar( "bots_play_fire" ) == "" ) // bots fire
{ {
setcvar( "bots_play_fire", true ); setcvar( "bots_play_fire", true );
} }
if ( getcvar( "bots_play_nade" ) == "" ) //bots grenade if ( getcvar( "bots_play_nade" ) == "" ) // bots grenade
{ {
setcvar( "bots_play_nade", true ); setcvar( "bots_play_nade", true );
} }
if ( getcvar( "bots_play_obj" ) == "" ) //bots play the obj if ( getcvar( "bots_play_obj" ) == "" ) // bots play the obj
{ {
setcvar( "bots_play_obj", true ); setcvar( "bots_play_obj", true );
} }
if ( getcvar( "bots_play_camp" ) == "" ) //bots camp and follow if ( getcvar( "bots_play_camp" ) == "" ) // bots camp and follow
{ {
setcvar( "bots_play_camp", true ); setcvar( "bots_play_camp", true );
} }
if ( getcvar( "bots_play_jumpdrop" ) == "" ) //bots jump and dropshot if ( getcvar( "bots_play_jumpdrop" ) == "" ) // bots jump and dropshot
{ {
setcvar( "bots_play_jumpdrop", true ); setcvar( "bots_play_jumpdrop", true );
} }
if ( getcvar( "bots_play_ads" ) == "" ) //bot ads if ( getcvar( "bots_play_ads" ) == "" ) // bot ads
{ {
setcvar( "bots_play_ads", true ); setcvar( "bots_play_ads", true );
} }

View File

@ -1208,7 +1208,7 @@ aim_loop()
{ {
if ( isplay ) if ( isplay )
{ {
//better room to nade? cook time function with dist? // better room to nade? cook time function with dist?
if ( !self.bot.isfraggingafter && !self.bot.issmokingafter ) if ( !self.bot.isfraggingafter && !self.bot.issmokingafter )
{ {
nade = self getValidGrenade(); nade = self getValidGrenade();
@ -1854,7 +1854,7 @@ doWalk( goal, dist, isScriptGoal )
{ {
level endon ( "game_ended" ); level endon ( "game_ended" );
self endon( "kill_goal" ); self endon( "kill_goal" );
self endon( "goal_internal" ); //so that the watchOnGoal notify can happen same frame, not a frame later self endon( "goal_internal" ); // so that the watchOnGoal notify can happen same frame, not a frame later
dist *= dist; dist *= dist;
@ -2033,7 +2033,7 @@ doMantle()
*/ */
getRandomLargestStafe( dist ) getRandomLargestStafe( dist )
{ {
//find a better algo? // find a better algo?
traces = NewHeap( ::HeapTraceFraction ); traces = NewHeap( ::HeapTraceFraction );
myOrg = self.origin + ( 0, 0, 16 ); myOrg = self.origin + ( 0, 0, 16 );

View File

@ -1001,11 +1001,11 @@ RaySphereIntersect( start, end, spherePos, radius )
} }
mu1 = ( 0 - b + sqrt( bb4ac ) ) / ( 2 * a ); mu1 = ( 0 - b + sqrt( bb4ac ) ) / ( 2 * a );
//mu2 = (0-b - sqrt(bb4ac)) / (2 * a); // mu2 = (0-b - sqrt(bb4ac)) / (2 * a);
// intersection points of the sphere // intersection points of the sphere
ip1 = start + vector_scale( dp, mu1 ); ip1 = start + vector_scale( dp, mu1 );
//ip2 = start + mu2 * dp; // ip2 = start + mu2 * dp;
myDist = distancesquared( start, end ); myDist = distancesquared( start, end );
@ -1964,7 +1964,7 @@ _WaypointsToKDTree( waypoints, dem )
heap HeapRemove(); heap HeapRemove();
} }
median = int( sorted.size / 2 ); //use divide and conq median = int( sorted.size / 2 ); // use divide and conq
left = []; left = [];
right = []; right = [];
@ -2061,7 +2061,7 @@ KDTree()
/* /*
Called on a KDTree. Will insert the object into the KDTree. Called on a KDTree. Will insert the object into the KDTree.
*/ */
KDTreeInsert( data ) //as long as what you insert has a .origin attru, it will work. KDTreeInsert( data ) // as long as what you insert has a .origin attru, it will work.
{ {
self.root = self _KDTreeInsert( self.root, data, 0, -2147483647, -2147483647, -2147483647, 2147483647, 2147483647, 2147483647 ); self.root = self _KDTreeInsert( self.root, data, 0, -2147483647, -2147483647, -2147483647, 2147483647, 2147483647, 2147483647 );
} }
@ -2467,9 +2467,9 @@ getNearestWaypoint( pos )
*/ */
AStarSearch( start, goal, team, greedy_path ) AStarSearch( start, goal, team, greedy_path )
{ {
open = NewHeap( ::ReverseHeapAStar ); //heap open = NewHeap( ::ReverseHeapAStar ); // heap
openset = [];//set for quick lookup openset = []; // set for quick lookup
closed = [];//set for quick lookup closed = []; // set for quick lookup
startWp = getNearestWaypoint( start ); startWp = getNearestWaypoint( start );
@ -2513,26 +2513,26 @@ AStarSearch( start, goal, team, greedy_path )
node = spawnstruct(); node = spawnstruct();
node.g = 0; //path dist so far node.g = 0; // path dist so far
node.h = distancesquared( level.waypoints[ startWp ].origin, level.waypoints[ goalWp ].origin ); //herustic, distance to goal for path finding node.h = distancesquared( level.waypoints[ startWp ].origin, level.waypoints[ goalWp ].origin ); // herustic, distance to goal for path finding
node.f = node.h + node.g; // combine path dist and heru, use reverse heap to sort the priority queue by this attru node.f = node.h + node.g; // combine path dist and heru, use reverse heap to sort the priority queue by this attru
node.index = startWp; node.index = startWp;
node.parent = undefined; //we are start, so we have no parent node.parent = undefined; // we are start, so we have no parent
//push node onto queue // push node onto queue
openset[ node.index + "" ] = node; openset[ node.index + "" ] = node;
open HeapInsert( node ); open HeapInsert( node );
//while the queue is not empty // while the queue is not empty
while ( open.data.size ) while ( open.data.size )
{ {
//pop bestnode from queue // pop bestnode from queue
bestNode = open.data[ 0 ]; bestNode = open.data[ 0 ];
open HeapRemove(); open HeapRemove();
openset[ bestNode.index + "" ] = undefined; openset[ bestNode.index + "" ] = undefined;
wp = level.waypoints[ bestNode.index ]; wp = level.waypoints[ bestNode.index ];
//check if we made it to the goal // check if we made it to the goal
if ( bestNode.index == goalWp ) if ( bestNode.index == goalWp )
{ {
path = []; path = [];
@ -2549,7 +2549,7 @@ AStarSearch( start, goal, team, greedy_path )
level.waypointusage[ team ][ bestNode.index + "" ]++; level.waypointusage[ team ][ bestNode.index + "" ]++;
} }
//construct path // construct path
path[ path.size ] = bestNode.index; path[ path.size ] = bestNode.index;
bestNode = bestNode.parent; bestNode = bestNode.parent;
@ -2558,7 +2558,7 @@ AStarSearch( start, goal, team, greedy_path )
return path; return path;
} }
//for each child of bestnode // for each child of bestnode
for ( i = wp.children.size - 1; i >= 0; i-- ) for ( i = wp.children.size - 1; i >= 0; i-- )
{ {
child = wp.children[ i ]; child = wp.children[ i ];
@ -2572,7 +2572,7 @@ AStarSearch( start, goal, team, greedy_path )
if ( isdefined( level.waypointusage[ team ][ child + "" ] ) ) if ( isdefined( level.waypointusage[ team ][ child + "" ] ) )
{ {
temppen = level.waypointusage[ team ][ child + "" ]; //consider how many bots are taking this path temppen = level.waypointusage[ team ][ child + "" ]; // consider how many bots are taking this path
} }
if ( temppen > 1 ) if ( temppen > 1 )
@ -2587,10 +2587,10 @@ AStarSearch( start, goal, team, greedy_path )
penalty += 4; penalty += 4;
} }
//calc the total path we have took // calc the total path we have took
newg = bestNode.g + distancesquared( wp.origin, childWp.origin ) * penalty; //bots on same team's path are more expensive newg = bestNode.g + distancesquared( wp.origin, childWp.origin ) * penalty; // bots on same team's path are more expensive
//check if this child is in open or close with a g value less than newg // check if this child is in open or close with a g value less than newg
inopen = isdefined( openset[ child + "" ] ); inopen = isdefined( openset[ child + "" ] );
if ( inopen && openset[ child + "" ].g <= newg ) if ( inopen && openset[ child + "" ].g <= newg )
@ -2626,13 +2626,13 @@ AStarSearch( start, goal, team, greedy_path )
node.f = node.g + node.h; node.f = node.g + node.h;
node.index = child; node.index = child;
//check if in closed, remove it // check if in closed, remove it
if ( inclosed ) if ( inclosed )
{ {
closed[ child + "" ] = undefined; closed[ child + "" ] = undefined;
} }
//check if not in open, add it // check if not in open, add it
if ( !inopen ) if ( !inopen )
{ {
open HeapInsert( node ); open HeapInsert( node );
@ -2640,7 +2640,7 @@ AStarSearch( start, goal, team, greedy_path )
} }
} }
//done with children, push onto closed // done with children, push onto closed
closed[ bestNode.index + "" ] = bestNode; closed[ bestNode.index + "" ] = bestNode;
} }
@ -2728,7 +2728,7 @@ random_normal_distribution( mean, std_deviation, lower_bound, upper_bound )
*/ */
Log( x ) Log( x )
{ {
//thanks Bob__ at stackoverflow // thanks Bob__ at stackoverflow
old_sum = 0.0; old_sum = 0.0;
xmlxpl = ( x - 1 ) / ( x + 1 ); xmlxpl = ( x - 1 ) / ( x + 1 );
xmlxpl_2 = xmlxpl * xmlxpl; xmlxpl_2 = xmlxpl * xmlxpl;