mirror of
https://github.com/ineedbots/iw2_bot_warfare.git
synced 2025-04-20 22:55:43 +00:00
libcod support
This commit is contained in:
parent
4b649d1fc1
commit
b0f276c13d
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
init()
|
init()
|
||||||
{
|
{
|
||||||
level.bw_VERSION = "2.0.1";
|
level.bw_VERSION = "2.1.0";
|
||||||
|
|
||||||
if ( getCvar( "bots_main" ) == "" )
|
if ( getCvar( "bots_main" ) == "" )
|
||||||
setCvar( "bots_main", true );
|
setCvar( "bots_main", true );
|
||||||
|
@ -1449,7 +1449,7 @@ walk_loop()
|
|||||||
d = VectorNormalize( trace["position"] - myOrg );
|
d = VectorNormalize( trace["position"] - myOrg );
|
||||||
n = trace["normal"];
|
n = trace["normal"];
|
||||||
|
|
||||||
r = d - vector_scale( vector_scale( VectorDot( d, n ), n ), 2 );
|
r = d - vector_scale( vector_scale( n, VectorDot( d, n ) ), 2 );
|
||||||
|
|
||||||
goal = PhysicsTrace( myOrg, myOrg + vector_scale( ( r[0], r[1], 0 ), stepDist ), false, self );
|
goal = PhysicsTrace( myOrg, myOrg + vector_scale( ( r[0], r[1], 0 ), stepDist ), false, self );
|
||||||
goal = PhysicsTrace( goal + ( 0, 0, 50 ), goal + ( 0, 0, -40 ), false, self );
|
goal = PhysicsTrace( goal + ( 0, 0, 50 ), goal + ( 0, 0, -40 ), false, self );
|
||||||
@ -2135,11 +2135,3 @@ bot_lookat( pos, time, vel, doAimPredict )
|
|||||||
wait 0.05;
|
wait 0.05;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Weapon
|
|
||||||
*/
|
|
||||||
botWeapon( a )
|
|
||||||
{
|
|
||||||
self switchToWeapon( a );
|
|
||||||
}
|
|
||||||
|
@ -181,7 +181,7 @@ set_diff()
|
|||||||
switch ( rankVar )
|
switch ( rankVar )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
self.pers["bots"]["skill"]["base"] = Round( random_normal_distribution( 3.5, 1.75, 1, 7 ) );
|
self.pers["bots"]["skill"]["base"] = RoundNum( random_normal_distribution( 3.5, 1.75, 1, 7 ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -1,5 +1,143 @@
|
|||||||
#include maps\mp\_utility;
|
#include maps\mp\_utility;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Custom exports with engine mod
|
||||||
|
*/
|
||||||
|
isBot()
|
||||||
|
{
|
||||||
|
return false; // no equal in libcod
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Custom exports with engine mod
|
||||||
|
*/
|
||||||
|
botAction( action )
|
||||||
|
{
|
||||||
|
switch ( action )
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Custom exports with engine mod
|
||||||
|
*/
|
||||||
|
botMovement( up, right )
|
||||||
|
{
|
||||||
|
// best i can do for libcod...
|
||||||
|
if ( up > 63 )
|
||||||
|
{
|
||||||
|
self setwalkdir( "forward" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
botStop()
|
||||||
|
{
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Weapon
|
||||||
|
*/
|
||||||
|
botWeapon( a )
|
||||||
|
{
|
||||||
|
// libcod needs weapon name to id
|
||||||
|
self switchToWeapon( a );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns if player is the host
|
Returns if player is the host
|
||||||
*/
|
*/
|
||||||
@ -876,7 +1014,7 @@ DistanceSquared2D( to, from )
|
|||||||
/*
|
/*
|
||||||
Rounds to the nearest whole number.
|
Rounds to the nearest whole number.
|
||||||
*/
|
*/
|
||||||
Round( x )
|
RoundNum( x )
|
||||||
{
|
{
|
||||||
y = int( x );
|
y = int( x );
|
||||||
|
|
||||||
@ -1236,6 +1374,9 @@ loadmbotWps( mapname, gametype )
|
|||||||
s = fgetarg( f, 0 );
|
s = fgetarg( f, 0 );
|
||||||
t = strtok( s, " ," );
|
t = strtok( s, " ," );
|
||||||
|
|
||||||
|
if ( !isDefined( t ) || t.size < 6 )
|
||||||
|
break;
|
||||||
|
|
||||||
wp = spawnStruct();
|
wp = spawnStruct();
|
||||||
wp.origin = ( float( t[0] ), float( t[1] ), float( t[2] ) );
|
wp.origin = ( float( t[0] ), float( t[1] ), float( t[2] ) );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user