mirror of
https://github.com/ineedbots/t4_bot_warfare.git
synced 2025-04-22 07:55:43 +00:00
Fix weap swap vars, partial c4 support
This commit is contained in:
parent
5afc002126
commit
979d1135be
@ -303,10 +303,69 @@ spawned()
|
||||
self thread aim();
|
||||
self thread watchHoldBreath();
|
||||
self thread onNewEnemy();
|
||||
self thread watchGrenadeFire();
|
||||
|
||||
self notify("bot_spawned");
|
||||
}
|
||||
|
||||
/*
|
||||
Watches when the bot fires a grenade
|
||||
*/
|
||||
watchGrenadeFire()
|
||||
{
|
||||
self endon("disconnect");
|
||||
self endon("death");
|
||||
|
||||
for (;;)
|
||||
{
|
||||
self waittill( "grenade_fire", nade, weapname );
|
||||
|
||||
if ( weapname == "satchel_charge_mp" )
|
||||
self thread watchC4Thrown(nade);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Watches the c4
|
||||
*/
|
||||
watchC4Thrown(c4)
|
||||
{
|
||||
self endon("disconnect");
|
||||
c4 endon("death");
|
||||
|
||||
wait 0.5;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
wait 1 + randomInt(50) * 0.05;
|
||||
|
||||
shouldBreak = false;
|
||||
for (i = 0; i < level.players.size; i++)
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if(player == self)
|
||||
continue;
|
||||
|
||||
if((level.teamBased && self.team == player.team) || player.sessionstate != "playing" || !isAlive(player))
|
||||
continue;
|
||||
|
||||
if (distanceSquared(c4.origin, player.origin) > 200*200)
|
||||
continue;
|
||||
|
||||
if (!bulletTracePassed(c4.origin, player.origin + (0, 0, 25), false, c4))
|
||||
continue;
|
||||
|
||||
shouldBreak = true;
|
||||
}
|
||||
|
||||
if (shouldBreak)
|
||||
break;
|
||||
}
|
||||
|
||||
self notify( "alt_detonate" );
|
||||
}
|
||||
|
||||
/*
|
||||
Sets the factor of distance for a weapon
|
||||
*/
|
||||
@ -405,26 +464,25 @@ onWeaponChange()
|
||||
{
|
||||
self endon("disconnect");
|
||||
self endon("death");
|
||||
|
||||
weap = self GetCurrentWeapon();
|
||||
self.bot.is_cur_full_auto = WeaponIsFullAuto(weap);
|
||||
self.bot.cur_weap_dist_multi = SetWeaponDistMulti(weap);
|
||||
self.bot.is_cur_sniper = IsWeapSniper(weap);
|
||||
if (weap != "none")
|
||||
self changeToWeap(weap);
|
||||
|
||||
first = true;
|
||||
for(;;)
|
||||
{
|
||||
self waittill( "weapon_change", newWeapon );
|
||||
newWeapon = undefined;
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
newWeapon = self getCurrentWeapon();
|
||||
}
|
||||
else
|
||||
self waittill( "weapon_change", newWeapon );
|
||||
|
||||
self.bot.is_cur_full_auto = WeaponIsFullAuto(newWeapon);
|
||||
self.bot.cur_weap_dist_multi = SetWeaponDistMulti(weap);
|
||||
self.bot.is_cur_sniper = IsWeapSniper(weap);
|
||||
self.bot.cur_weap_dist_multi = SetWeaponDistMulti(newWeapon);
|
||||
self.bot.is_cur_sniper = IsWeapSniper(newWeapon);
|
||||
|
||||
if (newWeapon == "none")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
self changeToWeap(newWeapon);
|
||||
}
|
||||
|
@ -2061,6 +2061,8 @@ bot_use_equipment_think()
|
||||
nade = undefined;
|
||||
if (self GetAmmoCount("mine_bouncing_betty_mp"))
|
||||
nade = "mine_bouncing_betty_mp";
|
||||
if (self GetAmmoCount("satchel_charge_mp"))
|
||||
nade = "satchel_charge_mp";
|
||||
|
||||
if (!isDefined(nade))
|
||||
continue;
|
||||
@ -2138,7 +2140,8 @@ bot_use_equipment_think()
|
||||
|
||||
if (self changeToWeapon(nade))
|
||||
{
|
||||
self thread fire_current_weapon();
|
||||
if (nade != "satchel_charge_mp")
|
||||
self thread fire_current_weapon();
|
||||
self waittill_any_timeout(5, "grenade_fire", "weapon_change");
|
||||
self notify("stop_firing_weapon");
|
||||
}
|
||||
@ -2523,7 +2526,7 @@ bot_weapon_think()
|
||||
}
|
||||
else
|
||||
{
|
||||
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "satchel_charge_mp" && curWeap != "squadcommand_mp")
|
||||
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "squadcommand_mp")
|
||||
{
|
||||
if(randomInt(100) > self.pers["bots"]["behavior"]["switch"])
|
||||
continue;
|
||||
@ -2549,7 +2552,7 @@ bot_weapon_think()
|
||||
if (maps\mp\gametypes\_weapons::isGrenade( weapon ))
|
||||
continue;
|
||||
|
||||
if(curWeap == weapon || weapon == "satchel_charge_mp" || weapon == "none" || weapon == "mine_bouncing_betty_mp" || weapon == "" || weapon == "squadcommand_mp")//c4 no work
|
||||
if(curWeap == weapon || weapon == "satchel_charge_mp" || weapon == "none" || weapon == "mine_bouncing_betty_mp" || weapon == "" || weapon == "squadcommand_mp")
|
||||
continue;
|
||||
|
||||
weap = weapon;
|
||||
|
Loading…
x
Reference in New Issue
Block a user