summaryrefslogtreecommitdiff
path: root/src/game/g_buildable.c
diff options
context:
space:
mode:
authormtiusane <mtiusane@users.noreply.github.com>2014-10-18 21:00:33 +0300
committermtiusane <mtiusane@users.noreply.github.com>2014-10-18 21:00:33 +0300
commitd427c2d880786507e57ad943be39c559421d3190 (patch)
tree63850e0431c9336b7e4ea98eb90a23f4f3c8e924 /src/game/g_buildable.c
parente7cd2f975492875faa2f26b3b13b8015d53a94d4 (diff)
parentc8e426354b1b42a6870e7e44c8e92a7fc0531ede (diff)
Merge pull request #12 from ppetr/wsd
Weak sudden death
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r--src/game/g_buildable.c48
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;
}