summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2020-03-08 21:12:11 +0000
committerIronClawTrem <louie.nutman@gmail.com>2020-03-08 22:39:51 +0000
commit43f455243b9590f757513504e56d56af263068ec (patch)
tree78b3d4b4f527940e9ee79da9c7b7b0cd1c124ac9
parent46a25a69f5b78426654d0365cd38571fb3f36b4f (diff)
must be in range of booster, not touching it
-rw-r--r--src/game/g_buildable.c62
-rw-r--r--src/game/tremulous.h1
2 files changed, 58 insertions, 5 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 1117aa7..d8612d6 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1521,8 +1521,58 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace )
client->lastBoostedTime = level.time;
}
+/*
+================
+ABooster_Think
+
+Boosts aliens that are in range and line of sight
+================
+*/
+void ABooster_Think( gentity_t *self )
+{
+ int i, num;
+ int entityList[ MAX_GENTITIES ];
+ vec3_t range, mins, maxs;
+ gentity_t *player;
+ gclient_t *client;
+ self->powered = G_IsOvermindBuilt( );
+
+ //if there is no creep nearby die
+ if( !G_FindCreep( self ) )
+ {
+ G_Damage( self, NULL, NULL, NULL, NULL, 10000, 0, MOD_SUICIDE );
+ return;
+ }
+
+ G_CreepSlow( self );
+
+ self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+ VectorSet( range, REGEN_BOOST_RANGE, REGEN_BOOST_RANGE,
+ REGEN_BOOST_RANGE );
+ VectorAdd( self->r.currentOrigin, range, maxs );
+ VectorSubtract( self->r.currentOrigin, range, mins );
+
+ num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
+ for( i = 0; i < num; i++ )
+ {
+ player = &g_entities[ entityList[ i ] ];
+ client = player->client;
+
+ if( !client )
+ continue;
+
+ if( client->ps.stats[ STAT_PTEAM ] != PTE_ALIENS )
+ continue;
+
+ if( Distance( client->ps.origin, self->r.currentOrigin ) > REGEN_BOOST_RANGE )
+ continue;
+
+ client->ps.stats[ STAT_STATE ] |= SS_BOOSTED;
+ client->lastBoostedTime = level.time;
+ }
+}
//==================================================================================
@@ -3550,7 +3600,7 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori
case BA_A_BOOSTER:
built->die = ABarricade_Die;
- built->think = ABarricade_Think;
+ built->think = ABooster_Think;
built->pain = ABarricade_Pain;
built->touch = ABooster_Touch;
break;
@@ -4378,12 +4428,14 @@ void G_CommitRevertedBuildable( gentity_t *ent )
switch( ent->s.modelindex )
{
case BA_A_SPAWN:
- ent->think = ASpawn_Think;
- break;
- case BA_A_BARRICADE:
- case BA_A_BOOSTER:
+ ent->think = ASpawn_Think;
+ break;
+ case BA_A_BARRICADE:
ent->think = ABarricade_Think;
break;
+ case BA_A_BOOSTER:
+ ent->think = ABooster_Think;
+ break;
case BA_A_ACIDTUBE:
ent->think = AAcidTube_Think;
break;
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index 423d465..65bd3ca 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -250,6 +250,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define BOOSTER_INTERVAL 30000 //time in msec between uses (per player)
#define BOOSTER_REGEN_MOD 2.0f
#define BOOST_TIME 30000
+#define REGEN_BOOST_RANGE 100.0f
#define ACIDTUBE_BP 8
#define ACIDTUBE_BT 15000