summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_buildable.c31
-rw-r--r--src/game/tremulous.h3
2 files changed, 33 insertions, 1 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 7909c7de..496b832b 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1763,6 +1763,25 @@ void ATrapper_Think( gentity_t *self )
+static void G_SuicideIfNoPower( gentity_t *self )
+{
+ if( self->buildableTeam != TEAM_HUMANS )
+ return;
+
+ if( G_Reactor( ) && !self->parentNode )
+ {
+ // If no parent for x seconds then disappear
+ if( self->count < 0 )
+ self->count = level.time;
+ else if( self->count > 0 && ( ( level.time - self->count ) > HUMAN_BUILDABLE_INACTIVE_TIME ) )
+ G_Damage( self, NULL, NULL, NULL, NULL, self->health, 0, MOD_SUICIDE );
+ }
+ else
+ {
+ self->count = -1;
+ }
+}
+
void HSpawn_Blast( gentity_t *ent );
void HSpawn_Disappear( gentity_t *ent );
@@ -1996,6 +2015,8 @@ void HArmoury_Think( gentity_t *self )
self->nextthink = level.time + POWER_REFRESH_TIME;
self->powered = G_FindPower( self );
+
+ G_SuicideIfNoPower( self );
}
@@ -2020,6 +2041,8 @@ void HDCC_Think( gentity_t *self )
self->nextthink = level.time + POWER_REFRESH_TIME;
self->powered = G_FindPower( self );
+
+ G_SuicideIfNoPower( self );
}
@@ -2064,6 +2087,8 @@ void HMedistat_Think( gentity_t *self )
self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
+ G_SuicideIfNoPower( self );
+
//clear target's healing flag
if( self->enemy && self->enemy->client )
self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_HEALING_ACTIVE;
@@ -2332,6 +2357,8 @@ void HMGTurret_Think( gentity_t *self )
// Turn off client side muzzle flashes
self->s.eFlags &= ~EF_FIRING;
+ G_SuicideIfNoPower( self );
+
// If not powered or spawned don't do anything
if( !( self->powered = G_FindPower( self ) ) )
{
@@ -2402,6 +2429,8 @@ void HTeslaGen_Think( gentity_t *self )
{
self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink;
+ G_SuicideIfNoPower( self );
+
//if not powered don't do anything and check again for power next think
if( !( self->powered = G_FindPower( self ) ) )
{
@@ -2549,6 +2578,8 @@ void HSpawn_Think( gentity_t *self )
// spawns work without power
self->powered = qtrue;
+ G_SuicideIfNoPower( self );
+
// set parentNode
G_FindPower( self );
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index c9afe650..4903edf2 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -614,7 +614,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define REPEATER_HEALTH HBHM(250)
#define REPEATER_SPLASHDAMAGE 50
#define REPEATER_SPLASHRADIUS 100
-#define REPEATER_INACTIVE_TIME 90000
#define REPEATER_VALUE HBVM(2)
/*
@@ -647,6 +646,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define HUMAN_BUILDER_SCOREINC 50 // builders receive this many points every 10 seconds
#define ALIEN_BUILDER_SCOREINC AVM(50) // builders receive this many points every 10 seconds
+#define HUMAN_BUILDABLE_INACTIVE_TIME 90000
+
/*
* Misc
*/