From 0238f457f4200a92e99e3be0a61a9870ea8ae560 Mon Sep 17 00:00:00 2001 From: Petr Pudlak Date: Sat, 20 Sep 2014 18:54:42 +0200 Subject: Add a separate mode of death for no-BP building suicides --- src/game/bg_public.h | 1 + src/game/g_buildable.c | 10 +++++----- src/game/g_combat.c | 11 ++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src/game') diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 886d29b..f8a2f9d 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -894,6 +894,7 @@ typedef enum MOD_DECONSTRUCT, MOD_REPLACE, MOD_NOCREEP, + MOD_NOBP, MOD_ABOMB } meansOfDeath_t; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 90df479..72d4d3c 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -527,15 +527,15 @@ G_Suicide let the given buildable suicide ================ */ -void G_Suicide( gentity_t *self ) +void G_Suicide( gentity_t *self, meansOfDeath_t death ) { const gentity_t *parent = self->parentNode; if( parent ) G_Damage( self, NULL, g_entities + parent->killedBy, NULL, NULL, - self->health, 0, MOD_NOCREEP ); + self->health, 0, death ); else - G_Damage( self, NULL, NULL, NULL, NULL, self->health, 0, MOD_NOCREEP ); + G_Damage( self, NULL, NULL, NULL, NULL, self->health, 0, death ); } /* @@ -978,7 +978,7 @@ void AGeneric_CreepCheck( gentity_t *self ) { if( !G_FindCreep( self ) ) { - G_Suicide( self ); + G_Suicide( self, MOD_NOCREEP ); return; } G_CreepSlow( self ); @@ -2331,7 +2331,7 @@ static qboolean G_SuicideIfNoPower( gentity_t *self ) self->count = level.time; else if( ( level.time - self->count ) >= HUMAN_BUILDABLE_INACTIVE_TIME ) { - G_Suicide( self ); + G_Suicide( self, MOD_NOCREEP ); return qtrue; } } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 073c00c..ada2f9c 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -143,7 +143,8 @@ char *modNames[ ] = "MOD_SLAP", "MOD_DECONSTRUCT", "MOD_REPLACE", - "MOD_NOCREEP", + "MOD_NOCREEP", + "MOD_NOBP", "MOD_ABOMB" }; @@ -1353,7 +1354,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, if( targ->s.eType == ET_BUILDABLE && attacker->client && mod != MOD_DECONSTRUCT && mod != MOD_SUICIDE && - mod != MOD_REPLACE && mod != MOD_NOCREEP ) + mod != MOD_REPLACE && mod != MOD_NOCREEP && mod != MOD_NOBP ) { if( targ->buildableTeam == attacker->client->pers.teamSelection && !g_friendlyBuildableFire.integer ) @@ -1781,6 +1782,9 @@ void G_LogDestruction( gentity_t *self, gentity_t *actor, int mod ) case MOD_NOCREEP: fate = ( actor->client ) ? BF_UNPOWER : BF_AUTO; break; + case MOD_NOBP: + fate = BF_UNPOWER; + break; default: if( actor->client ) { @@ -1813,7 +1817,8 @@ void G_LogDestruction( gentity_t *self, gentity_t *actor, int mod ) // No-power deaths for humans come after some minutes and it's confusing // when the messages appear attributed to the deconner. Just don't print them. - if( mod == MOD_NOCREEP && actor->client && + if( ( mod == MOD_NOCREEP && mod == MOD_NOBP ) && + actor->client && actor->client->pers.teamSelection == TEAM_HUMANS ) return; -- cgit