From 6856a392e607a42708c8d3cf78c3254aa32b3e73 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sat, 14 Feb 2004 21:00:50 +0000 Subject: * Fixed vieworg leaving PVS on death for classes with small BBOX * Medistat now only heals one at a time * Alien blood never red now * Scaled down build points, hud now shows actual value * Added a "width" parameter to every melee attack * Added "sell weapons" and "sell upgrades" commands * Reduced pulse rifle strength a bit --- src/game/g_buildable.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'src/game/g_buildable.c') diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 29245882..fec593f2 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1560,8 +1560,7 @@ void HMedistat_Think( gentity_t *self ) vec3_t mins, maxs; int i, num; gentity_t *player; - int healCount = 0; - int maxclients; + qboolean occupied = qfalse; self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); @@ -1574,8 +1573,6 @@ void HMedistat_Think( gentity_t *self ) if( self->spawned ) { - maxclients = MAX_MEDISTAT_CLIENTS; - VectorAdd( self->s.origin, self->r.maxs, maxs ); VectorAdd( self->s.origin, self->r.mins, mins ); @@ -1586,7 +1583,7 @@ void HMedistat_Think( gentity_t *self ) if( self->active ) G_setIdleBuildableAnim( self, BANIM_IDLE2 ); - //do some healage + //check if a previous occupier is still here num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); for( i = 0; i < num; i++ ) { @@ -1596,29 +1593,48 @@ void HMedistat_Think( gentity_t *self ) { if( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] && player->client->ps.pm_type != PM_DEAD && - healCount < maxclients ) + self->enemy == player ) + occupied = qtrue; + } + } + + if( !occupied ) + { + self->enemy = NULL; + + //look for something to heal + for( i = 0; i < num; i++ ) + { + player = &g_entities[ entityList[ i ] ]; + + if( player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { - healCount++; - player->health++; - - //start the heal anim - if( !self->active ) + if( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] && + player->client->ps.pm_type != PM_DEAD ) { - G_setBuildableAnim( self, BANIM_ATTACK1, qfalse ); - self->active = qtrue; + self->enemy = player; + + //start the heal anim + if( !self->active ) + { + G_setBuildableAnim( self, BANIM_ATTACK1, qfalse ); + self->active = qtrue; + } } } } } //nothing left to heal so go back to idling - if( healCount == 0 && self->active ) + if( !self->enemy && self->active ) { G_setBuildableAnim( self, BANIM_CONSTRUCT2, qtrue ); G_setIdleBuildableAnim( self, BANIM_IDLE1 ); self->active = qfalse; } + else //heal! + self->enemy->health++; } } -- cgit