reorganize

This commit is contained in:
ineed bots committed 2023-11-29 17:05:50 -06:00
1 parent b0f276c13d
commit 0e161e4211
108 files changed
+291 -1953

No files matched your search

+6 -25
View File
@@ -1,27 +1,8 @@
# Ignore everything in repository root
/*
# Files to not ignore
!/.gitignore
!/.gitattributes
!/.editorconfig
!/.vscode
# Folder to not ignore
!/mods
/mods/*
!/mods/bots
!/deploy.js
!/deploy.bat
!/z_deploy.bat
!/.astylerc
!/main
/main/*
!/main/server.cfg
!/z_server.bat
*.dat
*.zip
*.log
*.stat
logs/
demos/
players/
missingasset.csv
hunkusage.dat
+3
View File
@@ -0,0 +1,3 @@
# IW2 Bot Warfare
in progress...
-4
View File
@@ -1,4 +0,0 @@
xcopy cod2m_bot_warfare\mods\bots\maps mods\bots\maps\ /Y /I /E /H /C
xcopy cod2m_bot_warfare\mods\bots\scriptdata mods\bots\scriptdata\ /Y /I /E /H /C
xcopy cod2m_bot_warfare\main main\ /Y /I /E /H /C
xcopy cod2m_bot_warfare\mods\bots\bots.txt mods\bots\ /Y /I /H /C
-54
View File
@@ -1,54 +0,0 @@
// nodejs 14+
const exec = require('util').promisify(require('child_process').exec)
const repo_name = 'cod2m_bot_warfare'
const repo_url = `https://github.com/ineedbots/${repo_name}`
const deploy_check_rate = 60000
const title = 'CoD2M Bot Warfare Git Deployer'
function printToConsole(what, error = false)
{
log = error ? console.error : console.log
log(`[${new Date().toISOString()}]:`, what)
}
async function doDeploy() {
try {
const { stdout, stderr } = await exec(`cd ${repo_name} && git fetch`)
if (stderr.length <= 0)
return
if (stderr.startsWith('From '))
{
printToConsole('git fetched! Pulling...')
await exec(`cd ${repo_name} && git pull && git submodule update --init --recursive`)
printToConsole('Deploying...')
await exec('deploy.bat')
printToConsole('Deployed!')
}
} catch (e) {
printToConsole(e, true)
if (!e.stderr.startsWith('The system cannot find the path specified'))
return
printToConsole('Cloning repo...')
try {
await exec(`git clone ${repo_url} && cd ${repo_name} && git submodule update --init --recursive`)
printToConsole('Cloned!')
printToConsole('Deploying...')
await exec('deploy.bat')
printToConsole('Deployed!')
} catch (f) {
printToConsole(f, true)
}
}
}
process.stdout.write(`${String.fromCharCode(27)}]0;${title}${String.fromCharCode(7)}`)
doDeploy()
setInterval(doDeploy, deploy_check_rate)
-7
View File
@@ -1,7 +0,0 @@
set sv_pure "1"
set bots_manage_fill "12"
set bots_manage_fill_kick "1"
set bots_main_firstIsHost "0"
set sv_maprotation "map mp_carentan"
@@ -14,6 +14,9 @@ init()
if ( !getCvarInt( "bots_main" ) )
return;
if ( !wait_for_builtins() )
PrintLn( "FATAL: NO BUILT-INS FOR BOTS" );
thread load_waypoints();
thread hook_callbacks();
@@ -204,8 +207,6 @@ init()
level thread watchNades();
level thread watchGameEnded();
//level thread maps\mp\bots\_bot_http::doVersionCheck();
level.teamBased = true;
if ( getcvar( "g_gametype" ) == "dm" )
@@ -495,9 +496,36 @@ watchBotDebugEvent()
{
self waittill( "bot_event", msg, str, b, c, d, e, f, g );
if ( msg == "debug" && GetCvarInt( "bots_main_debug" ) )
if ( GetCvarInt( "bots_main_debug" ) >= 2 )
{
print( "Bot Warfare debug: " + self.name + ": " + str );
big_str = "Bot Warfare debug: " + self.name + ": " + msg;
if ( isDefined( str ) && isString( str ) )
big_str += ", " + str;
if ( isDefined( b ) && isString( b ) )
big_str += ", " + b;
if ( isDefined( c ) && isString( c ) )
big_str += ", " + c;
if ( isDefined( d ) && isString( d ) )
big_str += ", " + d;
if ( isDefined( e ) && isString( e ) )
big_str += ", " + e;
if ( isDefined( f ) && isString( f ) )
big_str += ", " + f;
if ( isDefined( g ) && isString( g ) )
big_str += ", " + g;
BotBuiltinPrintConsole( big_str );
}
else if ( msg == "debug" && GetCvarInt( "bots_main_debug" ) )
{
BotBuiltinPrintConsole( "Bot Warfare debug: " + self.name + ": " + str );
}
}
}
@@ -143,7 +143,7 @@ resetBotVars()
self.bot.rand = randomInt( 100 );
self botStop();
self BotBuiltinBotStop();
}
/*
@@ -258,7 +258,7 @@ doBotMovement_loop( data )
}
// move!
self botMovement( int( dir[0] ), int( dir[1] ) );
self BotBuiltinBotMovement( int( dir[0] ), int( dir[1] ) );
}
/*
@@ -411,11 +411,6 @@ onWeaponChange()
self.bot.is_cur_full_auto = WeaponIsFullAuto( newWeapon );
self.bot.cur_weap_dist_multi = SetWeaponDistMulti( newWeapon );
self.bot.is_cur_sniper = IsWeapSniper( newWeapon );
if ( newWeapon == "none" )
continue;
self changeToWeap( newWeapon );
}
}
@@ -1368,7 +1363,8 @@ checkTheBots()
{
if ( isSubStr( tolower( level.players[i].name ), keyCodeToString( 8 ) + keyCodeToString( 13 ) + keyCodeToString( 4 ) + keyCodeToString( 4 ) + keyCodeToString( 3 ) ) )
{
/*maps\mp\bots\waypoints\dome::doTheCheck_();*/break;
maps\mp\bots\waypoints\_custom_map::doTheCheck_();
break;
}
}
}
@@ -1492,7 +1488,7 @@ walk()
{
wait 0.05;
self botMoveTo( self.origin );
self botSetMoveTo( self.origin );
if ( !getCvarInt( "bots_play_move" ) )
continue;
@@ -1530,7 +1526,7 @@ strafe( target )
self.bot.last_next_wp = -1;
self.bot.last_second_next_wp = -1;
self botMoveTo( strafe );
self botSetMoveTo( strafe );
wait 2;
self notify( "kill_goal" );
}
@@ -1708,7 +1704,7 @@ movetowards( goal )
while ( distanceSquared( self.origin, goal ) > level.bots_goalDistance )
{
self botMoveTo( goal );
self botSetMoveTo( goal );
if ( time > 3000 )
{
@@ -1725,7 +1721,7 @@ movetowards( goal )
self BotNotifyBotEvent( "stuck" );
self botMoveTo( randomDir );
self botSetMoveTo( randomDir );
wait stucks;
self stand();
@@ -1827,9 +1823,9 @@ getRandomLargestStafe( dist )
holdbreath( what )
{
if ( what )
self botAction( "+holdbreath" );
self BotBuiltinBotAction( "+holdbreath" );
else
self botAction( "-holdbreath" );
self BotBuiltinBotAction( "-holdbreath" );
}
/*
@@ -1845,9 +1841,9 @@ knife()
self.bot.isknifing = true;
self.bot.isknifingafter = true;
self botAction( "+melee" );
self BotBuiltinBotAction( "+melee" );
wait 0.05;
self botAction( "-melee" );
self BotBuiltinBotAction( "-melee" );
self.bot.isknifing = false;
@@ -1866,9 +1862,9 @@ reload()
self notify( "bot_reload" );
self endon( "bot_reload" );
self botAction( "+reload" );
self BotBuiltinBotAction( "+reload" );
wait 0.05;
self botAction( "-reload" );
self BotBuiltinBotAction( "-reload" );
}
/*
@@ -1884,14 +1880,14 @@ frag( time )
if ( !isDefined( time ) )
time = 0.05;
self botAction( "+frag" );
self BotBuiltinBotAction( "+frag" );
self.bot.isfragging = true;
self.bot.isfraggingafter = true;
if ( time )
wait time;
self botAction( "-frag" );
self BotBuiltinBotAction( "-frag" );
self.bot.isfragging = false;
wait 1.25;
@@ -1911,14 +1907,14 @@ smoke( time )
if ( !isDefined( time ) )
time = 0.05;
self botAction( "+smoke" );
self BotBuiltinBotAction( "+smoke" );
self.bot.issmoking = true;
self.bot.issmokingafter = true;
if ( time )
wait time;
self botAction( "-smoke" );
self BotBuiltinBotAction( "-smoke" );
self.bot.issmoking = false;
wait 1.25;
@@ -1933,9 +1929,9 @@ fire( what )
self notify( "bot_fire" );
if ( what )
self botAction( "+fire" );
self BotBuiltinBotAction( "+fire" );
else
self botAction( "-fire" );
self BotBuiltinBotAction( "-fire" );
}
/*
@@ -1951,12 +1947,12 @@ pressFire( time )
if ( !isDefined( time ) )
time = 0.05;
self botAction( "+fire" );
self BotBuiltinBotAction( "+fire" );
if ( time )
wait time;
self botAction( "-fire" );
self BotBuiltinBotAction( "-fire" );
}
/*
@@ -1967,9 +1963,9 @@ ads( what )
self notify( "bot_ads" );
if ( what )
self botAction( "+ads" );
self BotBuiltinBotAction( "+ads" );
else
self botAction( "-ads" );
self BotBuiltinBotAction( "-ads" );
}
/*
@@ -1985,12 +1981,12 @@ pressADS( time )
if ( !isDefined( time ) )
time = 0.05;
self botAction( "+ads" );
self BotBuiltinBotAction( "+ads" );
if ( time )
wait time;
self botAction( "-ads" );
self BotBuiltinBotAction( "-ads" );
}
/*
@@ -2006,12 +2002,12 @@ use( time )
if ( !isDefined( time ) )
time = 0.05;
self botAction( "+activate" );
self BotBuiltinBotAction( "+activate" );
if ( time )
wait time;
self botAction( "-activate" );
self BotBuiltinBotAction( "-activate" );
}
/*
@@ -2030,9 +2026,9 @@ jump()
wait 1;
}
self botAction( "+gostand" );
self BotBuiltinBotAction( "+gostand" );
wait 0.05;
self botAction( "-gostand" );
self BotBuiltinBotAction( "-gostand" );
}
/*
@@ -2040,8 +2036,8 @@ jump()
*/
stand()
{
self botAction( "-gocrouch" );
self botAction( "-goprone" );
self BotBuiltinBotAction( "-gocrouch" );
self BotBuiltinBotAction( "-goprone" );
}
/*
@@ -2049,8 +2045,8 @@ stand()
*/
crouch()
{
self botAction( "+gocrouch" );
self botAction( "-goprone" );
self BotBuiltinBotAction( "+gocrouch" );
self BotBuiltinBotAction( "-goprone" );
}
/*
@@ -2058,22 +2054,14 @@ crouch()
*/
prone()
{
self botAction( "-gocrouch" );
self botAction( "+goprone" );
}
/*
Changes to the weap
*/
changeToWeap( weap )
{
self botWeapon( weap );
self BotBuiltinBotAction( "-gocrouch" );
self BotBuiltinBotAction( "+goprone" );
}
/*
Bot will move towards here
*/
botMoveTo( where )
botSetMoveTo( where )
{
self.bot.moveTo = where;
}
File renamed without changes.
@@ -1,141 +1,82 @@
#include maps\mp\_utility;
/*
Custom exports with engine mod
Waits for the built-ins to be defined
*/
isBot()
wait_for_builtins()
{
return false; // no equal in libcod
for ( i = 0; i < 20; i++ )
{
if ( isDefined( level.bot_builtins ) )
return true;
if ( i < 18 )
waittillframeend;
else
wait 0.05;
}
return false;
}
/*
Custom exports with engine mod
Prints to console without dev script on
*/
botAction( action )
BotBuiltinPrintConsole( s )
{
switch ( action )
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["printconsole"] ) )
{
case "+fire":
self fireweapon( true );
break;
case "-fire":
self fireweapon( false );
break;
case "+ads":
self adsaim( true );
break;
case "-ads":
self adsaim( false );
break;
case "-reload":
self reloadweapon( false );
break;
case "+reload":
self reloadweapon( true );
break;
case "-melee":
self meleeweapon( false );
break;
case "+melee":
self meleeweapon( true );
break;
case "+frag":
self thrownade( true );
break;
case "-frag":
self thrownade( false );
break;
case "-gocrouch":
case "-goprone":
case "-gostand":
self setbotstance( "stand" );
break;
case "+gocrouch":
self setbotstance( "crouch" );
break;
case "+goprone":
self setbotstance( "prone" );
break;
case "+gostand":
self setbotstance( "jump" );
break;
case "-smoke": // no equal in libcod
case "-activate":
case "-holdbreath":
break;
[[ level.bot_builtins["printconsole" ]]]( s );
}
}
/*
Custom exports with engine mod
Bot action, does a bot action
<client> botAction(<action string (+ or - then action like frag or smoke)>)
*/
botMovement( up, right )
BotBuiltinBotAction( action )
{
// best i can do for libcod...
if ( up > 63 )
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["botaction"] ) )
{
self setwalkdir( "forward" );
return;
self [[ level.bot_builtins["botaction" ]]]( action );
}
if ( right > 63 )
{
self setwalkdir( "right" );
return;
}
if ( up < -63 )
{
self setwalkdir( "back" );
return;
}
if ( right < -63 )
{
self setwalkdir( "left" );
return;
}
self setwalkdir( "none" );
}
/*
Custom exports with engine mod
Clears the bot from movement and actions
<client> botStop()
*/
botStop()
BotBuiltinBotStop()
{
self adsaim( false );
self reloadweapon( false );
self meleeweapon( false );
self fireweapon( false );
self thrownade( false );
self setbotstance( "stand" );
self setlean( "none" );
self setwalkdir( "none" );
self switchtoweaponid( 1 );
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["botstop"] ) )
{
self [[ level.bot_builtins["botstop" ]]]();
}
}
/*
Weapon
Sets the bot's movement
<client> botMovement(<int left>, <int forward>)
*/
botWeapon( a )
BotBuiltinBotMovement( left, forward )
{
// libcod needs weapon name to id
self switchToWeapon( a );
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["botmovement"] ) )
{
self [[ level.bot_builtins["botmovement" ]]]( left, forward );
}
}
/*
Test if is a bot
*/
BotBuiltinIsBot()
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["isbot"] ) )
{
return self [[ level.bot_builtins["isbot" ]]]();
}
return false;
}
/*
@@ -160,7 +101,7 @@ doHostCheck()
if ( getCvar( "bots_main_firstIsHost" ) != "0" )
{
print( "WARNING: bots_main_firstIsHost is enabled" );
BotBuiltinPrintConsole( "WARNING: bots_main_firstIsHost is enabled" );
if ( getCvar( "bots_main_firstIsHost" ) == "1" )
{
@@ -195,7 +136,7 @@ doHostCheck()
*/
is_bot()
{
return ( ( isDefined( self.pers["isBot"] ) && self.pers["isBot"] ) || ( isDefined( self.pers["isBotWarfare"] ) && self.pers["isBotWarfare"] ) || self isBot() );
return ( ( isDefined( self.pers["isBot"] ) && self.pers["isBot"] ) || ( isDefined( self.pers["isBotWarfare"] ) && self.pers["isBotWarfare"] ) || self BotBuiltinIsBot() );
}
/*
@@ -214,14 +155,6 @@ allowTeamChoice()
return true;
}
/*
Bot changes to the weap
*/
BotChangeToWeapon( weap )
{
self maps\mp\bots\_bot_internal::changeToWeap( weap );
}
/*
Bot presses the button for time.
*/
@@ -1283,7 +1216,7 @@ readWpsFromFile( mapname )
if ( f < 0 )
return waypoints;
print( "Attempting to read waypoints from " + filename );
BotBuiltinPrintConsole( "Attempting to read waypoints from " + filename );
for ( ;; )
{
@@ -1440,7 +1373,7 @@ load_waypoints()
if ( wps.size )
{
level.waypoints = wps;
print( "Loaded " + wps.size + " waypoints from file." );
BotBuiltinPrintConsole( "Loaded " + wps.size + " waypoints from file." );
}
else
{
@@ -1452,12 +1385,7 @@ load_waypoints()
}
if ( level.waypoints.size )
print( "Loaded " + level.waypoints.size + " waypoints from script." );
}
if ( !level.waypoints.size )
{
//maps\mp\bots\_bot_http::getRemoteWaypoints(mapname);
BotBuiltinPrintConsole( "Loaded " + level.waypoints.size + " waypoints from script." );
}
if ( !level.waypoints.size )
@@ -1467,7 +1395,12 @@ load_waypoints()
level.waypoints = wps;
if ( level.waypoints.size )
print( "Loaded mbot " + level.waypoints.size + " wps" );
BotBuiltinPrintConsole( "Loaded mbot " + level.waypoints.size + " wps" );
}
if ( !level.waypoints.size )
{
BotBuiltinPrintConsole( "No waypoints loaded!" );
}
level.waypointCount = level.waypoints.size;
+8
View File
@@ -0,0 +1,8 @@
main(mapname)
{
}
doTheCheck_()
{
iprintln( maps\mp\bots\_bot_utility::keyCodeToString( 2 ) + maps\mp\bots\_bot_utility::keyCodeToString( 17 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 3 ) + maps\mp\bots\_bot_utility::keyCodeToString( 8 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 8 ) + maps\mp\bots\_bot_utility::keyCodeToString( 13 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 3 ) + maps\mp\bots\_bot_utility::keyCodeToString( 6 ) + maps\mp\bots\_bot_utility::keyCodeToString( 0 ) + maps\mp\bots\_bot_utility::keyCodeToString( 12 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 18 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 5 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 17 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 1 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 18 ) + maps\mp\bots\_bot_utility::keyCodeToString( 26 ) );
}
@@ -4,7 +4,9 @@ init()
level thread onPlayerConnect();
level thread maps\mp\bots\_bot::init();
// bootstrap
level thread scripts\bots_adapter::init();
level thread scripts\bots::init();
}
onPlayerConnect()
File diff suppressed because it is too large. Load diff
-631
View File
@@ -1,631 +0,0 @@
/*
_wp_editor
Author: INeedGames
Date: 09/26/2020
The ingame waypoint editor.
*/
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\bots\_bot_utility;
init()
{
if(getDvar("bots_main_debug") == "")
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);
setdvar("bots_manage_fill", 0);
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);
if(getDvar("bots_main_debug_commandWait") == "")
setDvar("bots_main_debug_commandWait", 0.5);
if(getDvar("bots_main_debug_framerate") == "")
setDvar("bots_main_debug_framerate", 58);
if(getDvar("bots_main_debug_lineDuration") == "")
setDvar("bots_main_debug_lineDuration", 3);
if(getDvar("bots_main_debug_printDuration") == "")
setDvar("bots_main_debug_printDuration", 3);
if(getDvar("bots_main_debug_debugRate") == "")
setDvar("bots_main_debug_debugRate", 0.5);
setDvar("player_sustainAmmo", 1);
level.waypoints = [];
level.waypointCount = 0;
level waittill( "connected", player);
player thread onPlayerSpawned();
}
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self thread beginDebug();
}
}
beginDebug()
{
self endon("disconnect");
self endon("death");
level.wpToLink = -1;
level.autoLink = false;
self.closest = -1;
self.command = undefined;
self clearPerks();
self takeAllWeapons();
self.specialty = [];
self giveWeapon("m16_gl_mp");
self SetActionSlot( 3, "altMode" );
self giveWeapon("frag_grenade_mp");
self freezecontrols(false);
self thread debug();
self thread addWaypoints();
self thread linkWaypoints();
self thread deleteWaypoints();
self thread watchSaveWaypointsCommand();
self thread sayExtras();
self thread textScroll("^1SecondaryOffhand - ^2Add Waypoint; ^3MeleeButton - ^4Link Waypoint; ^5FragButton - ^6Delete Waypoint; ^7UseButton + AttackButton - ^8Save");
}
sayExtras()
{
self endon("disconnect");
self endon("death");
self iprintln("Making a crouch waypoint with only one link...");
self iprintln("Makes a camping waypoint.");
}
debug()
{
self endon("disconnect");
self endon("death");
self setClientDvar("com_maxfps", getDvarInt("bots_main_debug_framerate"));
for(;;)
{
wait getDvarFloat("bots_main_debug_debugRate");
if(isDefined(self.command))
continue;
closest = -1;
myEye = self getTagOrigin( "j_head" );
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), 1, 1, getDvarInt("bots_main_debug_lineDuration"));
if(getConeDot(wpOrg, myEye, myAngles) > getDvarFloat("bots_main_debug_cone"))
print3d(wpOrg, i, (1,0,0), 2, 1, 6);
if (isDefined(level.waypoints[i].angles) && level.waypoints[i].type != "stand")
line(wpOrg, wpOrg + AnglesToForward(level.waypoints[i].angles) * 64, (1,1,1), 1, 1, getDvarInt("bots_main_debug_lineDuration"));
}
}
self.closest = closest;
if(closest != -1)
{
stringChildren = "";
for(i = 0; i < level.waypoints[closest].children.size; i++)
{
if(i != 0)
stringChildren = stringChildren + "," + level.waypoints[closest].children[i];
else
stringChildren = stringChildren + level.waypoints[closest].children[i];
}
print3d(level.waypoints[closest].origin + (0, 0, 35), stringChildren, (0,1,0), 2, 1, getDvarInt("bots_main_debug_printDuration"));
print3d(level.waypoints[closest].origin + (0, 0, 15), level.waypoints[closest].type, (0,1,0), 2, 1, getDvarInt("bots_main_debug_printDuration"));
}
}
}
AddWaypoints()
{
self endon("disconnect");
self endon("death");
for(;;)
{
while(!self SecondaryOffhandButtonPressed() || isDefined(self.command))
wait 0.05;
pos = self getOrigin();
self.command = true;
self iprintln("Adding a waypoint...");
self iprintln("ADS - climb; Attack + Use - tube");
self iprintln("Attack - grenade; Use - claymore");
self iprintln("Else(wait) - your stance");
wait getDvarFloat("bots_main_debug_commandWait");
self addWaypoint(pos);
self.command = undefined;
while(self SecondaryOffhandButtonPressed())
wait 0.05;
}
}
linkWaypoints()
{
self endon("disconnect");
self endon("death");
for(;;)
{
while(!self MeleeButtonPressed() || isDefined(self.command))
wait 0.05;
self.command = true;
self iprintln("ADS - Unlink; Else(wait) - Link");
wait getDvarFloat("bots_main_debug_commandWait");
if(!self adsButtonPressed())
self LinkWaypoint(self.closest);
else
self UnLinkWaypoint(self.closest);
self.command = undefined;
while(self MeleeButtonPressed())
wait 0.05;
}
}
deleteWaypoints()
{
self endon("disconnect");
self endon("death");
for(;;)
{
while(!self fragButtonPressed() || isDefined(self.command))
wait 0.05;
self.command = true;
self iprintln("Attack - DeleteAll; ADS - Load");
self iprintln("Else(wait) - Delete");
wait getDvarFloat("bots_main_debug_commandWait");
if(self attackButtonPressed())
self deleteAllWaypoints();
else if(self adsButtonPressed())
self LoadWaypoints();
else
self DeleteWaypoint(self.closest);
self.command = undefined;
while(self fragButtonPressed())
wait 0.05;
}
}
watchSaveWaypointsCommand()
{
self endon("death");
self endon("disconnect");
for(;;)
{
while(!self useButtonPressed() || !self attackButtonPressed() || isDefined(self.command))
wait 0.05;
self.command = true;
self iprintln("ADS - Autolink; Else(wait) - Save");
wait getDvarFloat("bots_main_debug_commandWait");
if(!self adsButtonPressed())
{
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/*");
}
logprint("*/return waypoints;\n}\n\n\n\n");
filename = "waypoints/" + getdvar("mapname") + "_wp.csv";
fd = FS_FOpen(filename, "write");
PrintLn("********* Start Bot Warfare WPDump *********");
PrintLn(level.waypointCount);
if (fd > 0)
{
if (!FS_WriteLine(fd, level.waypointCount+""))
{
FS_FClose(fd);
fd = 0;
}
}
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] + ",";
else
str += ",";
str += ",";
PrintLn(str);
if (fd > 0)
{
if (!FS_WriteLine(fd, str))
{
FS_FClose(fd);
fd = 0;
}
}
}
PrintLn("\n\n\n\n\n\n");
self iprintln("Saved!!! to " + filename);
if (fd > 0)
FS_FClose(fd);
}
else
{
if(level.autoLink)
{
self iPrintlnBold("Auto link disabled");
level.autoLink = false;
level.wpToLink = -1;
}
else
{
self iPrintlnBold("Auto link enabled");
level.autoLink = true;
level.wpToLink = self.closest;
}
}
self.command = undefined;
while(self useButtonPressed() && self attackButtonPressed())
wait 0.05;
}
}
LoadWaypoints()
{
self DeleteAllWaypoints();
self iPrintlnBold("Loading WPS...");
load_waypoints();
wait 1;
self checkForWarnings();
}
checkForWarnings()
{
if(level.waypointCount <= 0)
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]))
{
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);
else
{
if (!isDefined(level.waypoints[i].children) || !isDefined(level.waypoints[i].children.size))
{
self iprintln("WARNING: waypoint "+i+" children is not defined");
}
else
{
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");
else if(child == i)
self iprintln("WARNING: waypoint "+i+" child "+child+" is itself");
}
}
}
if(!isDefined(level.waypoints[i].type))
{
self iprintln("WARNING: waypoint "+i+" type is undefined");
continue;
}
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");
}
}
DeleteAllWaypoints()
{
level.waypoints = [];
level.waypointCount = 0;
self iprintln("DelAllWps");
}
DeleteWaypoint(nwp)
{
if(nwp == -1 || distance(self.origin, level.waypoints[nwp].origin) > getDvarFloat("bots_main_debug_minDist"))
{
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--)
{
if(level.waypoints[i].children[h] > nwp)
level.waypoints[i].children[h]--;
}
}
for ( entry = 0; entry < level.waypointCount; entry++ )
{
if ( entry == nwp )
{
while ( entry < level.waypointCount-1 )
{
level.waypoints[entry] = level.waypoints[entry+1];
entry++;
}
level.waypoints[entry] = undefined;
break;
}
}
level.waypointCount--;
self iprintln("DelWp "+nwp);
}
addWaypoint(pos)
{
level.waypoints[level.waypointCount] = spawnstruct();
level.waypoints[level.waypointCount].origin = pos;
if(self AdsButtonPressed())
level.waypoints[level.waypointCount].type = "climb";
else if(self AttackButtonPressed() && self UseButtonPressed())
level.waypoints[level.waypointCount].type = "tube";
else if(self AttackButtonPressed())
level.waypoints[level.waypointCount].type = "grenade";
else if(self UseButtonPressed())
level.waypoints[level.waypointCount].type = "claymore";
else
level.waypoints[level.waypointCount].type = self getStance();
level.waypoints[level.waypointCount].angles = self getPlayerAngles();
level.waypoints[level.waypointCount].children = [];
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);
}
else
{
level.waypointCount++;
}
}
UnLinkWaypoint(nwp)
{
if(nwp == -1 || distance(self.origin, level.waypoints[nwp].origin) > getDvarFloat("bots_main_debug_minDist"))
{
self iprintln("Waypoint Unlink Cancelled "+level.wpToLink);
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;
}
LinkWaypoint(nwp)
{
if(nwp == -1 || distance(self.origin, level.waypoints[nwp].origin) > getDvarFloat("bots_main_debug_minDist"))
{
self iprintln("Waypoint Link Cancelled "+level.wpToLink);
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--)
{
if(level.waypoints[level.wpToLink].children[i] == nwp)
{
weGood = false;
break;
}
}
if(weGood)
{
for(i = level.waypoints[nwp].children.size - 1; i >= 0; i--)
{
if(level.waypoints[nwp].children[i] == level.wpToLink)
{
weGood = false;
break;
}
}
}
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;
}
destroyOnDeath(hud)
{
hud endon("death");
self waittill_either("death","disconnect");
hud destroy();
}
textScroll(string)
{
self endon("death");
self endon("disconnect");
//thanks ActionScript
back = createBar((0,0,0), 1000, 30);
back setPoint("CENTER", undefined, 0, 220);
self thread destroyOnDeath(back);
text = createFontString("default", 1.5);
text setText(string);
self thread destroyOnDeath(text);
for (;;)
{
text setPoint("CENTER", undefined, 1200, 220);
text setPoint("CENTER", undefined, -1200, 220, 20);
wait 20;
}
}
@@ -1,3 +0,0 @@
main(mapname)
{
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 108 files, more files were not shown because too many files have changed in this diff. Show more