mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-28 07:35:40 +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;
|
return FALSE;
|
||||||
#endif
|
#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)
|
if (pPlayer->m_iKevlar == ARMOR_NONE)
|
||||||
pPlayer->m_iKevlar = ARMOR_KEVLAR;
|
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);
|
EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "items/ammopickup2.wav", VOL_NORM, ATTN_NORM);
|
||||||
|
|
||||||
MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, nullptr, pPlayer->pev);
|
MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, nullptr, pPlayer->pev);
|
||||||
@ -390,7 +395,11 @@ BOOL CItemKevlar::MyTouch(CBasePlayer *pPlayer)
|
|||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
|
|
||||||
MESSAGE_BEGIN(MSG_ONE, gmsgArmorType, nullptr, pPlayer->pev);
|
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);
|
WRITE_BYTE(0);
|
||||||
|
#endif
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
|
|
||||||
if (TheTutor)
|
if (TheTutor)
|
||||||
@ -422,8 +431,13 @@ BOOL CItemAssaultSuit::MyTouch(CBasePlayer *pPlayer)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#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->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);
|
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_END();
|
||||||
|
|
||||||
MESSAGE_BEGIN(MSG_ONE, gmsgArmorType, nullptr, pPlayer->pev);
|
MESSAGE_BEGIN(MSG_ONE, gmsgArmorType, nullptr, pPlayer->pev);
|
||||||
WRITE_BYTE(1);
|
WRITE_BYTE(1); // 0 = ARMOR_KEVLAR, 1 = ARMOR_VESTHELM
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
|
|
||||||
if (TheTutor)
|
if (TheTutor)
|
||||||
|
@ -2323,8 +2323,15 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
|
|||||||
}
|
}
|
||||||
case ARMOURY_KEVLAR:
|
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)
|
if (pToucher->m_iKevlar == ARMOR_KEVLAR)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pToucher->GiveNamedItem("item_kevlar");
|
pToucher->GiveNamedItem("item_kevlar");
|
||||||
m_iCount--;
|
m_iCount--;
|
||||||
@ -2332,8 +2339,14 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
|
|||||||
}
|
}
|
||||||
case ARMOURY_ASSAULT:
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pToucher->GiveNamedItem("item_assaultsuit");
|
pToucher->GiveNamedItem("item_assaultsuit");
|
||||||
m_iCount--;
|
m_iCount--;
|
||||||
|
Loading…
Reference in New Issue
Block a user