summaryrefslogtreecommitdiff
path: root/src/game/g_weapon.c
diff options
context:
space:
mode:
authormtiusane <mtiusane@users.noreply.github.com>2014-08-16 16:35:02 +0300
committermtiusane <mtiusane@users.noreply.github.com>2014-08-16 16:35:02 +0300
commit2d61fc67ad2537068a14b3b5d4a467ae8ec665fc (patch)
tree93f07c1f65345f79f337acbc4004f9ec47a1e745 /src/game/g_weapon.c
parent95fb2db6af47c89821c59c7837bb93d9e59f00f7 (diff)
parent8816244ec329acdd5eb64e0518e69ae77df1cd75 (diff)
Merge pull request #7 from ppetr/medkit
Add the ability for humans to heal their team members
Diffstat (limited to 'src/game/g_weapon.c')
-rw-r--r--src/game/g_weapon.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index a64f0f8..feee414 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -1454,6 +1454,37 @@ void G_ClearPlayerZapEffects( gentity_t *player )
}
}
+
+/*
+===============
+G_MedkitTarget
+
+Look for a possible healing target (a client) in the front.
+===============
+*/
+gentity_t *G_MedkitTarget( gentity_t *ent )
+{
+ trace_t tr;
+ gentity_t *targetEnt = NULL;
+
+ if( g_humanMedkitRange.value <= 0 ||
+ g_humanMedkitWidth.value <= 0 )
+ return NULL;
+
+ // Calculate muzzle point
+ AngleVectors( ent->client->ps.viewangles, forward, right, up );
+ CalcMuzzlePoint( ent, forward, right, up, muzzle );
+
+ G_WideTrace( &tr, ent, g_humanMedkitRange.value,
+ g_humanMedkitWidth.value, g_humanMedkitWidth.value, &targetEnt );
+
+ if( ( targetEnt != NULL ) &&
+ ( targetEnt->client != NULL ) )
+ return targetEnt;
+ else
+ return NULL;
+}
+
/*
===============
areaZapFire