This commit is contained in:
ineed bots 2024-01-04 16:05:38 -06:00
parent 8acd9a282e
commit 541b0832e3
10 changed files with 2808 additions and 2802 deletions

View File

@ -1,21 +1,27 @@
# try to mimic the original gsc provided # try to mimic the original gsc provided
# mode=ghc
mode=c mode=c
style=allman style=allman
indent=tab indent=force-tab=2
lineend=windows lineend=windows
pad-oper pad-oper
pad-paren-in pad-paren-in
pad-header pad-header
# pad-brackets-in
# delete-empty-lines fill-empty-lines
squeeze-lines=2
squeeze-ws
break-one-line-headers
add-braces
remove-comment-prefix
break-blocks break-blocks
# remove-braces
indent-switches indent-switches
indent-cases indent-cases
indent-after-parens indent-after-parens
indent-col1-comments
remove-comment-prefix remove-comment-prefix

View File

@ -4,7 +4,7 @@ root = true
indent_style = tab indent_style = tab
indent_size = 2 indent_size = 2
charset = latin1 charset = latin1
trim_trailing_whitespace = true trim_trailing_whitespace = false
insert_final_newline = true insert_final_newline = true
[*.md] [*.md]

View File

@ -31,77 +31,77 @@ init()
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", true ); // first player to connect is a host setdvar( "bots_main_firstIsHost", true ); // first player 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" ) == "" )

View File

@ -942,7 +942,7 @@ bot_chat_killed_watch( victim )
break; break;
case 5: case 5:
message = ( "^" + ( randomint( 6 ) + 1 ) + "LOL " + victim.name + ", l2play" ); message = ( "^" + ( randomint( 6 ) + 1 ) + "LOL " + victim.name + ", l2play" );
break; break;
case 6: case 6:
@ -1124,7 +1124,7 @@ bot_chat_death_watch( killer, last_ks )
break; break;
case 3: case 3:
message = ( "^" + ( randomint( 6 ) + 1 ) + "How the?? How did you do that " + killer.name + "?" ); message = ( "^" + ( randomint( 6 ) + 1 ) + "How the?? How did you do that " + killer.name + "?" );
break; break;
case 4: case 4:

View File

@ -364,8 +364,8 @@ doBotMovement_loop( data )
// rotate our direction according to our angles // rotate our direction according to our angles
dir = ( dir[ 0 ] * cosa - dir[ 1 ] * sina, dir = ( dir[ 0 ] * cosa - dir[ 1 ] * sina,
dir[ 0 ] * sina + dir[ 1 ] * cosa, dir[ 0 ] * sina + dir[ 1 ] * cosa,
0 ); 0 );
// make the length 127 // make the length 127
dir = vectornormalize( dir ) * 127; dir = vectornormalize( dir ) * 127;
@ -954,8 +954,8 @@ updateAimOffset( obj )
if ( diffAimAmount > 0 ) if ( diffAimAmount > 0 )
{ {
obj.aim_offset_base = ( randomfloatrange( 0 - diffAimAmount, diffAimAmount ), obj.aim_offset_base = ( randomfloatrange( 0 - diffAimAmount, diffAimAmount ),
randomfloatrange( 0 - diffAimAmount, diffAimAmount ), randomfloatrange( 0 - diffAimAmount, diffAimAmount ),
randomfloatrange( 0 - diffAimAmount, diffAimAmount ) ); randomfloatrange( 0 - diffAimAmount, diffAimAmount ) );
} }
else else
{ {
@ -1144,18 +1144,18 @@ target_loop()
traceAnkleRight = bullettrace( myEye, targetAnkleRight, false, undefined ); traceAnkleRight = bullettrace( myEye, targetAnkleRight, false, undefined );
canTargetPlayer = ( ( sighttracepassed( myEye, targetHead, false, undefined ) || canTargetPlayer = ( ( sighttracepassed( myEye, targetHead, false, undefined ) ||
sighttracepassed( myEye, targetAnkleLeft, false, undefined ) || sighttracepassed( myEye, targetAnkleLeft, false, undefined ) ||
sighttracepassed( myEye, targetAnkleRight, false, undefined ) ) sighttracepassed( myEye, targetAnkleRight, false, undefined ) )
&& ( ( traceHead[ "fraction" ] >= 1.0 || traceHead[ "surfacetype" ] == "glass" ) || && ( ( traceHead[ "fraction" ] >= 1.0 || traceHead[ "surfacetype" ] == "glass" ) ||
( traceAnkleLeft[ "fraction" ] >= 1.0 || traceAnkleLeft[ "surfacetype" ] == "glass" ) || ( traceAnkleLeft[ "fraction" ] >= 1.0 || traceAnkleLeft[ "surfacetype" ] == "glass" ) ||
( traceAnkleRight[ "fraction" ] >= 1.0 || traceAnkleRight[ "surfacetype" ] == "glass" ) ) ( traceAnkleRight[ "fraction" ] >= 1.0 || traceAnkleRight[ "surfacetype" ] == "glass" ) )
&& ( SmokeTrace( myEye, player.origin, level.smokeradius ) || && ( SmokeTrace( myEye, player.origin, level.smokeradius ) ||
daDist < level.bots_maxknifedistance * 4 ) daDist < level.bots_maxknifedistance * 4 )
&& ( getConeDot( player.origin, self.origin, myAngles ) >= myFov || && ( getConeDot( player.origin, self.origin, myAngles ) >= myFov ||
( isObjDef && obj.trace_time ) ) ); ( isObjDef && obj.trace_time ) ) );
if ( isdefined( self.bot.target_this_frame ) && self.bot.target_this_frame == player ) if ( isdefined( self.bot.target_this_frame ) && self.bot.target_this_frame == player )
{ {
@ -1506,7 +1506,7 @@ aim_loop()
{ {
nadeAimOffset = dist / 3000; nadeAimOffset = dist / 3000;
} }
else if ( curweap != "none" && weaponclass( curweap ) == "grenade" ) else if ( curweap != "none" && weaponclass( curweap ) == "grenade" )
{ {
if ( maps\mp\gametypes\_missions::getweaponclass( curweap ) == "weapon_projectile" ) if ( maps\mp\gametypes\_missions::getweaponclass( curweap ) == "weapon_projectile" )
{ {
@ -1678,7 +1678,7 @@ aim_loop()
{ {
nadeAimOffset = dist / 3000; nadeAimOffset = dist / 3000;
} }
else if ( curweap != "none" && weaponclass( curweap ) == "grenade" ) else if ( curweap != "none" && weaponclass( curweap ) == "grenade" )
{ {
if ( maps\mp\gametypes\_missions::getweaponclass( curweap ) == "weapon_projectile" ) if ( maps\mp\gametypes\_missions::getweaponclass( curweap ) == "weapon_projectile" )
{ {

View File

@ -3825,7 +3825,7 @@ bot_dom_cap_think_loop()
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 );
@ -3985,7 +3985,7 @@ bot_hq_loop()
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 );

View File

@ -2088,7 +2088,7 @@ getBotToKick()
{ {
axis++; axis++;
} }
else // choose bots that are not on a team first else // choose bots that are not on a team first
{ {
return bot; return bot;
} }
@ -2857,7 +2857,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 )

View File

@ -6,12 +6,12 @@
// Code Callback functions // Code Callback functions
/*================ /*================
Called by code after the level's main script function has run. Called by code after the level's main script function has run.
================*/ ================*/
CodeCallback_StartGameType() CodeCallback_StartGameType()
{ {
// If the gametype has not beed started, run the startup // If the gametype has not beed started, run the startup
if(!isDefined(level.gametypestarted) || !level.gametypestarted) if ( !isDefined( level.gametypestarted ) || !level.gametypestarted )
{ {
[[level.callbackStartGameType]](); [[level.callbackStartGameType]]();
@ -26,89 +26,89 @@ CodeCallback_StartGameType()
} }
/*================ /*================
Called when a player begins connecting to the server. Called when a player begins connecting to the server.
Called again for every map change or tournement restart. Called again for every map change or tournement restart.
Return undefined if the client should be allowed, otherwise return Return undefined if the client should be allowed, otherwise return
a string with the reason for denial. a string with the reason for denial.
Otherwise, the client will be sent the current gamestate Otherwise, the client will be sent the current gamestate
and will eventually get to ClientBegin. and will eventually get to ClientBegin.
firstTime will be qtrue the very first time a client connects firstTime will be qtrue the very first time a client connects
to the server machine, but qfalse on map changes and tournement to the server machine, but qfalse on map changes and tournement
restarts. restarts.
================*/ ================*/
CodeCallback_PlayerConnect() CodeCallback_PlayerConnect()
{ {
self endon("disconnect"); self endon( "disconnect" );
[[level.callbackPlayerConnect]](); [[level.callbackPlayerConnect]]();
} }
/*================ /*================
Called when a player drops from the server. Called when a player drops from the server.
Will not be called between levels. Will not be called between levels.
self is the player that is disconnecting. self is the player that is disconnecting.
================*/ ================*/
CodeCallback_PlayerDisconnect() CodeCallback_PlayerDisconnect()
{ {
self notify("disconnect"); self notify( "disconnect" );
[[level.callbackPlayerDisconnect]](); [[level.callbackPlayerDisconnect]]();
} }
/*================ /*================
Called when a player has taken damage. Called when a player has taken damage.
self is the player that took damage. self is the player that took damage.
================*/ ================*/
CodeCallback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset) CodeCallback_PlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset )
{ {
self endon("disconnect"); self endon( "disconnect" );
[[level.callbackPlayerDamage]](eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset); [[level.callbackPlayerDamage]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset );
} }
/*================ /*================
Called when a player has been killed. Called when a player has been killed.
self is the player that was killed. self is the player that was killed.
================*/ ================*/
CodeCallback_PlayerKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration) CodeCallback_PlayerKilled( eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration )
{ {
self endon("disconnect"); self endon( "disconnect" );
[[level.callbackPlayerKilled]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration); [[level.callbackPlayerKilled]]( eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration );
} }
/*================ /*================
Called when a player has been killed, but has last stand perk. Called when a player has been killed, but has last stand perk.
self is the player that was killed. self is the player that was killed.
================*/ ================*/
CodeCallback_PlayerLastStand(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration ) CodeCallback_PlayerLastStand( eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration )
{ {
self endon("disconnect"); self endon( "disconnect" );
[[level.callbackPlayerLastStand]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration ); [[level.callbackPlayerLastStand]]( eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration );
} }
//============================================================================= //=============================================================================
/*================ /*================
Setup any misc callbacks stuff like defines and default callbacks Setup any misc callbacks stuff like defines and default callbacks
================*/ ================*/
SetupCallbacks() SetupCallbacks()
{ {
SetDefaultCallbacks(); SetDefaultCallbacks();
// Set defined for damage flags used in the playerDamage callback // Set defined for damage flags used in the playerDamage callback
level.iDFLAGS_RADIUS = 1; level.iDFLAGS_RADIUS = 1;
level.iDFLAGS_NO_ARMOR = 2; level.iDFLAGS_NO_ARMOR = 2;
level.iDFLAGS_NO_KNOCKBACK = 4; level.iDFLAGS_NO_KNOCKBACK = 4;
level.iDFLAGS_PENETRATION = 8; level.iDFLAGS_PENETRATION = 8;
level.iDFLAGS_NO_TEAM_PROTECTION = 16; level.iDFLAGS_NO_TEAM_PROTECTION = 16;
level.iDFLAGS_NO_PROTECTION = 32; level.iDFLAGS_NO_PROTECTION = 32;
level.iDFLAGS_PASSTHRU = 64; level.iDFLAGS_PASSTHRU = 64;
} }
/*================ /*================
Called from the gametype script to store off the default callback functions. Called from the gametype script to store off the default callback functions.
This allows the callbacks to be overridden by level script, but not lost. This allows the callbacks to be overridden by level script, but not lost.
================*/ ================*/
SetDefaultCallbacks() SetDefaultCallbacks()
{ {
level.callbackStartGameType = maps\mp\gametypes\_globallogic::Callback_StartGameType; level.callbackStartGameType = maps\mp\gametypes\_globallogic::Callback_StartGameType;
@ -120,11 +120,11 @@ SetDefaultCallbacks()
} }
/*================ /*================
Called when a gametype is not supported. Called when a gametype is not supported.
================*/ ================*/
AbortLevel() AbortLevel()
{ {
println("Aborting level - gametype is not supported"); println( "Aborting level - gametype is not supported" );
level.callbackStartGameType = ::callbackVoid; level.callbackStartGameType = ::callbackVoid;
level.callbackPlayerConnect = ::callbackVoid; level.callbackPlayerConnect = ::callbackVoid;
@ -133,13 +133,13 @@ AbortLevel()
level.callbackPlayerKilled = ::callbackVoid; level.callbackPlayerKilled = ::callbackVoid;
level.callbackPlayerLastStand = ::callbackVoid; level.callbackPlayerLastStand = ::callbackVoid;
setdvar("g_gametype", "dm"); setdvar( "g_gametype", "dm" );
exitLevel(false); exitLevel( false );
} }
/*================ /*================
================*/ ================*/
callbackVoid() callbackVoid()
{ {
} }