diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2011-04-15 17:54:16 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:18:04 +0000 |
commit | d31e81e51f139354deb7f262062d69920eb2a448 (patch) | |
tree | 3d9813060e127dc98929dfd022ecae9db025cca0 /src/game/g_buildable.c | |
parent | 9dc78be8b539c1191e4a08720cbb1ef4f0954f0e (diff) |
* Fix incorrect human buildable power sources in some cases, and the ability to exploit this to make infinite unpowered buildables (thanks /dev/humancontroller, UniqPhoenix)
* Fix unpowered human buildables spawned by layouts not exploding
* Change unpowered human buildables to still explode when there is no reactor
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r-- | src/game/g_buildable.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index be0d7b47..2c3d0250 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1545,24 +1545,22 @@ static void G_SuicideIfNoPower( gentity_t *self ) if( self->buildableTeam != TEAM_HUMANS ) return; - if( G_Reactor( ) && !self->powered ) + if( !self->powered ) { - // If no parent for x seconds then disappear - if( self->count < 0 ) + // if the power hasn't reached this buildable for some time, then destroy the buildable + if( self->count == 0 ) self->count = level.time; - else if( self->count > 0 && ( ( level.time - self->count ) > HUMAN_BUILDABLE_INACTIVE_TIME ) ) + else if( ( level.time - self->count ) >= HUMAN_BUILDABLE_INACTIVE_TIME ) { if( self->parentNode ) - G_Damage( self, NULL, g_entities + self->parentNode->killedBy, + G_Damage( self, NULL, g_entities + self->parentNode->killedBy, NULL, NULL, self->health, 0, MOD_NOCREEP ); else G_Damage( self, NULL, NULL, NULL, NULL, self->health, 0, MOD_NOCREEP ); } } else - { - self->count = -1; - } + self->count = 0; } /* @@ -1687,11 +1685,11 @@ void HSpawn_Think( gentity_t *self ) { gentity_t *ent; - G_SuicideIfNoPower( self ); - // set parentNode self->powered = G_FindPower( self, qfalse ); + G_SuicideIfNoPower( self ); + if( self->spawned ) { //only suicide if at rest @@ -1779,23 +1777,10 @@ Think for human power repeater void HRepeater_Think( gentity_t *self ) { int i; - qboolean reactor = qfalse; - gentity_t *ent; gentity_t *powerEnt; buildPointZone_t *zone; - if( self->spawned ) - { - // Iterate through entities - for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ ) - { - if( ent->s.eType != ET_BUILDABLE ) - continue; - - if( ent->s.modelindex == BA_H_REACTOR && ent->spawned && ent->health > 0 ) - reactor = qtrue; - } - } + self->powered = G_FindPower( self, qfalse ); powerEnt = G_InPowerZone( self ); if( powerEnt != NULL ) @@ -1810,8 +1795,6 @@ void HRepeater_Think( gentity_t *self ) return; } - self->powered = reactor; - G_IdlePowerState( self ); // Initialise the zone once the repeater has spawned |