From 0fd65658ed00bc32cc240f52b621b1164d35307d Mon Sep 17 00:00:00 2001 From: ineed bots Date: Wed, 20 Dec 2023 15:17:57 -0600 Subject: [PATCH] fix comments format --- maps/mp/bots/_bot.gsc | 46 ++++++++++++++++---------------- maps/mp/bots/_bot_internal.gsc | 6 ++--- maps/mp/bots/_bot_utility.gsc | 48 +++++++++++++++++----------------- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/maps/mp/bots/_bot.gsc b/maps/mp/bots/_bot.gsc index 5eae1a0..0ea2ea3 100644 --- a/maps/mp/bots/_bot.gsc +++ b/maps/mp/bots/_bot.gsc @@ -28,77 +28,77 @@ init() 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) { - setcvar( "bots_team_force", false ); //force bots on team + setcvar( "bots_team_force", false ); // force bots on team } 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" ) == "" ) { - 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" ) == "" ) { - 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" ) == "" ) @@ -131,42 +131,42 @@ init() setcvar( "bots_loadout_rank", -1 ); } - if ( getcvar( "bots_play_move" ) == "" ) //bots move + if ( getcvar( "bots_play_move" ) == "" ) // bots move { setcvar( "bots_play_move", true ); } - if ( getcvar( "bots_play_knife" ) == "" ) //bots knife + if ( getcvar( "bots_play_knife" ) == "" ) // bots knife { setcvar( "bots_play_knife", true ); } - if ( getcvar( "bots_play_fire" ) == "" ) //bots fire + if ( getcvar( "bots_play_fire" ) == "" ) // bots fire { setcvar( "bots_play_fire", true ); } - if ( getcvar( "bots_play_nade" ) == "" ) //bots grenade + if ( getcvar( "bots_play_nade" ) == "" ) // bots grenade { 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 ); } - if ( getcvar( "bots_play_camp" ) == "" ) //bots camp and follow + if ( getcvar( "bots_play_camp" ) == "" ) // bots camp and follow { 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 ); } - if ( getcvar( "bots_play_ads" ) == "" ) //bot ads + if ( getcvar( "bots_play_ads" ) == "" ) // bot ads { setcvar( "bots_play_ads", true ); } diff --git a/maps/mp/bots/_bot_internal.gsc b/maps/mp/bots/_bot_internal.gsc index ac1ed7a..fc1867f 100644 --- a/maps/mp/bots/_bot_internal.gsc +++ b/maps/mp/bots/_bot_internal.gsc @@ -1208,7 +1208,7 @@ aim_loop() { 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 ) { nade = self getValidGrenade(); @@ -1854,7 +1854,7 @@ doWalk( goal, dist, isScriptGoal ) { level endon ( "game_ended" ); 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; @@ -2033,7 +2033,7 @@ doMantle() */ getRandomLargestStafe( dist ) { - //find a better algo? + // find a better algo? traces = NewHeap( ::HeapTraceFraction ); myOrg = self.origin + ( 0, 0, 16 ); diff --git a/maps/mp/bots/_bot_utility.gsc b/maps/mp/bots/_bot_utility.gsc index d48ad0a..401a889 100644 --- a/maps/mp/bots/_bot_utility.gsc +++ b/maps/mp/bots/_bot_utility.gsc @@ -1001,11 +1001,11 @@ RaySphereIntersect( start, end, spherePos, radius ) } 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 ip1 = start + vector_scale( dp, mu1 ); - //ip2 = start + mu2 * dp; + // ip2 = start + mu2 * dp; myDist = distancesquared( start, end ); @@ -1964,7 +1964,7 @@ _WaypointsToKDTree( waypoints, dem ) heap HeapRemove(); } - median = int( sorted.size / 2 ); //use divide and conq + median = int( sorted.size / 2 ); // use divide and conq left = []; right = []; @@ -2061,7 +2061,7 @@ 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 ); } @@ -2467,9 +2467,9 @@ getNearestWaypoint( pos ) */ AStarSearch( start, goal, team, greedy_path ) { - open = NewHeap( ::ReverseHeapAStar ); //heap - openset = [];//set for quick lookup - closed = [];//set for quick lookup + open = NewHeap( ::ReverseHeapAStar ); // heap + openset = []; // set for quick lookup + closed = []; // set for quick lookup startWp = getNearestWaypoint( start ); @@ -2513,26 +2513,26 @@ AStarSearch( start, goal, team, greedy_path ) node = spawnstruct(); - 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.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.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.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; open HeapInsert( node ); - //while the queue is not empty + // while the queue is not empty while ( open.data.size ) { - //pop bestnode from queue + // pop bestnode from queue bestNode = open.data[ 0 ]; open HeapRemove(); openset[ bestNode.index + "" ] = undefined; 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 ) { path = []; @@ -2549,7 +2549,7 @@ AStarSearch( start, goal, team, greedy_path ) level.waypointusage[ team ][ bestNode.index + "" ]++; } - //construct path + // construct path path[ path.size ] = bestNode.index; bestNode = bestNode.parent; @@ -2558,7 +2558,7 @@ AStarSearch( start, goal, team, greedy_path ) return path; } - //for each child of bestnode + // for each child of bestnode for ( i = wp.children.size - 1; i >= 0; i-- ) { child = wp.children[ i ]; @@ -2572,7 +2572,7 @@ AStarSearch( start, goal, team, greedy_path ) 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 ) @@ -2587,10 +2587,10 @@ AStarSearch( start, goal, team, greedy_path ) penalty += 4; } - //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 + // 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 - //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 + "" ] ); if ( inopen && openset[ child + "" ].g <= newg ) @@ -2626,13 +2626,13 @@ AStarSearch( start, goal, team, greedy_path ) node.f = node.g + node.h; node.index = child; - //check if in closed, remove it + // check if in closed, remove it if ( inclosed ) { closed[ child + "" ] = undefined; } - //check if not in open, add it + // check if not in open, add it if ( !inopen ) { 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; } @@ -2728,7 +2728,7 @@ random_normal_distribution( mean, std_deviation, lower_bound, upper_bound ) */ Log( x ) { - //thanks Bob__ at stackoverflow + // thanks Bob__ at stackoverflow old_sum = 0.0; xmlxpl = ( x - 1 ) / ( x + 1 ); xmlxpl_2 = xmlxpl * xmlxpl;