mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-13 23:28:04 +03:00
Enhanced behavior armoury_entity with czbot, don't pick up if forbidden by cvars
This commit is contained in:
parent
29a94ddbb8
commit
7ac1e0db2f
@ -168,16 +168,35 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
|
||||
if (item->m_iId == WEAPON_C4)
|
||||
return true;
|
||||
|
||||
int weaponClass = WeaponIDToWeaponClass(item->m_iId);
|
||||
WeaponClassType weaponClass = WeaponIDToWeaponClass(item->m_iId);
|
||||
|
||||
if ((!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|
||||
|| (!AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN)
|
||||
|| (!AllowRifles() && weaponClass == WEAPONCLASS_RIFLE)
|
||||
|| (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|
||||
if ((!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|
||||
|| (!AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN)
|
||||
|| (!AllowRifles() && weaponClass == WEAPONCLASS_RIFLE)
|
||||
|| (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|
||||
|| (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|
||||
|| (!AllowTacticalShield() && item->m_iId == WEAPON_SHIELDGUN)
|
||||
|| (!AllowPistols() && weaponClass == WEAPONCLASS_PISTOL)
|
||||
|| (!AllowGrenades() && weaponClass == WEAPONCLASS_GRENADE))
|
||||
|| (!AllowPistols() && weaponClass == WEAPONCLASS_PISTOL)
|
||||
|| (!AllowGrenades() && weaponClass == WEAPONCLASS_GRENADE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCSBotManager::IsWeaponUseable(ArmouryItemPack item) const
|
||||
{
|
||||
WeaponClassType weaponClass = WeaponIDToWeaponClass(item);
|
||||
|
||||
if ((!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|
||||
|| (!AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN)
|
||||
|| (!AllowRifles() && weaponClass == WEAPONCLASS_RIFLE)
|
||||
|| (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|
||||
|| (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|
||||
|| (!AllowTacticalShield() && item == ARMOURY_SHIELD)
|
||||
|| (!AllowPistols() && weaponClass == WEAPONCLASS_PISTOL)
|
||||
|| (!AllowGrenades() && weaponClass == WEAPONCLASS_GRENADE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -195,6 +195,7 @@ public:
|
||||
bool AllowFriendlyFireDamage() const { return friendlyfire.value != 0.0f; }
|
||||
|
||||
bool IsWeaponUseable(CBasePlayerItem *item) const; // return true if the bot can use this weapon
|
||||
bool IsWeaponUseable(ArmouryItemPack item) const;
|
||||
|
||||
bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round
|
||||
bool IsOnDefense(CBasePlayer *pPlayer) const; // return true if this player is on "defense"
|
||||
|
@ -2255,6 +2255,11 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pToucher->IsBot() && TheCSBots() && !TheCSBots()->IsWeaponUseable(m_iItem))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// primary weapons
|
||||
if (m_iCount > 0 && (m_iItem <= ARMOURY_M249
|
||||
#ifdef REGAMEDLL_ADD
|
||||
|
@ -388,6 +388,58 @@ WeaponClassType WeaponIDToWeaponClass(int id)
|
||||
return AliasToWeaponClass(WeaponIDToAlias(id));
|
||||
}
|
||||
|
||||
WeaponClassType WeaponIDToWeaponClass(ArmouryItemPack id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case ARMOURY_AUG:
|
||||
case ARMOURY_GALIL:
|
||||
case ARMOURY_M4A1:
|
||||
case ARMOURY_SG552:
|
||||
case ARMOURY_AK47:
|
||||
case ARMOURY_FAMAS:
|
||||
return WEAPONCLASS_RIFLE;
|
||||
|
||||
case ARMOURY_GLOCK18:
|
||||
case ARMOURY_USP:
|
||||
case ARMOURY_ELITE:
|
||||
case ARMOURY_FIVESEVEN:
|
||||
case ARMOURY_P228:
|
||||
case ARMOURY_DEAGLE:
|
||||
return WEAPONCLASS_PISTOL;
|
||||
|
||||
case ARMOURY_MP5NAVY:
|
||||
case ARMOURY_MAC10:
|
||||
case ARMOURY_TMP:
|
||||
case ARMOURY_UMP45:
|
||||
case ARMOURY_P90:
|
||||
return WEAPONCLASS_SUBMACHINEGUN;
|
||||
|
||||
case ARMOURY_SCOUT:
|
||||
case ARMOURY_SG550:
|
||||
case ARMOURY_AWP:
|
||||
case ARMOURY_G3SG1:
|
||||
return WEAPONCLASS_SNIPERRIFLE;
|
||||
|
||||
case ARMOURY_FLASHBANG:
|
||||
case ARMOURY_HEGRENADE:
|
||||
case ARMOURY_SMOKEGRENADE:
|
||||
return WEAPONCLASS_GRENADE;
|
||||
|
||||
case ARMOURY_M3:
|
||||
case ARMOURY_XM1014:
|
||||
return WEAPONCLASS_SHOTGUN;
|
||||
|
||||
case ARMOURY_M249:
|
||||
return WEAPONCLASS_MACHINEGUN;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return WEAPONCLASS_NONE;
|
||||
}
|
||||
|
||||
// Return true if given weapon ID is a primary weapon
|
||||
bool IsPrimaryWeapon(int id)
|
||||
{
|
||||
|
@ -447,6 +447,7 @@ const char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id);
|
||||
const char *WeaponIDToAlias(int id);
|
||||
WeaponClassType AliasToWeaponClass(const char *alias);
|
||||
WeaponClassType WeaponIDToWeaponClass(int id);
|
||||
WeaponClassType WeaponIDToWeaponClass(ArmouryItemPack id);
|
||||
bool IsPrimaryWeapon(int id);
|
||||
bool IsSecondaryWeapon(int id);
|
||||
bool IsGrenadeWeapon(int id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user