summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_buildable.c54
-rw-r--r--src/game/g_combat.c11
3 files changed, 59 insertions, 7 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index c8f95098..0d9a4838 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -894,6 +894,7 @@ typedef enum
MOD_ATUBE,
MOD_OVERMIND,
MOD_DECONSTRUCT,
+ MOD_REPLACE,
MOD_NOCREEP
} meansOfDeath_t;
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 48ac579b..1ac2fd28 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -3017,10 +3017,17 @@ G_FreeMarkedBuildables
Free up build points for a team by deconstructing marked buildables
===============
*/
-void G_FreeMarkedBuildables( gentity_t *deconner )
+void G_FreeMarkedBuildables( gentity_t *deconner, char *buffer, int size )
{
int i;
+ int bNum;
+ int listItems = 0;
+ int totalListItems = 0;
gentity_t *ent;
+ int removalCounts[ BA_NUM_BUILDABLES ] = {0};
+
+ if( buffer )
+ buffer[0] = '\0';
if( !g_markDeconstruct.integer )
return; // Not enabled, can't deconstruct anything
@@ -3028,10 +3035,34 @@ void G_FreeMarkedBuildables( gentity_t *deconner )
for( i = 0; i < level.numBuildablesForRemoval; i++ )
{
ent = level.markedBuildables[ i ];
+ bNum = BG_Buildable( ent->s.modelindex )->number;
+
+ if( removalCounts[ bNum ] == 0 )
+ totalListItems++;
- G_Damage( ent, NULL, deconner, NULL, NULL, ent->health, 0, MOD_DECONSTRUCT );
+ removalCounts[ bNum ]++;
+
+ G_Damage( ent, NULL, deconner, NULL, NULL, ent->health, 0, MOD_REPLACE );
G_FreeEntity( ent );
}
+
+ for( i = 0; i < BA_NUM_BUILDABLES; i++ )
+ {
+ if( buffer && removalCounts[ i ] )
+ {
+ if( listItems )
+ {
+ if( listItems == ( totalListItems - 1 ) )
+ Q_strcat( buffer, size, va( "%s and ", ( totalListItems > 2 ) ? "," : "" ) );
+ else
+ Q_strcat( buffer, size, ", " );
+ }
+ Q_strcat( buffer, size, va( "%s", BG_Buildable( i )->humanName ) );
+ if( removalCounts[ i ] > 1 )
+ Q_strcat( buffer, size, va( " x%d", removalCounts[ i ] ) );
+ listItems++;
+ }
+ }
}
/*
@@ -3472,9 +3503,10 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
{
gentity_t *built;
vec3_t normal;
+ char removed[ MAX_STRING_CHARS ];
// Free existing buildables
- G_FreeMarkedBuildables( builder );
+ G_FreeMarkedBuildables( builder, removed, sizeof( removed ) );
// Spawn the buildable
built = G_Spawn();
@@ -3691,6 +3723,22 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
trap_LinkEntity( built );
+ if( builder && builder->client )
+ {
+ G_TeamCommand( builder->client->ps.stats[ STAT_TEAM ],
+ va( "print \"%s ^2built^7 by %s%s%s\n\"",
+ BG_Buildable( built->s.modelindex )->humanName,
+ builder->client->pers.netname,
+ ( removed[0] ) ? "^7, replacing " : "",
+ removed ) );
+ G_LogPrintf( "Build: %d %d %d: %s^7 is building %s\n",
+ builder->client->ps.clientNum,
+ built->s.modelindex,
+ level.numBuildablesForRemoval,
+ builder->client->pers.netname,
+ BG_Buildable( built->s.modelindex )->name );
+ }
+
return built;
}
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index aabcbcbe..b44b4e37 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -127,6 +127,7 @@ char *modNames[ ] =
"MOD_ATUBE",
"MOD_OVERMIND",
"MOD_DECONSTRUCT",
+ "MOD_REPLACE",
"MOD_NOCREEP"
};
@@ -1024,7 +1025,8 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
}
}
- if( targ->s.eType == ET_BUILDABLE && attacker->client )
+ if( targ->s.eType == ET_BUILDABLE && attacker->client &&
+ mod != MOD_DECONSTRUCT && mod != MOD_REPLACE )
{
if( targ->buildableTeam == attacker->client->pers.teamSelection )
{
@@ -1036,7 +1038,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
// base is under attack warning if DCC'd
if( targ->buildableTeam == TEAM_HUMANS && G_FindDCC( targ ) &&
level.time > level.humanBaseAttackTimer &&
- mod != MOD_DECONSTRUCT && mod != MOD_SUICIDE )
+ mod != MOD_SUICIDE )
{
level.humanBaseAttackTimer = level.time + DC_ATTACK_PERIOD;
G_BroadcastEvent( EV_DCC_ATTACK, 0 );
@@ -1364,7 +1366,8 @@ void G_LogDestruction( gentity_t *self, gentity_t *actor, int mod )
if( !actor || !actor->client )
return;
- if( actor->client->ps.stats[ STAT_TEAM ] ==
+ if( mod != MOD_REPLACE &&
+ actor->client->ps.stats[ STAT_TEAM ] ==
BG_Buildable( self->s.modelindex )->team )
{
G_TeamCommand( actor->client->ps.stats[ STAT_TEAM ],
@@ -1374,7 +1377,7 @@ void G_LogDestruction( gentity_t *self, gentity_t *actor, int mod )
actor->client->pers.netname ) );
}
- if( mod == MOD_DECONSTRUCT )
+ if( mod == MOD_DECONSTRUCT || mod == MOD_REPLACE )
G_LogPrintf( "Decon: %d %d %d: %s^7 deconstructed %s\n",
actor->client->ps.clientNum,
self->s.modelindex,