mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-13 23:28:04 +03:00
Bots can switch weapons underwater (#631)
* Bots can switch weapons underwater
This commit is contained in:
parent
d80d87366a
commit
3ff0f0cbf9
@ -516,6 +516,14 @@ void CCSBot::Update()
|
||||
m_isWaitingToTossGrenade = false;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// bots with low skill cannot switch weapons underwater
|
||||
if (GetProfile()->GetSkill() > 0.4f && pev->waterlevel == 3 && !IsActiveWeaponCanShootUnderwater())
|
||||
{
|
||||
EquipBestWeapon(MUST_EQUIP);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (IsHunting() && IsWellPastSafe() && IsUsingGrenade())
|
||||
{
|
||||
EquipBestWeapon(MUST_EQUIP);
|
||||
|
@ -414,6 +414,11 @@ bool CCSBot::DoEquip(CBasePlayerWeapon *pWeapon)
|
||||
if (!pWeapon)
|
||||
return false;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (GetProfile()->GetSkill() > 0.4f && pev->waterlevel == 3 && (pWeapon->iFlags() & ITEM_FLAG_NOFIREUNDERWATER))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// check if weapon has any ammo left
|
||||
if (!HasAnyAmmo(pWeapon))
|
||||
return false;
|
||||
|
@ -196,6 +196,8 @@ public:
|
||||
// is the weapon in the middle of a reload
|
||||
bool IsActiveWeaponReloading() const;
|
||||
|
||||
bool IsActiveWeaponCanShootUnderwater() const;
|
||||
|
||||
// return true if active weapon's bullet spray has become large and inaccurate
|
||||
bool IsActiveWeaponRecoilHigh() const;
|
||||
|
||||
@ -327,6 +329,15 @@ inline CBasePlayerWeapon *CBot::GetActiveWeapon() const
|
||||
return static_cast<CBasePlayerWeapon *>(m_pActiveItem);
|
||||
}
|
||||
|
||||
inline bool CBot::IsActiveWeaponCanShootUnderwater() const
|
||||
{
|
||||
CBasePlayerWeapon *pCurrentWeapon = GetActiveWeapon();
|
||||
if (pCurrentWeapon && !(pCurrentWeapon->iFlags() & ITEM_FLAG_NOFIREUNDERWATER))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool CBot::IsActiveWeaponReloading() const
|
||||
{
|
||||
CBasePlayerWeapon *pCurrentWeapon = GetActiveWeapon();
|
||||
|
Loading…
x
Reference in New Issue
Block a user