summaryrefslogtreecommitdiff
path: root/src/game/g_buildable.c
diff options
context:
space:
mode:
authorMikko Tiusanen <ams@daug.net>2014-07-19 18:31:58 +0300
committerMikko Tiusanen <ams@daug.net>2014-07-19 18:31:58 +0300
commit1443bb9fe3bfd7df935379c80b399b0425e384e8 (patch)
tree4f1f80297c3036bc6ac9146239872022d58bc5af /src/game/g_buildable.c
parent002c367d2cb034e02e9e23aaeca29365955c9f9e (diff)
Activated force fields now also push back humans inside their radius.
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r--src/game/g_buildable.c64
1 files changed, 28 insertions, 36 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 954a546..c266e0b 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1646,31 +1646,25 @@ void G_Push( gentity_t *self )
vec3_t range = { PUSH_RANGE, PUSH_RANGE, PUSH_RANGE };
vec3_t mins, maxs;
int i, num;
-// int a;
gentity_t *enemy;
vec3_t start,dir,end;
float force;
-
self->nextthink = level.time + PUSH_REPEAT;
VectorAdd( self->s.origin, range, maxs );
VectorSubtract( self->s.origin, range, mins );
-
- self->powered = G_FindPower( self, qfalse );
+ self->powered = G_FindPower( self, qfalse );
if( !self->spawned ) {
return;
- }
+ }
if( !self->powered ) {
- G_SetIdleBuildableAnim( self, BANIM_CONSTRUCT1 );
+ G_SetIdleBuildableAnim( self, BANIM_CONSTRUCT1 );
return;
- }
-
- if( self->powered )
- {
+ }
if( self->spawned && self->health > 0 && self->powered )
{
@@ -1683,43 +1677,42 @@ void G_Push( gentity_t *self )
continue;
if( !G_Visible( self, enemy, CONTENTS_SOLID ) )
- continue;
+ continue;
if (enemy->client && enemy->client->notrackEndTime >= level.time)
continue;
+ if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] != TEAM_NONE )
+ {
+ if (enemy == self)
+ continue;
- if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )
- {
- if (enemy == self)
- continue;
+ if (!enemy->client)
+ continue;
- if (!enemy->client)
- continue;
+ if (enemy == self->parent)
+ continue;
- if (enemy == self->parent)
- continue;
-
- if (!enemy->takedamage)
- continue;
+ if (!enemy->takedamage)
+ continue;
- if ( enemy->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_LEVEL5 )
- force = PUSH_FORCE;
- else
- force = WEAK_PUSH_FORCE;
+ if ( enemy->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_LEVEL5 )
+ force = PUSH_FORCE;
+ else
+ force = WEAK_PUSH_FORCE;
- VectorCopy(enemy->r.currentOrigin, start);
- VectorCopy(self->r.currentOrigin, end);
- VectorSubtract(end, start, dir);
- VectorNormalize(dir);
- VectorScale(dir, force, enemy->client->ps.velocity);
- VectorCopy(dir, enemy->movedir);
- }
+ VectorCopy(enemy->r.currentOrigin, start);
+ VectorCopy(self->r.currentOrigin, end);
+ VectorSubtract(end, start, dir);
+ VectorNormalize(dir);
+ VectorScale(dir, force, enemy->client->ps.velocity);
+ VectorCopy(dir, enemy->movedir);
+ }
- if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )
+ if( enemy->client && enemy->client->ps.stats[ STAT_TEAM ] != TEAM_NONE )
{
// start the attack animation
- G_AddEvent( self, EV_FORCE_FIELD, DirToByte( self->s.origin2 ) );
+ G_AddEvent( self, EV_FORCE_FIELD, DirToByte( self->s.origin2 ) );
if( level.time >= self->timestamp + 500 )
{
@@ -1731,7 +1724,6 @@ void G_Push( gentity_t *self )
}
}
}
-}
/*