Valve: Tripmine death attribution is now variable

This commit is contained in:
Marco Cawthorne 2020-03-24 08:20:43 +01:00
parent 73866574a2
commit 50d840cd9d
3 changed files with 11 additions and 2 deletions

View File

@ -32,6 +32,7 @@ void Game_Input(void);
int Rules_IsTeamPlay(void);
entity eActivator;
entity g_eAttacker;
// Generic entity fields
.void() PlayerUse;

View File

@ -85,6 +85,9 @@ Damage_Apply(entity t, entity c, float dmg, int w, int type)
c.frags++;
}
/* set this global in case we need it later */
g_eAttacker = c;
entity eOld = self;
self = t;

View File

@ -80,8 +80,12 @@ void w_tripmine_holster(void)
}
#ifdef SSQC
void w_tripmine_trip(int unused)
void w_tripmine_trip(int walkthrough)
{
if (!walkthrough) {
self.owner = g_eAttacker;
}
/* This is to prevent infinite loops in Damage_Radius */
self.vDeath =
self.vPain = __NULL__;
@ -110,7 +114,7 @@ void w_tripmine_ready(void)
}
if (trace_plane_dist != self.armor) {
w_tripmine_trip(0);
w_tripmine_trip(1);
}
self.nextthink = time;
}
@ -206,6 +210,7 @@ void w_tripmine_primary(void)
mine.nextthink = time + 4.0f;
mine.SendEntity = w_tripmine_sendentity;
mine.SendFlags = 1;
mine.owner = self;
setorigin(mine, trace_endpos - (v_forward * 8));
sound(mine, CHAN_WEAPON, "weapons/mine_charge.wav", 1, ATTN_NORM);
sound(self, CHAN_WEAPON, "weapons/mine_deploy.wav", 1, ATTN_NORM);