mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-26 22:55:41 +03:00
Armor pickup fix (#425)
fix "item_kevlar/ item_assaultsuit" items touch fix "ArmorType" message on pickup
This commit is contained in:
parent
94d81df16c
commit
6955ae9f65
@ -379,10 +379,15 @@ BOOL CItemKevlar::MyTouch(CBasePlayer *pPlayer)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pPlayer->m_iKevlar != ARMOR_NONE && pPlayer->pev->armorvalue >= MAX_NORMAL_BATTERY)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if (pPlayer->m_iKevlar == ARMOR_NONE)
|
||||
pPlayer->m_iKevlar = ARMOR_KEVLAR;
|
||||
|
||||
pPlayer->pev->armorvalue = 100;
|
||||
pPlayer->pev->armorvalue = MAX_NORMAL_BATTERY;
|
||||
EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/ammopickup2.wav", VOL_NORM, ATTN_NORM);
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, nullptr, pPlayer->pev);
|
||||
@ -390,7 +395,11 @@ BOOL CItemKevlar::MyTouch(CBasePlayer *pPlayer)
|
||||
MESSAGE_END();
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgArmorType, nullptr, pPlayer->pev);
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
WRITE_BYTE(pPlayer->m_iKevlar == ARMOR_KEVLAR ? 0 : 1); // 0 = ARMOR_KEVLAR, 1 = ARMOR_VESTHELM
|
||||
#else
|
||||
WRITE_BYTE(0);
|
||||
#endif
|
||||
MESSAGE_END();
|
||||
|
||||
if (TheTutor)
|
||||
@ -422,8 +431,13 @@ BOOL CItemAssaultSuit::MyTouch(CBasePlayer *pPlayer)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pPlayer->m_iKevlar == ARMOR_VESTHELM && pPlayer->pev->armorvalue >= MAX_NORMAL_BATTERY)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
pPlayer->m_iKevlar = ARMOR_VESTHELM;
|
||||
pPlayer->pev->armorvalue = 100;
|
||||
pPlayer->pev->armorvalue = MAX_NORMAL_BATTERY;
|
||||
|
||||
EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/ammopickup2.wav", VOL_NORM, ATTN_NORM);
|
||||
|
||||
@ -432,7 +446,7 @@ BOOL CItemAssaultSuit::MyTouch(CBasePlayer *pPlayer)
|
||||
MESSAGE_END();
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgArmorType, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(1);
|
||||
WRITE_BYTE(1); // 0 = ARMOR_KEVLAR, 1 = ARMOR_VESTHELM
|
||||
MESSAGE_END();
|
||||
|
||||
if (TheTutor)
|
||||
|
@ -2323,8 +2323,15 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
|
||||
}
|
||||
case ARMOURY_KEVLAR:
|
||||
{
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pToucher->m_iKevlar != ARMOR_NONE && pToucher->pev->armorvalue >= MAX_NORMAL_BATTERY)
|
||||
#else
|
||||
if (pToucher->m_iKevlar == ARMOR_KEVLAR)
|
||||
#endif
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pToucher->GiveNamedItem("item_kevlar");
|
||||
m_iCount--;
|
||||
@ -2332,8 +2339,14 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
|
||||
}
|
||||
case ARMOURY_ASSAULT:
|
||||
{
|
||||
if (pToucher->m_iKevlar == ARMOR_VESTHELM)
|
||||
if (pToucher->m_iKevlar == ARMOR_VESTHELM
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
&& pToucher->pev->armorvalue >= MAX_NORMAL_BATTERY
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pToucher->GiveNamedItem("item_assaultsuit");
|
||||
m_iCount--;
|
||||
|
Loading…
Reference in New Issue
Block a user