diff options
author | Petr Pudlak <petr.mvd@gmail.com> | 2014-10-12 16:39:46 +0200 |
---|---|---|
committer | Petr Pudlak <petr.mvd@gmail.com> | 2014-10-18 19:59:22 +0200 |
commit | 9e9289b46d1efad930f09d691ad62fab7f84e8fe (patch) | |
tree | b5a583ed184b6b3806f4890a9fb8875b5f3bcc66 /src/game/g_buildable.c | |
parent | e7cd2f975492875faa2f26b3b13b8015d53a94d4 (diff) |
Add support for Weak Sudden Death
After it strikes, it's not possible to build near the Reactor/Overmind
and it's not possible to build refineries/creep colonies. This still
allows teams to build forward within the BP limit, but not strengthen
their main bases any more.
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r-- | src/game/g_buildable.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 65e7077..841038f 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -3894,6 +3894,46 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, return IBE_NONE; } + if( G_TimeTilWeakSuddenDeath( ) <= 0 ) + { + // No refineries/colonies after WSD + if( ( buildable == BA_H_REFINERY ) || ( buildable == BA_A_CREEPCOLONY ) ) + return IBE_WSD_REFSCOLS; + + // No building near OM/RC after WSD, unless it's a replacement + if( buildable != core ) + { + vec3_t temp_v; + + // Iterate through entities + distance = 0; + for( i = MAX_CLIENTS, ent = g_entities + i; i < level.num_entities; i++, ent++ ) + { + if( ent->s.eType != ET_BUILDABLE ) + continue; + + // If entity is a power item calculate the distance to it + if( ent->s.modelindex == core ) + { + if( ent->spawned && ent->health > 0 ) + { + VectorSubtract( origin, ent->s.origin, temp_v ); + distance = VectorLength( temp_v ); + } + break; + } + } + + if( distance > 0 ) // RC/OM found and it's alive + { + if( ( team == TEAM_ALIENS ) && ( distance <= CREEP_BASESIZE ) ) + return IBE_WSD_INBASE; + if( ( team == TEAM_HUMANS ) && ( distance <= REACTOR_BASESIZE ) ) + return IBE_WSD_INBASE; + } + } + } + // Simple non-marking case if( !g_markDeconstruct.integer ) { @@ -4776,6 +4816,14 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable ) G_TriggerMenu( ent->client->ps.clientNum, MN_B_GTHRBLOCKED ); return qfalse; + case IBE_WSD_INBASE: + G_TriggerMenu( ent->client->ps.clientNum, MN_B_WSD_INBASE ); + return qfalse; + + case IBE_WSD_REFSCOLS: + G_TriggerMenu( ent->client->ps.clientNum, MN_B_WSD_REFSCOLS ); + return qfalse; + default: break; } |