diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_pmove.c | 2 | ||||
-rw-r--r-- | src/game/g_buildable.c | 2 | ||||
-rw-r--r-- | src/game/g_client.c | 31 | ||||
-rw-r--r-- | src/game/g_local.h | 2 |
4 files changed, 31 insertions, 6 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index adccbca6..037ab92c 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -1492,7 +1492,7 @@ static void PM_GroundClimbTrace( void ) //if we hit something if( trace.fraction < 1.0 && !( trace.surfaceFlags & ( SURF_SKY | SURF_NOIMPACT ) ) && - !( trace.entityNum != 1022 && i != 3 ) ) + !( trace.entityNum != ENTITYNUM_WORLD && i != 3 ) ) { if( i == 2 ) VectorCopy( trace.endpos, pm->ps->origin ); diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 9d836776..59ff97e7 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1271,6 +1271,7 @@ gentity_t *Build_Item( gentity_t *ent, buildable_t buildable, int distance ) { built->s.number = built - g_entities; built->r.contents = CONTENTS_BODY; built->clipmask = MASK_PLAYERSOLID; + built->builtBy = ent->client->ps.clientNum; G_SetOrigin( built, origin ); VectorCopy( angles, built->s.angles ); @@ -1283,4 +1284,3 @@ gentity_t *Build_Item( gentity_t *ent, buildable_t buildable, int distance ) { return built; } - diff --git a/src/game/g_client.c b/src/game/g_client.c index 262d7914..38afac43 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -549,7 +549,12 @@ void useBody( gentity_t *self, gentity_t *other, gentity_t *activator ) if( activator->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS ) { //can't pick teammates bodies to bits - if( !Q_stricmp( self->classname, "droidCorpse" ) ) return; + if( !Q_stricmp( self->classname, "droidCorpse" ) ) + return; + + //can't use bodies that are not owned + if( self->killedBy > 0 && self->killedBy != activator->client->ps.clientNum ) + return; G_AddPredictableEvent( activator, EV_MENU, MN_D_INFEST ); } @@ -560,10 +565,12 @@ void useBody( gentity_t *self, gentity_t *other, gentity_t *activator ) class = self->s.clientNum; //can't pick teammates bodies to bits - if( !Q_stricmp( self->classname, "humanCorpse" ) ) return; + if( !Q_stricmp( self->classname, "humanCorpse" ) ) + return; //client has already raided this corpse - if( self->creditsHash[ clientNum ] ) return; + if( self->creditsHash[ clientNum ] ) + return; //total up all the damage done by every client for( i = 0; i < MAX_CLIENTS; i++ ) @@ -603,7 +610,8 @@ A player is respawning, so make an entity that looks just like the existing corpse to leave behind. ============= */ -void SpawnCorpse( gentity_t *ent ) { +void SpawnCorpse( gentity_t *ent ) +{ gentity_t *body; int contents; vec3_t origin, dest; @@ -624,7 +632,22 @@ void SpawnCorpse( gentity_t *ent ) { if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { + gentity_t *buildable = &g_entities[ ent->client->lasthurt_client ]; + body->classname = "humanCorpse"; + + if( ent->client->lasthurt_client < MAX_CLIENTS ) + { + //client suicide - body is freebie + if( ent->client->ps.clientNum == ent->client->lasthurt_client ) + body->killedBy = -1; + else //owned by killer + body->killedBy = ent->client->lasthurt_client; + } + else if( buildable && buildable->s.eType == ET_BUILDABLE ) //owned by builder + body->killedBy = buildable->builtBy; + else // *shrugs* probably killed by some map entity - freebie + body->killedBy = -1; } else { diff --git a/src/game/g_local.h b/src/game/g_local.h index f4e796ae..6404e6b6 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -185,9 +185,11 @@ struct gentity_s { gentity_t *parentNode; //TA: for creep and defence/spawn dependencies qboolean active; //TA: for power repeater, but could be useful elsewhere qboolean powered; //TA: for human buildables + int builtBy; //TA: clientNum of person that built this int credits[ MAX_CLIENTS ]; //TA: human credits for each client qboolean creditsHash[ MAX_CLIENTS ]; //TA: track who has claimed credit + int killedBy; //TA: clientNum of killer }; typedef enum { |