mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-22 05:55:42 +00:00
Tear down the hacks
This commit is contained in:
parent
7ae35b5585
commit
07bad9e79d
@ -26,12 +26,6 @@ init()
|
||||
thread load_waypoints();
|
||||
thread hook_callbacks();
|
||||
|
||||
setDvar("testClients_watchKillcam", true);
|
||||
setDvar("testclients_doReload", false);
|
||||
setDvar("testclients_doMove", false);
|
||||
setDvar("testclients_doAttack", true);
|
||||
setDvar("testclients_doCrouch", false);
|
||||
|
||||
if(getDvar("bots_main_GUIDs") == "")
|
||||
setDvar("bots_main_GUIDs", "");//guids of players who will be given host powers, comma seperated
|
||||
|
||||
@ -91,59 +85,38 @@ init()
|
||||
level.bots_maxShotgunDistance *= level.bots_maxShotgunDistance;
|
||||
level.bots_listenDist = 100;
|
||||
level.bots_listenDist *= level.bots_listenDist;
|
||||
level.botPushOutDist = 30;
|
||||
|
||||
level.smokeRadius = 255;
|
||||
|
||||
level.bots = [];
|
||||
|
||||
level.bots_nonfullautoguns = [];
|
||||
level.bots_nonfullautoguns["barrett"] = true;
|
||||
level.bots_nonfullautoguns["beretta"] = true;
|
||||
level.bots_nonfullautoguns["coltanaconda"] = true;
|
||||
level.bots_nonfullautoguns["deserteagle"] = true;
|
||||
level.bots_nonfullautoguns["fal"] = true;
|
||||
level.bots_nonfullautoguns["m21"] = true;
|
||||
level.bots_nonfullautoguns["m1014"] = true;
|
||||
level.bots_nonfullautoguns["ranger"] = true;
|
||||
level.bots_nonfullautoguns["striker"] = true;
|
||||
level.bots_nonfullautoguns["usp"] = true;
|
||||
level.bots_nonfullautoguns["wa2000"] = true;
|
||||
level.bots_nonfullautoguns["dragunov"] = true;
|
||||
level.bots_fullautoguns = [];
|
||||
level.bots_fullautoguns["aa12"] = true;
|
||||
level.bots_fullautoguns["ak47"] = true;
|
||||
level.bots_fullautoguns["aug"] = true;
|
||||
level.bots_fullautoguns["fn2000"] = true;
|
||||
level.bots_fullautoguns["glock"] = true;
|
||||
level.bots_fullautoguns["kriss"] = true;
|
||||
level.bots_fullautoguns["m4"] = true;
|
||||
level.bots_fullautoguns["m240"] = true;
|
||||
level.bots_fullautoguns["masada"] = true;
|
||||
level.bots_fullautoguns["mg4"] = true;
|
||||
level.bots_fullautoguns["mp5k"] = true;
|
||||
level.bots_fullautoguns["p90"] = true;
|
||||
level.bots_fullautoguns["pp2000"] = true;
|
||||
level.bots_fullautoguns["rpd"] = true;
|
||||
level.bots_fullautoguns["sa80"] = true;
|
||||
level.bots_fullautoguns["scar"] = true;
|
||||
level.bots_fullautoguns["tavor"] = true;
|
||||
level.bots_fullautoguns["tmp"] = true;
|
||||
level.bots_fullautoguns["ump45"] = true;
|
||||
level.bots_fullautoguns["uzi"] = true;
|
||||
|
||||
level.bots_bloodfx = loadfx("impacts/flesh_hit_body_fatal_exit");
|
||||
PrecacheMpAnim("pb_combatrun_forward_loop");
|
||||
PrecacheMpAnim("pb_crouch_run_forward");
|
||||
PrecacheMpAnim("pb_sprint");
|
||||
level.bots_fullautoguns["ac130"] = true;
|
||||
level.bots_fullautoguns["heli"] = true;
|
||||
|
||||
PrecacheMpAnim("pb_crouch_walk_forward_shield");
|
||||
PrecacheMpAnim("pb_crouch_run_forward_pistol");
|
||||
PrecacheMpAnim("pb_crouch_run_forward_RPG");
|
||||
PrecacheMpAnim("pb_crouch_walk_forward_akimbo");
|
||||
|
||||
PrecacheMpAnim("pb_combatrun_forward_shield");
|
||||
PrecacheMpAnim("pb_pistol_run_fast");
|
||||
PrecacheMpAnim("pb_combatrun_forward_RPG");
|
||||
PrecacheMpAnim("pb_combatrun_forward_akimbo");
|
||||
|
||||
PrecacheMpAnim("pb_sprint_shield");
|
||||
PrecacheMpAnim("pb_sprint_akimbo");
|
||||
PrecacheMpAnim("pb_sprint_pistol");
|
||||
PrecacheMpAnim("pb_sprint_RPG");
|
||||
|
||||
PrecacheMpAnim("pb_climbup");
|
||||
PrecacheMpAnim("pb_prone_crawl");
|
||||
PrecacheMpAnim("pb_laststand_crawl");
|
||||
|
||||
PrecacheMpAnim("pb_combatrun_forward_loop");
|
||||
|
||||
PrecacheMpAnim("pt_stand_core_pullout");
|
||||
|
||||
PrecacheMpAnim("pt_melee_pistol_1");
|
||||
PrecacheMpAnim("pt_melee_prone_pistol");
|
||||
PrecacheMpAnim("pt_melee_pistol_2");
|
||||
PrecacheMpAnim("pt_laststand_melee");
|
||||
PrecacheMpAnim("pt_melee_shield");
|
||||
level.bots_fullautoguns["ak47classic"] = true;
|
||||
level.bots_fullautoguns["ak74u"] = true;
|
||||
|
||||
level thread fixGamemodes();
|
||||
|
||||
@ -761,8 +734,6 @@ onGrenadeFire()
|
||||
grenade thread AddToSmokeList();
|
||||
else if (isSubStr(weaponName, "frag_"))
|
||||
grenade thread AddToFragList(self);
|
||||
else if ( weaponName == "claymore" || weaponName == "claymore_mp" )
|
||||
grenade thread claymoreDetonationBotFix();
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -58,11 +58,19 @@ is_bot()
|
||||
}
|
||||
|
||||
/*
|
||||
Returns how much the bot is ads'ing all the way.
|
||||
Bot presses the frag button for time.
|
||||
*/
|
||||
botAdsAmount()
|
||||
BotPressFrag(time)
|
||||
{
|
||||
return (1 / (self.bot.ads_highest - self.bot.ads_lowest)) * self.bot.ads_tightness + (1 + (self.bot.ads_highest / (self.bot.ads_lowest - self.bot.ads_highest)));
|
||||
self maps\mp\bots\_bot_internal::frag(time);
|
||||
}
|
||||
|
||||
/*
|
||||
Bot presses the smoke button for time.
|
||||
*/
|
||||
BotPressSmoke(time)
|
||||
{
|
||||
self maps\mp\bots\_bot_internal::smoke(time);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -81,129 +89,6 @@ BotPressAttack(time)
|
||||
self maps\mp\bots\_bot_internal::pressFire(time);
|
||||
}
|
||||
|
||||
/*
|
||||
Bot will stop moving
|
||||
*/
|
||||
BotStopMoving(what)
|
||||
{
|
||||
self.bot.stop_move = what;
|
||||
|
||||
if(what)
|
||||
self notify("kill_goal");
|
||||
}
|
||||
|
||||
/*
|
||||
Returns a valid grenade launcher weapon
|
||||
*/
|
||||
getValidTube()
|
||||
{
|
||||
weaps = self getweaponslistall();
|
||||
|
||||
for (i = 0; i < weaps.size; i++)
|
||||
{
|
||||
weap = weaps[i];
|
||||
|
||||
if(!self getAmmoCount(weap))
|
||||
continue;
|
||||
|
||||
if ((isSubStr(weap, "gl_") && !isSubStr(weap, "_gl_")) || weap == "m79_mp")
|
||||
return weap;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns a random grenade in the bot's inventory.
|
||||
*/
|
||||
getValidGrenade()
|
||||
{
|
||||
grenadeTypes = [];
|
||||
grenadeTypes[grenadeTypes.size] = "frag_grenade_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "smoke_grenade_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "flash_grenade_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "concussion_grenade_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "semtex_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "throwingknife_mp";
|
||||
|
||||
possibles = [];
|
||||
|
||||
for(i = 0; i < grenadeTypes.size; i++)
|
||||
{
|
||||
if ( !self hasWeapon( grenadeTypes[i] ) )
|
||||
continue;
|
||||
|
||||
if ( !self getAmmoCount( grenadeTypes[i] ) )
|
||||
continue;
|
||||
|
||||
possibles[possibles.size] = grenadeTypes[i];
|
||||
}
|
||||
|
||||
return random(possibles);
|
||||
}
|
||||
|
||||
/*
|
||||
UNUSED cause buggy
|
||||
Bots change weapons, does the anims
|
||||
*/
|
||||
botChangeWeapon(weapon)// intrestingly, this allows the bots to use pullout and pulldown anims and etc, but bugs out when the bot is frozen while midburst of a firerate limited weapon (m16, only shot one shot, or two shots, even though its a 3 round burst) (never switches until unfrozen)
|
||||
{
|
||||
self endon("death");
|
||||
self endon("disconnect");
|
||||
|
||||
if (level.gameEnded || !gameFlag( "prematch_done" ) || self.bot.isfrozen)
|
||||
return;
|
||||
|
||||
if (self.bot.knifing || self.bot.isfraggingafter)
|
||||
return;
|
||||
|
||||
if (self.disabledWeapon)
|
||||
return;
|
||||
|
||||
if (self InLastStand() && !self InFinalStand())
|
||||
return;
|
||||
|
||||
self.bot.switch_to_after_none = weapon;
|
||||
self.bot.switching = true;
|
||||
ret = undefined;
|
||||
|
||||
if (self GetCurrentWeapon() == "none")
|
||||
{
|
||||
self notify("weapon_change");
|
||||
ret = self waittill_any_timeout(5, "weapon_change");
|
||||
}
|
||||
else
|
||||
{
|
||||
self _DisableWeapon();
|
||||
self waittill_any_timeout(5, "weapon_change");
|
||||
self _EnableWeapon();
|
||||
ret = self waittill_any_timeout(5, "weapon_change");
|
||||
}
|
||||
|
||||
if (ret == "timeout")
|
||||
return false;
|
||||
|
||||
waittillframeend;
|
||||
self notify("bot_weapon_change", self GetCurrentWeapon());
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Bot will throw the grenade
|
||||
*/
|
||||
throwBotGrenade(gname, gtime)
|
||||
{
|
||||
return self maps\mp\bots\_bot_internal::botThrowGrenade(gname, gtime);
|
||||
}
|
||||
|
||||
/*
|
||||
If the bot is climbing
|
||||
*/
|
||||
botIsClimbing()
|
||||
{
|
||||
return self.bot.climbing;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns a random number thats different everytime it changes target
|
||||
*/
|
||||
@ -228,7 +113,15 @@ BotGetRandom()
|
||||
*/
|
||||
IsBotFragging()
|
||||
{
|
||||
return self.bot.isfragging;
|
||||
return self.bot.isfraggingafter;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns if the bot is pressing smoke button.
|
||||
*/
|
||||
IsBotSmoking()
|
||||
{
|
||||
return self.bot.issmokingafter;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -236,7 +129,7 @@ IsBotFragging()
|
||||
*/
|
||||
IsBotSprinting()
|
||||
{
|
||||
return self.bot.running;
|
||||
return self.bot.issprinting;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -266,11 +159,14 @@ BotIsFrozen()
|
||||
}
|
||||
|
||||
/*
|
||||
Sets the bot's target to be this ent.
|
||||
Bot will stop moving
|
||||
*/
|
||||
SetAttacker(att)
|
||||
BotStopMoving(what)
|
||||
{
|
||||
self.bot.target_this_frame = att;
|
||||
self.bot.stop_move = what;
|
||||
|
||||
if(what)
|
||||
self notify("kill_goal");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -369,6 +265,14 @@ ClearBotJavelinLocation()
|
||||
self SetBotJavelinLocation(undefined);
|
||||
}
|
||||
|
||||
/*
|
||||
Sets the bot's target to be this ent.
|
||||
*/
|
||||
SetAttacker(att)
|
||||
{
|
||||
self.bot.target_this_frame = att;
|
||||
}
|
||||
|
||||
/*
|
||||
Sets the script enemy for a bot.
|
||||
*/
|
||||
@ -413,51 +317,6 @@ HasThreat()
|
||||
return (isDefined(self GetThreat()));
|
||||
}
|
||||
|
||||
/*
|
||||
If the bot is doing a knife
|
||||
*/
|
||||
IsBotKnifing()
|
||||
{
|
||||
return self.bot.knifing;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns the bot's velocity
|
||||
*/
|
||||
getBotVelocity()
|
||||
{
|
||||
return self.bot.velocity;
|
||||
}
|
||||
|
||||
/*
|
||||
If the weapon is not a script weapon (bomb, killstreak, etc, grenades)
|
||||
*/
|
||||
isWeaponPrimary(weap)
|
||||
{
|
||||
return (maps\mp\gametypes\_weapons::isPrimaryWeapon(weap) || maps\mp\gametypes\_weapons::isAltModeWeapon(weap));
|
||||
}
|
||||
|
||||
/*
|
||||
If the ent is a vehicle
|
||||
*/
|
||||
entIsVehicle(ent)
|
||||
{
|
||||
return (ent.classname == "script_vehicle" || ent.model == "vehicle_uav_static_mp" || ent.model == "vehicle_ac130_coop");
|
||||
}
|
||||
|
||||
/*
|
||||
Returns if the given weapon is full auto.
|
||||
*/
|
||||
WeaponIsFullAuto(weap)
|
||||
{
|
||||
weaptoks = strtok(weap, "_");
|
||||
|
||||
assert(isDefined(weaptoks[0]));
|
||||
assert(isString(weaptoks[0]));
|
||||
|
||||
return !isDefined(level.bots_nonfullautoguns[weaptoks[0]]);
|
||||
}
|
||||
|
||||
/*
|
||||
If the player is defusing
|
||||
*/
|
||||
@ -498,14 +357,6 @@ isFlagCarrier()
|
||||
return (isDefined(self.carryFlag) && self.carryFlag);
|
||||
}
|
||||
|
||||
/*
|
||||
If the weapon is allowed to be dropped
|
||||
*/
|
||||
isWeaponDroppable(weap)
|
||||
{
|
||||
return (maps\mp\gametypes\_weapons::mayDropWeapon(weap));
|
||||
}
|
||||
|
||||
/*
|
||||
Returns if we are stunned.
|
||||
*/
|
||||
@ -522,6 +373,139 @@ isArtShocked()
|
||||
return (isDefined(self.beingArtilleryShellshocked) && self.beingArtilleryShellshocked);
|
||||
}
|
||||
|
||||
/*
|
||||
UNUSED cause buggy
|
||||
Bots change weapons, does the anims
|
||||
*/
|
||||
botChangeWeapon(weapon)// intrestingly, this allows the bots to use pullout and pulldown anims and etc, but bugs out when the bot is frozen while midburst of a firerate limited weapon (m16, only shot one shot, or two shots, even though its a 3 round burst) (never switches until unfrozen)
|
||||
{
|
||||
self endon("death");
|
||||
self endon("disconnect");
|
||||
|
||||
if (level.gameEnded || !gameFlag( "prematch_done" ) || self.bot.isfrozen)
|
||||
return;
|
||||
|
||||
if (self.bot.knifing || self.bot.isfraggingafter)
|
||||
return;
|
||||
|
||||
if (self.disabledWeapon)
|
||||
return;
|
||||
|
||||
if (self InLastStand() && !self InFinalStand())
|
||||
return;
|
||||
|
||||
self.bot.switch_to_after_none = weapon;
|
||||
self.bot.switching = true;
|
||||
ret = undefined;
|
||||
|
||||
if (self GetCurrentWeapon() == "none")
|
||||
{
|
||||
self notify("weapon_change");
|
||||
ret = self waittill_any_timeout(5, "weapon_change");
|
||||
}
|
||||
else
|
||||
{
|
||||
self _DisableWeapon();
|
||||
self waittill_any_timeout(5, "weapon_change");
|
||||
self _EnableWeapon();
|
||||
ret = self waittill_any_timeout(5, "weapon_change");
|
||||
}
|
||||
|
||||
if (ret == "timeout")
|
||||
return false;
|
||||
|
||||
waittillframeend;
|
||||
self notify("bot_weapon_change", self GetCurrentWeapon());
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns a valid grenade launcher weapon
|
||||
*/
|
||||
getValidTube()
|
||||
{
|
||||
weaps = self getweaponslistall();
|
||||
|
||||
for (i = 0; i < weaps.size; i++)
|
||||
{
|
||||
weap = weaps[i];
|
||||
|
||||
if(!self getAmmoCount(weap))
|
||||
continue;
|
||||
|
||||
if ((isSubStr(weap, "gl_") && !isSubStr(weap, "_gl_")) || weap == "m79_mp")
|
||||
return weap;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns a random grenade in the bot's inventory.
|
||||
*/
|
||||
getValidGrenade()
|
||||
{
|
||||
grenadeTypes = [];
|
||||
grenadeTypes[grenadeTypes.size] = "frag_grenade_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "smoke_grenade_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "flash_grenade_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "concussion_grenade_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "semtex_mp";
|
||||
grenadeTypes[grenadeTypes.size] = "throwingknife_mp";
|
||||
|
||||
possibles = [];
|
||||
|
||||
for(i = 0; i < grenadeTypes.size; i++)
|
||||
{
|
||||
if ( !self hasWeapon( grenadeTypes[i] ) )
|
||||
continue;
|
||||
|
||||
if ( !self getAmmoCount( grenadeTypes[i] ) )
|
||||
continue;
|
||||
|
||||
possibles[possibles.size] = grenadeTypes[i];
|
||||
}
|
||||
|
||||
return random(possibles);
|
||||
}
|
||||
|
||||
/*
|
||||
If the weapon is not a script weapon (bomb, killstreak, etc, grenades)
|
||||
*/
|
||||
isWeaponPrimary(weap)
|
||||
{
|
||||
return (maps\mp\gametypes\_weapons::isPrimaryWeapon(weap) || maps\mp\gametypes\_weapons::isAltModeWeapon(weap));
|
||||
}
|
||||
|
||||
/*
|
||||
If the ent is a vehicle
|
||||
*/
|
||||
entIsVehicle(ent)
|
||||
{
|
||||
return (ent.classname == "script_vehicle" || ent.model == "vehicle_uav_static_mp" || ent.model == "vehicle_ac130_coop");
|
||||
}
|
||||
|
||||
/*
|
||||
Returns if the given weapon is full auto.
|
||||
*/
|
||||
WeaponIsFullAuto(weap)
|
||||
{
|
||||
weaptoks = strtok(weap, "_");
|
||||
|
||||
assert(isDefined(weaptoks[0]));
|
||||
assert(isString(weaptoks[0]));
|
||||
|
||||
return isDefined(level.bots_fullautoguns[weaptoks[0]]);
|
||||
}
|
||||
|
||||
/*
|
||||
If the weapon is allowed to be dropped
|
||||
*/
|
||||
isWeaponDroppable(weap)
|
||||
{
|
||||
return (maps\mp\gametypes\_weapons::mayDropWeapon(weap));
|
||||
}
|
||||
|
||||
/*
|
||||
Returns the height the viewpos is above the origin
|
||||
*/
|
||||
@ -2418,50 +2402,3 @@ botPlayerModelForWeapon( weapon, secondary )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
patches so that it uses the bot's getVelocity func
|
||||
*/
|
||||
claymoreDetonationBotFix()
|
||||
{
|
||||
self endon( "death" );
|
||||
|
||||
self waittill( "missile_stuck" );
|
||||
|
||||
damagearea = spawn( "trigger_radius", self.origin + ( 0, 0, 0 - level.claymoreDetonateRadius ), 0, level.claymoreDetonateRadius, level.claymoreDetonateRadius * 2 );
|
||||
self thread maps\mp\gametypes\_weapons::deleteOnDeath( damagearea );
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
damagearea waittill( "trigger", player );
|
||||
|
||||
if (!player is_bot())
|
||||
continue;
|
||||
|
||||
if ( getdvarint( "scr_claymoredebug" ) != 1 )
|
||||
{
|
||||
if ( isdefined( self.owner ) && player == self.owner )
|
||||
continue;
|
||||
if ( !maps\mp\gametypes\_weapons::friendlyFireCheck( self.owner, player, 0 ) )
|
||||
continue;
|
||||
}
|
||||
if ( lengthsquared( player getBotVelocity() ) < 10 )
|
||||
continue;
|
||||
|
||||
if ( !player maps\mp\gametypes\_weapons::shouldAffectClaymore( self ) )
|
||||
continue;
|
||||
|
||||
if ( player damageConeTrace( self.origin, self ) > 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
self playsound ("claymore_activated");
|
||||
|
||||
|
||||
if ( player _hasPerk( "specialty_delaymine" ) )
|
||||
wait 3.0;
|
||||
else
|
||||
wait level.claymoreDetectionGracePeriod;
|
||||
|
||||
self detonate();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user