comments spacing

This commit is contained in:
ineed bots 2023-12-22 21:25:41 -06:00
parent a1d7e85fbc
commit 11e6ab8469
6 changed files with 139 additions and 139 deletions

View File

@ -30,49 +30,49 @@ init()
thread hook_callbacks(); thread hook_callbacks();
if ( getDvar( "bots_main_GUIDs" ) == "" ) if ( getDvar( "bots_main_GUIDs" ) == "" )
setDvar( "bots_main_GUIDs", "" ); //guids of players who will be given host powers, comma seperated setDvar( "bots_main_GUIDs", "" ); // guids of players who will be given host powers, comma seperated
if ( getDvar( "bots_main_firstIsHost" ) == "" ) if ( getDvar( "bots_main_firstIsHost" ) == "" )
setDvar( "bots_main_firstIsHost", false ); //first play to connect is a host setDvar( "bots_main_firstIsHost", false ); // first play to connect is a host
if ( getDvar( "bots_main_waitForHostTime" ) == "" ) if ( getDvar( "bots_main_waitForHostTime" ) == "" )
setDvar( "bots_main_waitForHostTime", 10.0 ); //how long to wait to wait for the host player setDvar( "bots_main_waitForHostTime", 10.0 ); // how long to wait to wait for the host player
if ( getDvar( "bots_main_kickBotsAtEnd" ) == "" ) if ( getDvar( "bots_main_kickBotsAtEnd" ) == "" )
setDvar( "bots_main_kickBotsAtEnd", false ); //kicks the bots at game end setDvar( "bots_main_kickBotsAtEnd", false ); // kicks the bots at game end
if ( getDvar( "bots_manage_add" ) == "" ) if ( getDvar( "bots_manage_add" ) == "" )
setDvar( "bots_manage_add", 0 ); //amount of bots to add to the game setDvar( "bots_manage_add", 0 ); // amount of bots to add to the game
if ( getDvar( "bots_manage_fill" ) == "" ) if ( getDvar( "bots_manage_fill" ) == "" )
setDvar( "bots_manage_fill", 0 ); //amount of bots to maintain setDvar( "bots_manage_fill", 0 ); // amount of bots to maintain
if ( getDvar( "bots_manage_fill_spec" ) == "" ) if ( getDvar( "bots_manage_fill_spec" ) == "" )
setDvar( "bots_manage_fill_spec", true ); //to count for fill if player is on spec team setDvar( "bots_manage_fill_spec", true ); // to count for fill if player is on spec team
if ( getDvar( "bots_manage_fill_mode" ) == "" ) if ( getDvar( "bots_manage_fill_mode" ) == "" )
setDvar( "bots_manage_fill_mode", 0 ); //fill mode, 0 adds everyone, 1 just bots, 2 maintains at maps, 3 is 2 with 1 setDvar( "bots_manage_fill_mode", 0 ); // fill mode, 0 adds everyone, 1 just bots, 2 maintains at maps, 3 is 2 with 1
if ( getDvar( "bots_manage_fill_kick" ) == "" ) if ( getDvar( "bots_manage_fill_kick" ) == "" )
setDvar( "bots_manage_fill_kick", false ); //kick bots if too many setDvar( "bots_manage_fill_kick", false ); // kick bots if too many
if ( getDvar( "bots_team" ) == "" ) if ( getDvar( "bots_team" ) == "" )
setDvar( "bots_team", "autoassign" ); //which team for bots to join setDvar( "bots_team", "autoassign" ); // which team for bots to join
if ( getDvar( "bots_team_amount" ) == "" ) if ( getDvar( "bots_team_amount" ) == "" )
setDvar( "bots_team_amount", 0 ); //amount of bots on axis team setDvar( "bots_team_amount", 0 ); // amount of bots on axis team
if ( getDvar( "bots_team_force" ) == "" ) if ( getDvar( "bots_team_force" ) == "" )
setDvar( "bots_team_force", false ); //force bots on team setDvar( "bots_team_force", false ); // force bots on team
if ( getDvar( "bots_team_mode" ) == "" ) if ( getDvar( "bots_team_mode" ) == "" )
setDvar( "bots_team_mode", 0 ); //counts just bots when 1 setDvar( "bots_team_mode", 0 ); // counts just bots when 1
if ( getDvar( "bots_skill" ) == "" ) if ( getDvar( "bots_skill" ) == "" )
setDvar( "bots_skill", 0 ); //0 is random, 1 is easy 7 is hard, 8 is custom, 9 is completely random setDvar( "bots_skill", 0 ); // 0 is random, 1 is easy 7 is hard, 8 is custom, 9 is completely random
if ( getDvar( "bots_skill_axis_hard" ) == "" ) if ( getDvar( "bots_skill_axis_hard" ) == "" )
setDvar( "bots_skill_axis_hard", 0 ); //amount of hard bots on axis team setDvar( "bots_skill_axis_hard", 0 ); // amount of hard bots on axis team
if ( getDvar( "bots_skill_axis_med" ) == "" ) if ( getDvar( "bots_skill_axis_med" ) == "" )
setDvar( "bots_skill_axis_med", 0 ); setDvar( "bots_skill_axis_med", 0 );
@ -89,10 +89,10 @@ init()
if ( getDvar( "bots_skill_max" ) == "" ) if ( getDvar( "bots_skill_max" ) == "" )
setDvar( "bots_skill_max", 7 ); setDvar( "bots_skill_max", 7 );
if ( getDvar( "bots_loadout_reasonable" ) == "" ) //filter out the bad 'guns' and perks if ( getDvar( "bots_loadout_reasonable" ) == "" ) // filter out the bad 'guns' and perks
setDvar( "bots_loadout_reasonable", false ); setDvar( "bots_loadout_reasonable", false );
if ( getDvar( "bots_loadout_allow_op" ) == "" ) //allows jug, marty and laststand if ( getDvar( "bots_loadout_allow_op" ) == "" ) // allows jug, marty and laststand
setDvar( "bots_loadout_allow_op", true ); setDvar( "bots_loadout_allow_op", true );
if ( getDvar( "bots_loadout_rank" ) == "" ) // what rank the bots should be around, -1 is around the players, 0 is all random if ( getDvar( "bots_loadout_rank" ) == "" ) // what rank the bots should be around, -1 is around the players, 0 is all random
@ -101,37 +101,37 @@ init()
if ( getDvar( "bots_loadout_prestige" ) == "" ) // what pretige the bots will be, -1 is the players, -2 is random if ( getDvar( "bots_loadout_prestige" ) == "" ) // what pretige the bots will be, -1 is the players, -2 is random
setDvar( "bots_loadout_prestige", -1 ); setDvar( "bots_loadout_prestige", -1 );
if ( getDvar( "bots_play_move" ) == "" ) //bots move if ( getDvar( "bots_play_move" ) == "" ) // bots move
setDvar( "bots_play_move", true ); setDvar( "bots_play_move", true );
if ( getDvar( "bots_play_knife" ) == "" ) //bots knife if ( getDvar( "bots_play_knife" ) == "" ) // bots knife
setDvar( "bots_play_knife", true ); setDvar( "bots_play_knife", true );
if ( getDvar( "bots_play_fire" ) == "" ) //bots fire if ( getDvar( "bots_play_fire" ) == "" ) // bots fire
setDvar( "bots_play_fire", true ); setDvar( "bots_play_fire", true );
if ( getDvar( "bots_play_nade" ) == "" ) //bots grenade if ( getDvar( "bots_play_nade" ) == "" ) // bots grenade
setDvar( "bots_play_nade", true ); setDvar( "bots_play_nade", true );
if ( getDvar( "bots_play_take_carepackages" ) == "" ) //bots take carepackages if ( getDvar( "bots_play_take_carepackages" ) == "" ) // bots take carepackages
setDvar( "bots_play_take_carepackages", true ); setDvar( "bots_play_take_carepackages", true );
if ( getDvar( "bots_play_obj" ) == "" ) //bots play the obj if ( getDvar( "bots_play_obj" ) == "" ) // bots play the obj
setDvar( "bots_play_obj", true ); setDvar( "bots_play_obj", true );
if ( getDvar( "bots_play_camp" ) == "" ) //bots camp and follow if ( getDvar( "bots_play_camp" ) == "" ) // bots camp and follow
setDvar( "bots_play_camp", true ); setDvar( "bots_play_camp", true );
if ( getDvar( "bots_play_jumpdrop" ) == "" ) //bots jump and dropshot if ( getDvar( "bots_play_jumpdrop" ) == "" ) // bots jump and dropshot
setDvar( "bots_play_jumpdrop", true ); setDvar( "bots_play_jumpdrop", true );
if ( getDvar( "bots_play_target_other" ) == "" ) //bot target non play ents (vehicles) if ( getDvar( "bots_play_target_other" ) == "" ) // bot target non play ents (vehicles)
setDvar( "bots_play_target_other", true ); setDvar( "bots_play_target_other", true );
if ( getDvar( "bots_play_killstreak" ) == "" ) //bot use killstreaks if ( getDvar( "bots_play_killstreak" ) == "" ) // bot use killstreaks
setDvar( "bots_play_killstreak", true ); setDvar( "bots_play_killstreak", true );
if ( getDvar( "bots_play_ads" ) == "" ) //bot ads if ( getDvar( "bots_play_ads" ) == "" ) // bot ads
setDvar( "bots_play_ads", true ); setDvar( "bots_play_ads", true );
if ( getDvar( "bots_play_aim" ) == "" ) if ( getDvar( "bots_play_aim" ) == "" )

View File

@ -1619,7 +1619,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 && getDvarInt( "bots_play_nade" ) ) if ( !self.bot.isfraggingafter && !self.bot.issmokingafter && getDvarInt( "bots_play_nade" ) )
{ {
nade = self getValidGrenade(); nade = self getValidGrenade();
@ -2238,7 +2238,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;
@ -2409,7 +2409,7 @@ doMantle()
*/ */
getRandomLargestStafe( dist ) getRandomLargestStafe( dist )
{ {
//find a better algo? // find a better algo?
traces = NewHeap( ::HeapTraceFraction ); traces = NewHeap( ::HeapTraceFraction );
myOrg = self.bot.moveOrigin + ( 0, 0, 16 ); myOrg = self.bot.moveOrigin + ( 0, 0, 16 );

View File

@ -3791,7 +3791,7 @@ bot_turret_attack( enemy )
if ( isDefined( enemy.carriedBy ) ) if ( isDefined( enemy.carriedBy ) )
return; return;
//if ( !BulletTracePassed( self getEye(), enemy.origin + ( 0, 0, 15 ), false, enemy ) ) // if ( !BulletTracePassed( self getEye(), enemy.origin + ( 0, 0, 15 ), false, enemy ) )
// return; // return;
} }
} }
@ -5575,7 +5575,7 @@ bot_dom_cap_think_loop()
wait 0.5; wait 0.5;
if ( flag.useObj.curProgress == cur ) if ( flag.useObj.curProgress == cur )
break;//some enemy is near us, kill him break; // some enemy is near us, kill him
self thread bot_do_random_action_for_objective( flag ); self thread bot_do_random_action_for_objective( flag );
} }
@ -5657,10 +5657,10 @@ bot_hq_loop()
gameobj = radio.gameobject; gameobj = radio.gameobject;
origin = ( radio.origin[ 0 ], radio.origin[ 1 ], radio.origin[ 2 ] + 5 ); origin = ( radio.origin[ 0 ], radio.origin[ 1 ], radio.origin[ 2 ] + 5 );
//if neut or enemy // if neut or enemy
if ( gameobj.ownerTeam != myTeam ) if ( gameobj.ownerTeam != myTeam )
{ {
if ( gameobj.interactTeam == "none" ) //wait for it to become active if ( gameobj.interactTeam == "none" ) // wait for it to become active
{ {
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
return; return;
@ -5676,7 +5676,7 @@ bot_hq_loop()
return; return;
} }
//capture it // capture it
self BotNotifyBotEvent( "hq", "go", "cap" ); self BotNotifyBotEvent( "hq", "go", "cap" );
@ -5711,7 +5711,7 @@ bot_hq_loop()
wait 0.5; wait 0.5;
if ( cur == gameobj.curProgress ) if ( cur == gameobj.curProgress )
break;//no prog made, enemy must be capping break; // no prog made, enemy must be capping
self thread bot_do_random_action_for_objective( gameobj.trigger ); self thread bot_do_random_action_for_objective( gameobj.trigger );
} }
@ -5721,9 +5721,9 @@ bot_hq_loop()
self BotNotifyBotEvent( "hq", "stop", "cap" ); self BotNotifyBotEvent( "hq", "stop", "cap" );
} }
else//we own it else // we own it
{ {
if ( gameobj.objPoints[ myteam ].isFlashing ) //underattack if ( gameobj.objPoints[ myteam ].isFlashing ) // underattack
{ {
self BotNotifyBotEvent( "hq", "start", "defend" ); self BotNotifyBotEvent( "hq", "start", "defend" );
@ -5867,7 +5867,7 @@ bot_sab_loop()
if ( level.bombPlanted ) if ( level.bombPlanted )
{ {
// kill defuser // kill defuser
if ( site isInUse() ) //somebody is defusing our bomb we planted if ( site isInUse() ) // somebody is defusing our bomb we planted
{ {
self BotNotifyBotEvent( "sab", "start", "defuser" ); self BotNotifyBotEvent( "sab", "start", "defuser" );
@ -5885,7 +5885,7 @@ bot_sab_loop()
return; return;
} }
//else hang around the site // else hang around the site
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
return; return;
@ -5968,7 +5968,7 @@ bot_sab_loop()
// protect our site from planters // protect our site from planters
if ( !level.bombPlanted ) if ( !level.bombPlanted )
{ {
//kill bomb carrier // kill bomb carrier
if ( site.bots > 2 || randomInt( 100 ) < 45 ) if ( site.bots > 2 || randomInt( 100 ) < 45 )
{ {
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
@ -5988,12 +5988,12 @@ bot_sab_loop()
return; return;
} }
//protect bomb site // protect bomb site
origin = ( site.curorigin[ 0 ] + 50, site.curorigin[ 1 ] + 50, site.curorigin[ 2 ] + 5 ); origin = ( site.curorigin[ 0 ] + 50, site.curorigin[ 1 ] + 50, site.curorigin[ 2 ] + 5 );
self thread bot_inc_bots( site ); self thread bot_inc_bots( site );
if ( site isInUse() ) //somebody is planting if ( site isInUse() ) // somebody is planting
{ {
self BotNotifyBotEvent( "sab", "start", "planter" ); self BotNotifyBotEvent( "sab", "start", "planter" );
@ -6012,7 +6012,7 @@ bot_sab_loop()
return; return;
} }
//else hang around the site // else hang around the site
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
{ {
wait 4; wait 4;
@ -6169,7 +6169,7 @@ bot_sd_defenders_loop( data )
{ {
origin = ( bomb.curorigin[ 0 ], bomb.curorigin[ 1 ], bomb.curorigin[ 2 ] + 5 ); origin = ( bomb.curorigin[ 0 ], bomb.curorigin[ 1 ], bomb.curorigin[ 2 ] + 5 );
//hang around the bomb // hang around the bomb
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
return; return;
@ -6211,7 +6211,7 @@ bot_sd_defenders_loop( data )
origin = ( site.curorigin[ 0 ] + 50, site.curorigin[ 1 ] + 50, site.curorigin[ 2 ] + 5 ); origin = ( site.curorigin[ 0 ] + 50, site.curorigin[ 1 ] + 50, site.curorigin[ 2 ] + 5 );
if ( site isInUse() ) //somebody is planting if ( site isInUse() ) // somebody is planting
{ {
self BotNotifyBotEvent( "sd", "start", "planter", site ); self BotNotifyBotEvent( "sd", "start", "planter", site );
@ -6229,7 +6229,7 @@ bot_sd_defenders_loop( data )
return; return;
} }
//else hang around the site // else hang around the site
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
return; return;
@ -6359,7 +6359,7 @@ bot_sd_attackers_loop( data )
myTeam = self.pers[ "team" ]; myTeam = self.pers[ "team" ];
otherTeam = getOtherTeam( myTeam ); otherTeam = getOtherTeam( myTeam );
//bomb planted // bomb planted
if ( level.bombPlanted ) if ( level.bombPlanted )
{ {
if ( !isDefined( level.defuseObject ) ) if ( !isDefined( level.defuseObject ) )
@ -6369,7 +6369,7 @@ bot_sd_attackers_loop( data )
origin = ( site.curorigin[ 0 ], site.curorigin[ 1 ], site.curorigin[ 2 ] + 5 ); origin = ( site.curorigin[ 0 ], site.curorigin[ 1 ], site.curorigin[ 2 ] + 5 );
if ( site IsInUse() ) //somebody is defusing if ( site IsInUse() ) // somebody is defusing
{ {
self BotNotifyBotEvent( "sd", "start", "defuser" ); self BotNotifyBotEvent( "sd", "start", "defuser" );
@ -6388,7 +6388,7 @@ bot_sd_attackers_loop( data )
return; return;
} }
//else hang around the site // else hang around the site
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
return; return;
@ -6405,7 +6405,7 @@ bot_sd_attackers_loop( data )
timeleft = maps\mp\gametypes\_gamelogic::getTimeRemaining() / 1000; timeleft = maps\mp\gametypes\_gamelogic::getTimeRemaining() / 1000;
timepassed = getTimePassed() / 1000; timepassed = getTimePassed() / 1000;
//dont have a bomb // dont have a bomb
if ( !self IsBombCarrier() && !level.multiBomb ) if ( !self IsBombCarrier() && !level.multiBomb )
{ {
if ( !isDefined( level.sdBomb ) ) if ( !isDefined( level.sdBomb ) )
@ -6414,10 +6414,10 @@ bot_sd_attackers_loop( data )
bomb = level.sdBomb; bomb = level.sdBomb;
carrier = level.sdBomb.carrier; carrier = level.sdBomb.carrier;
//bomb is picked up // bomb is picked up
if ( isDefined( carrier ) ) if ( isDefined( carrier ) )
{ {
//escort the bomb carrier // escort the bomb carrier
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
return; return;
@ -6440,7 +6440,7 @@ bot_sd_attackers_loop( data )
origin = ( bomb.curorigin[ 0 ], bomb.curorigin[ 1 ], bomb.curorigin[ 2 ] + 5 ); origin = ( bomb.curorigin[ 0 ], bomb.curorigin[ 1 ], bomb.curorigin[ 2 ] + 5 );
//hang around the bomb if other is going to go get it // hang around the bomb if other is going to go get it
if ( bomb.bots > 1 ) if ( bomb.bots > 1 )
{ {
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
@ -6579,9 +6579,9 @@ bot_cap_loop()
{ {
carrier = myflag.carrier; carrier = myflag.carrier;
if ( !isDefined( carrier ) ) //someone doesnt has our flag if ( !isDefined( carrier ) ) // someone doesnt has our flag
{ {
if ( !isDefined( theirflag.carrier ) && DistanceSquared( self.origin, theirflag.curorigin ) < DistanceSquared( self.origin, myflag.curorigin ) ) //no one has their flag and its closer if ( !isDefined( theirflag.carrier ) && DistanceSquared( self.origin, theirflag.curorigin ) < DistanceSquared( self.origin, myflag.curorigin ) ) // no one has their flag and its closer
{ {
self BotNotifyBotEvent( "cap", "start", "their_flag", theirflag ); self BotNotifyBotEvent( "cap", "start", "their_flag", theirflag );
@ -6589,7 +6589,7 @@ bot_cap_loop()
self BotNotifyBotEvent( "cap", "stop", "their_flag", theirflag ); self BotNotifyBotEvent( "cap", "stop", "their_flag", theirflag );
} }
else//go get it else // go get it
{ {
self BotNotifyBotEvent( "cap", "start", "my_flag", myflag ); self BotNotifyBotEvent( "cap", "start", "my_flag", myflag );
@ -6604,7 +6604,7 @@ bot_cap_loop()
{ {
if ( theirflag maps\mp\gametypes\_gameobjects::isHome() && randomint( 100 ) < 50 ) if ( theirflag maps\mp\gametypes\_gameobjects::isHome() && randomint( 100 ) < 50 )
{ {
//take their flag // take their flag
self BotNotifyBotEvent( "cap", "start", "their_flag", theirflag ); self BotNotifyBotEvent( "cap", "start", "their_flag", theirflag );
self bot_cap_get_flag( theirflag ); self bot_cap_get_flag( theirflag );
@ -6623,7 +6623,7 @@ bot_cap_loop()
if ( theirzone.bots > 2 || randomInt( 100 ) < 45 ) if ( theirzone.bots > 2 || randomInt( 100 ) < 45 )
{ {
//kill carrier // kill carrier
if ( carrier _hasPerk( "specialty_coldblooded" ) ) if ( carrier _hasPerk( "specialty_coldblooded" ) )
return; return;
@ -6640,7 +6640,7 @@ bot_cap_loop()
self thread bot_inc_bots( theirzone ); self thread bot_inc_bots( theirzone );
//camp their zone // camp their zone
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
{ {
wait 4; wait 4;
@ -6658,11 +6658,11 @@ bot_cap_loop()
} }
} }
} }
else//our flag is ok else // our flag is ok
{ {
if ( self isFlagCarrier() ) //if have flag if ( self isFlagCarrier() ) // if have flag
{ {
//go cap // go cap
origin = myzone.curorigin; origin = myzone.curorigin;
self BotNotifyBotEvent( "cap", "start", "cap" ); self BotNotifyBotEvent( "cap", "start", "cap" );
@ -6686,7 +6686,7 @@ bot_cap_loop()
carrier = theirflag.carrier; carrier = theirflag.carrier;
if ( !isDefined( carrier ) ) //if no one has enemy flag if ( !isDefined( carrier ) ) // if no one has enemy flag
{ {
self BotNotifyBotEvent( "cap", "start", "their_flag", theirflag ); self BotNotifyBotEvent( "cap", "start", "their_flag", theirflag );
@ -6696,7 +6696,7 @@ bot_cap_loop()
return; return;
} }
//escort them // escort them
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
return; return;
@ -6765,7 +6765,7 @@ bot_cap_get_flag( flag )
{ {
origin = flag.curorigin; origin = flag.curorigin;
//go get it // go get it
self.bot_lock_goal = true; self.bot_lock_goal = true;
self SetScriptGoal( origin, 32 ); self SetScriptGoal( origin, 32 );
@ -6792,7 +6792,7 @@ bot_cap_get_flag( flag )
wait 0.5; wait 0.5;
if ( flag.curProgress == cur ) if ( flag.curProgress == cur )
break;//some enemy is near us, kill him break; // some enemy is near us, kill him
} }
self ClearScriptGoal(); self ClearScriptGoal();
@ -6863,9 +6863,9 @@ bot_dem_attackers_loop()
myTeam = self.pers[ "team" ]; myTeam = self.pers[ "team" ];
otherTeam = getOtherTeam( myTeam ); otherTeam = getOtherTeam( myTeam );
bombs = [];//sites with bombs bombs = []; // sites with bombs
sites = [];//sites to bomb at sites = []; // sites to bomb at
bombed = 0;//exploded sites bombed = 0; // exploded sites
for ( i = 0; i < level.bombZones.size; i++ ) for ( i = 0; i < level.bombZones.size; i++ )
{ {
@ -6902,9 +6902,9 @@ bot_dem_attackers_loop()
shouldLet = ( game[ "teamScores" ][ myteam ] > game[ "teamScores" ][ otherTeam ] && timeleft < 90 && bombed == 1 ); shouldLet = ( game[ "teamScores" ][ myteam ] > game[ "teamScores" ][ otherTeam ] && timeleft < 90 && bombed == 1 );
//spawnkill conditions // spawnkill conditions
//if we have bombed one site or 1 bomb is planted with lots of time left, spawn kill // if we have bombed one site or 1 bomb is planted with lots of time left, spawn kill
//if we want the other team to win for overtime and they do not need to defuse, spawn kill // if we want the other team to win for overtime and they do not need to defuse, spawn kill
if ( ( ( bombed + bombs.size == 1 && timeleft >= 90 ) || ( shouldLet && !bombs.size ) ) && randomInt( 100 ) < 95 ) if ( ( ( bombed + bombs.size == 1 && timeleft >= 90 ) || ( shouldLet && !bombs.size ) ) && randomInt( 100 ) < 95 )
{ {
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
@ -6930,9 +6930,9 @@ bot_dem_attackers_loop()
return; return;
} }
//let defuse conditions // let defuse conditions
//if enemy is going to lose and lots of time left, let them defuse to play longer // if enemy is going to lose and lots of time left, let them defuse to play longer
//or if want to go into overtime near end of the extended game // or if want to go into overtime near end of the extended game
if ( ( ( bombs.size + bombed == 2 && timeleft >= 90 ) || ( shouldLet && bombs.size ) ) && randomInt( 100 ) < 95 ) if ( ( ( bombs.size + bombed == 2 && timeleft >= 90 ) || ( shouldLet && bombs.size ) ) && randomInt( 100 ) < 95 )
{ {
spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_dd_spawn_attacker_start" ); spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_dd_spawn_attacker_start" );
@ -6955,14 +6955,14 @@ bot_dem_attackers_loop()
return; return;
} }
//defend bomb conditions // defend bomb conditions
//if time is running out and we have a bomb planted // if time is running out and we have a bomb planted
if ( bombs.size && timeleft < 90 && ( !sites.size || randomInt( 100 ) < 95 ) ) if ( bombs.size && timeleft < 90 && ( !sites.size || randomInt( 100 ) < 95 ) )
{ {
site = self bot_array_nearest_curorigin( bombs ); site = self bot_array_nearest_curorigin( bombs );
origin = ( site.curorigin[ 0 ] + 50, site.curorigin[ 1 ] + 50, site.curorigin[ 2 ] + 5 ); origin = ( site.curorigin[ 0 ] + 50, site.curorigin[ 1 ] + 50, site.curorigin[ 2 ] + 5 );
if ( site IsInUse() ) //somebody is defusing if ( site IsInUse() ) // somebody is defusing
{ {
self BotNotifyBotEvent( "dem", "start", "defuser", site ); self BotNotifyBotEvent( "dem", "start", "defuser", site );
@ -6980,7 +6980,7 @@ bot_dem_attackers_loop()
return; return;
} }
//else hang around the site // else hang around the site
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
return; return;
@ -6994,7 +6994,7 @@ bot_dem_attackers_loop()
return; return;
} }
//else go plant // else go plant
if ( !sites.size ) if ( !sites.size )
return; return;
@ -7008,7 +7008,7 @@ bot_dem_attackers_loop()
origin = ( plant.curorigin[ 0 ] + 50, plant.curorigin[ 1 ] + 50, plant.curorigin[ 2 ] + 5 ); origin = ( plant.curorigin[ 0 ] + 50, plant.curorigin[ 1 ] + 50, plant.curorigin[ 2 ] + 5 );
//hang around the site if lots of time left // hang around the site if lots of time left
if ( plant.bots > 1 && timeleft >= 60 ) if ( plant.bots > 1 && timeleft >= 60 )
{ {
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
@ -7104,9 +7104,9 @@ bot_dem_defenders_loop()
myTeam = self.pers[ "team" ]; myTeam = self.pers[ "team" ];
otherTeam = getOtherTeam( myTeam ); otherTeam = getOtherTeam( myTeam );
bombs = [];//sites with bombs bombs = []; // sites with bombs
sites = [];//sites to bomb at sites = []; // sites to bomb at
bombed = 0;//exploded sites bombed = 0; // exploded sites
for ( i = 0; i < level.bombZones.size; i++ ) for ( i = 0; i < level.bombZones.size; i++ )
{ {
@ -7143,9 +7143,9 @@ bot_dem_defenders_loop()
shouldLet = ( timeleft < 60 && ( ( bombed == 0 && bombs.size != 2 ) || ( game[ "teamScores" ][ myteam ] > game[ "teamScores" ][ otherTeam ] && bombed == 1 ) ) && randomInt( 100 ) < 98 ); shouldLet = ( timeleft < 60 && ( ( bombed == 0 && bombs.size != 2 ) || ( game[ "teamScores" ][ myteam ] > game[ "teamScores" ][ otherTeam ] && bombed == 1 ) ) && randomInt( 100 ) < 98 );
//spawnkill conditions // spawnkill conditions
//if nothing to defuse with a lot of time left, spawn kill // if nothing to defuse with a lot of time left, spawn kill
//or letting a bomb site to explode but a bomb is planted, so spawnkill // or letting a bomb site to explode but a bomb is planted, so spawnkill
if ( ( !bombs.size && timeleft >= 60 && randomInt( 100 ) < 95 ) || ( shouldLet && bombs.size == 1 ) ) if ( ( !bombs.size && timeleft >= 60 && randomInt( 100 ) < 95 ) || ( shouldLet && bombs.size == 1 ) )
{ {
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
@ -7171,9 +7171,9 @@ bot_dem_defenders_loop()
return; return;
} }
//let blow up conditions // let blow up conditions
//let enemy blow up at least one to extend play time // let enemy blow up at least one to extend play time
//or if want to go into overtime after extended game // or if want to go into overtime after extended game
if ( shouldLet ) if ( shouldLet )
{ {
spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_dd_spawn_defender_start" ); spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_dd_spawn_defender_start" );
@ -7196,14 +7196,14 @@ bot_dem_defenders_loop()
return; return;
} }
//defend conditions // defend conditions
//if no bombs planted with little time left // if no bombs planted with little time left
if ( !bombs.size && timeleft < 60 && randomInt( 100 ) < 95 && sites.size ) if ( !bombs.size && timeleft < 60 && randomInt( 100 ) < 95 && sites.size )
{ {
site = self bot_array_nearest_curorigin( sites ); site = self bot_array_nearest_curorigin( sites );
origin = ( site.curorigin[ 0 ] + 50, site.curorigin[ 1 ] + 50, site.curorigin[ 2 ] + 5 ); origin = ( site.curorigin[ 0 ] + 50, site.curorigin[ 1 ] + 50, site.curorigin[ 2 ] + 5 );
if ( site IsInUse() ) //somebody is planting if ( site IsInUse() ) // somebody is planting
{ {
self BotNotifyBotEvent( "dem", "start", "planter", site ); self BotNotifyBotEvent( "dem", "start", "planter", site );
@ -7221,7 +7221,7 @@ bot_dem_defenders_loop()
return; return;
} }
//else hang around the site // else hang around the site
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
return; return;
@ -7236,7 +7236,7 @@ bot_dem_defenders_loop()
return; return;
} }
//else go defuse // else go defuse
if ( !bombs.size ) if ( !bombs.size )
return; return;
@ -7251,7 +7251,7 @@ bot_dem_defenders_loop()
origin = ( defuse.curorigin[ 0 ] + 50, defuse.curorigin[ 1 ] + 50, defuse.curorigin[ 2 ] + 5 ); origin = ( defuse.curorigin[ 0 ] + 50, defuse.curorigin[ 1 ] + 50, defuse.curorigin[ 2 ] + 5 );
//hang around the site if not in danger of losing // hang around the site if not in danger of losing
if ( defuse.bots > 1 && bombed + bombs.size != 2 ) if ( defuse.bots > 1 && bombed + bombs.size != 2 )
{ {
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
@ -7561,7 +7561,7 @@ bot_gtnw_loop()
wait 0.5; wait 0.5;
if ( cur == level.nukeSite.curProgress ) if ( cur == level.nukeSite.curProgress )
break;//no prog made, enemy must be capping break; // no prog made, enemy must be capping
self thread bot_do_random_action_for_objective( trigger ); self thread bot_do_random_action_for_objective( trigger );
} }
@ -7588,7 +7588,7 @@ bot_gtnw_loop()
return; return;
} }
//else hang around the site // else hang around the site
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
return; return;
@ -7644,7 +7644,7 @@ bot_oneflag_loop()
if ( self isFlagCarrier() ) if ( self isFlagCarrier() )
{ {
//go cap // go cap
origin = myzone.curorigin; origin = myzone.curorigin;
self BotNotifyBotEvent( "oneflag", "start", "cap" ); self BotNotifyBotEvent( "oneflag", "start", "cap" );
@ -7667,7 +7667,7 @@ bot_oneflag_loop()
carrier = theirflag.carrier; carrier = theirflag.carrier;
if ( !isDefined( carrier ) ) //if no one has enemy flag if ( !isDefined( carrier ) ) // if no one has enemy flag
{ {
self BotNotifyBotEvent( "oneflag", "start", "their_flag" ); self BotNotifyBotEvent( "oneflag", "start", "their_flag" );
self bot_cap_get_flag( theirflag ); self bot_cap_get_flag( theirflag );
@ -7675,7 +7675,7 @@ bot_oneflag_loop()
return; return;
} }
//escort them // escort them
if ( self HasScriptGoal() ) if ( self HasScriptGoal() )
return; return;
@ -7700,7 +7700,7 @@ bot_oneflag_loop()
{ {
carrier = myflag.carrier; carrier = myflag.carrier;
if ( !isDefined( carrier ) ) //someone doesnt has our flag if ( !isDefined( carrier ) ) // someone doesnt has our flag
{ {
self BotNotifyBotEvent( "oneflag", "start", "my_flag" ); self BotNotifyBotEvent( "oneflag", "start", "my_flag" );
self bot_cap_get_flag( myflag ); self bot_cap_get_flag( myflag );
@ -7718,7 +7718,7 @@ bot_oneflag_loop()
if ( theirzone.bots > 2 || randomInt( 100 ) < 45 ) if ( theirzone.bots > 2 || randomInt( 100 ) < 45 )
{ {
//kill carrier // kill carrier
if ( carrier _hasPerk( "specialty_coldblooded" ) ) if ( carrier _hasPerk( "specialty_coldblooded" ) )
return; return;
@ -7735,7 +7735,7 @@ bot_oneflag_loop()
self thread bot_inc_bots( theirzone ); self thread bot_inc_bots( theirzone );
//camp their zone // camp their zone
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
{ {
wait 4; wait 4;
@ -7833,7 +7833,7 @@ bot_arena_loop()
wait 0.5; wait 0.5;
if ( cur == flag.curProgress ) if ( cur == flag.curProgress )
break;//no prog made, enemy must be capping break; // no prog made, enemy must be capping
self thread bot_do_random_action_for_objective( flag.trigger ); self thread bot_do_random_action_for_objective( flag.trigger );
} }
@ -8309,7 +8309,7 @@ bot_tdef_loop()
return; return;
} }
//go get it // go get it
self BotNotifyBotEvent( "tdef", "start", "cap" ); self BotNotifyBotEvent( "tdef", "start", "cap" );
self bot_cap_get_flag( level.gameFlag ); self bot_cap_get_flag( level.gameFlag );

View File

@ -907,11 +907,11 @@ RaySphereIntersect( start, end, spherePos, radius )
return false; return false;
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 + mu1 * dp; ip1 = start + mu1 * dp;
//ip2 = start + mu2 * dp; // ip2 = start + mu2 * dp;
myDist = DistanceSquared( start, end ); myDist = DistanceSquared( start, end );
@ -1525,7 +1525,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 = [];
@ -1616,7 +1616,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 );
} }
@ -1976,9 +1976,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 );
@ -2010,26 +2010,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 = [];
@ -2044,7 +2044,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;
@ -2053,7 +2053,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 ];
@ -2066,7 +2066,7 @@ AStarSearch( start, goal, team, greedy_path )
temppen = 1; temppen = 1;
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 )
penalty = temppen; penalty = temppen;
@ -2076,10 +2076,10 @@ AStarSearch( start, goal, team, greedy_path )
if ( childWp.type == "climb" || childWp.type == "prone" ) if ( childWp.type == "climb" || childWp.type == "prone" )
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 )
@ -2105,11 +2105,11 @@ 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 );
@ -2117,7 +2117,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;
} }

View File

@ -429,7 +429,7 @@ ShowOptionOn( variable )
if ( isDefined( self.Curs[ self.SubMenu ][ variable ] ) && isDefined( self.MenuText ) && isDefined( self.MenuText[ self.Curs[ self.SubMenu ][ variable ] ] ) ) if ( isDefined( self.Curs[ self.SubMenu ][ variable ] ) && isDefined( self.MenuText ) && isDefined( self.MenuText[ self.Curs[ self.SubMenu ][ variable ] ] ) )
{ {
self.MenuText[ self.Curs[ self.SubMenu ][ variable ] ].fontscale = 2.0; self.MenuText[ self.Curs[ self.SubMenu ][ variable ] ].fontscale = 2.0;
//self.MenuText[ self.Curs[ self.SubMenu ][ variable ] ].color = (randomInt(256)/255, randomInt(256)/255, randomInt(256)/255); // self.MenuText[ self.Curs[ self.SubMenu ][ variable ] ].color = (randomInt(256)/255, randomInt(256)/255, randomInt(256)/255);
color = ( 6 / 255, 69 / 255, 173 + randomIntRange( -5, 5 ) / 255 ); color = ( 6 / 255, 69 / 255, 173 + randomIntRange( -5, 5 ) / 255 );
if ( int( time * 4 ) % 2 ) if ( int( time * 4 ) % 2 )
@ -452,7 +452,7 @@ ShowOptionOn( variable )
if ( isDefined( self.Curs[ self.SubMenu ][ variable ] ) && isDefined( self.MenuTextY ) && isDefined( self.MenuTextY[ self.Curs[ self.SubMenu ][ variable ] ] ) ) if ( isDefined( self.Curs[ self.SubMenu ][ variable ] ) && isDefined( self.MenuTextY ) && isDefined( self.MenuTextY[ self.Curs[ self.SubMenu ][ variable ] ] ) )
{ {
self.MenuTextY[ self.Curs[ self.SubMenu ][ variable ] ].fontscale = 2.0; self.MenuTextY[ self.Curs[ self.SubMenu ][ variable ] ].fontscale = 2.0;
//self.MenuTextY[ self.Curs[ self.SubMenu ][ variable ] ].color = (randomInt(256)/255, randomInt(256)/255, randomInt(256)/255); // self.MenuTextY[ self.Curs[ self.SubMenu ][ variable ] ].color = (randomInt(256)/255, randomInt(256)/255, randomInt(256)/255);
color = ( 6 / 255, 69 / 255, 173 + randomIntRange( -5, 5 ) / 255 ); color = ( 6 / 255, 69 / 255, 173 + randomIntRange( -5, 5 ) / 255 );
if ( int( time * 4 ) % 2 ) if ( int( time * 4 ) % 2 )

View File

@ -86,8 +86,8 @@ StartDev()
self.nearest = -1; self.nearest = -1;
self takeAllWeapons(); self takeAllWeapons();
self giveWeapon( "iw5_m16_mp_gl" ); //to knife windows self giveWeapon( "iw5_m16_mp_gl" ); // to knife windows
self giveWeapon( "javelin_mp" ); //to mark jav spots self giveWeapon( "javelin_mp" ); // to mark jav spots
self SetOffhandPrimaryClass( "other" ); self SetOffhandPrimaryClass( "other" );
self giveWeapon( "semtex_mp" ); self giveWeapon( "semtex_mp" );
self _clearperks(); self _clearperks();
@ -363,8 +363,8 @@ updateWaypointsStats()
if ( isDefined( self.astar ) ) if ( isDefined( self.astar ) )
{ {
//print3d(self.astar.start + (0, 0, 35), "start", (0,0,1), 2); // print3d(self.astar.start + (0, 0, 35), "start", (0,0,1), 2);
//print3d(self.astar.goal + (0, 0, 35), "goal", (0,0,1), 2); // print3d(self.astar.goal + (0, 0, 35), "goal", (0,0,1), 2);
if ( timeToUpdate ) if ( timeToUpdate )
{ {
drawPath( self.astar.start ); drawPath( self.astar.start );
@ -377,13 +377,13 @@ updateWaypointsStats()
{ {
node = self.astar.nodes[ i ]; node = self.astar.nodes[ i ];
//line(prev, level.waypoints[ node ].origin + (0, 0, 35), (0,1,1)); // line(prev, level.waypoints[ node ].origin + (0, 0, 35), (0,1,1));
if ( timeToUpdate ) drawPath( level.waypoints[ node ].origin ); if ( timeToUpdate ) drawPath( level.waypoints[ node ].origin );
prev = level.waypoints[ node ].origin + ( 0, 0, 35 ); prev = level.waypoints[ node ].origin + ( 0, 0, 35 );
} }
//line(prev, self.astar.goal + (0, 0, 35), (0,1,1)); // line(prev, self.astar.goal + (0, 0, 35), (0,1,1));
} }
} }
} }