Skip to content

Commit c40d85d

Browse files
committed
test lunchbox that gives armor
1 parent 6e97638 commit c40d85d

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/game/shared/tf/tf_weapon_lunchbox.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,26 @@ void CTFLunchBox::ApplyBiteEffects( CTFPlayer *pPlayer )
444444
{
445445
int maxPrimary = pPlayer->GetMaxAmmo(TF_AMMO_PRIMARY);
446446
int iAmmoGiven = pPlayer->GiveAmmo(maxPrimary * 0.25, TF_AMMO_PRIMARY, true);
447-
if (iAmmoGiven > 0)
447+
if (iAmmoGiven > 0 && !pPlayer->IsBot())
448448
{
449449
bDrainAmmo = true;
450450
}
451451
}
452+
453+
#if defined(QUIVER_DLL) || defined(QUIVER_CLIENT_DLL)
454+
// Restore armor if applicable
455+
if (nLunchBoxType == LUNCHBOX_ADDS_ARMOR)
456+
{
457+
int oldArmor = pPlayer->ArmorValue();
458+
int maxArmor = pPlayer->GetMaxArmor();
459+
pPlayer->IncrementArmorValue(maxArmor * 0.25, maxArmor);
460+
int iArmorGiven = (pPlayer->ArmorValue() - oldArmor);
461+
if (iArmorGiven > 0 && !pPlayer->IsBot())
462+
{
463+
bDrainAmmo = true;
464+
}
465+
}
466+
#endif
452467
}
453468

454469
// Drain ammo on the first bite that applied an effect

src/game/shared/tf/tf_weapon_lunchbox.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ enum lunchbox_weapontypes_t
2727
LUNCHBOX_ADDS_AMMO,
2828
LUNCHBOX_BANANA,
2929
LUNCHBOX_FISHCAKE,
30+
#if defined(QUIVER_DLL) || defined(QUIVER_CLIENT_DLL)
31+
LUNCHBOX_ADDS_ARMOR,
32+
#endif
3033
};
3134

3235
#define TF_SANDWICH_REGENTIME 30

0 commit comments

Comments
 (0)