diff options
author | Petr Pudlak <petr.mvd@gmail.com> | 2014-08-16 14:26:16 +0200 |
---|---|---|
committer | Petr Pudlak <petr.mvd@gmail.com> | 2014-08-16 14:26:16 +0200 |
commit | 8816244ec329acdd5eb64e0518e69ae77df1cd75 (patch) | |
tree | c7a7614c537a79b29452695c94ee7597b69e7993 /src/cgame | |
parent | fc765f5f146627d282b4374dd0c575895d64a900 (diff) |
Add the ability for humans to heal their team members
The medkit handling is moved to a new function G_UseMedkit.
If there is a human within a given range that is either more wounded
than the player, or poisoned, the medkit is applied to him
(see G_NeedsMedkit).
The range and the breadth of the action is configurable by cvars.
The original patch was used on a server, but this port wasn't tested
(only that it compiles).
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_event.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 2baf545..aa84609 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -1228,6 +1228,31 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) break; case EV_MEDKIT_USED: + // the parameter is the healer's entity number + { + const int healerNum = es->eventParm; + const char *configstring; + const char *name; + + if( healerNum != clientNum ) + { + if( healerNum == cg.clientNum ) + { + configstring = CG_ConfigString( clientNum + CS_PLAYERS ); + // isolate the player's name + name = Info_ValueForKey( configstring, "n" ); + + CG_Printf( S_COLOR_CYAN "You bandaged " S_COLOR_WHITE "%s" S_COLOR_CYAN "'s wounds.\n", name ); + } else if( clientNum == cg.clientNum ) + { + configstring = CG_ConfigString( healerNum + CS_PLAYERS ); + // isolate the player's name + name = Info_ValueForKey( configstring, "n" ); + + CG_Printf( S_COLOR_WHITE "%s" S_COLOR_CYAN " bandaged your wounds.\n", name ); + } + } + } trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.medkitUseSound ); break; |