Skip to content

Commit

Permalink
Add Armored Man drop shotgun ammo on death logic
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelTroch committed Jan 15, 2024
1 parent c2e5095 commit 4c20323
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions dlls/armorman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,27 @@ void CArmorMan::RunTask(Task_t* pTask)



void CArmorMan::Killed(entvars_t* pevAttacker, int iGib)
{
if (pev->body < 1) // Shotgun in hand
{
pev->body = 0; // No shotgun

// This part retrieves the position and angles of the attachment that is the shotgun
// You could just use "pev->origin" and "pev->angles" for "DropItem" but the dropped
// item would look like dropped from the stomach which would be a bit weird
Vector vecGunPos;
Vector vecGunAng;
GetAttachment(0, vecGunPos, vecGunAng);
vecGunAng.x = 0.0f;
vecGunAng.z = 0.0f;

DropItem("ammo_buckshot", vecGunPos, vecGunAng);
}

CBaseMonster::Killed(pevAttacker, iGib);
}

bool CArmorMan::TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType)
{
// HACK HACK -- until we fix this.
Expand Down
1 change: 1 addition & 0 deletions dlls/armorman.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class CArmorMan : public CBaseMonster
Schedule_t* GetScheduleOfType(int Type) override;
void RunTask(Task_t* pTask) override;

void Killed(entvars_t* pevAttacker, int iGib) override;
bool TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType) override;
void TraceAttack(entvars_t* pevAttacker, float flDamage, Vector vecDir, TraceResult* ptr, int bitsDamageType) override;

Expand Down

0 comments on commit 4c20323

Please sign in to comment.