summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/g_buildable.c11
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/g_weapon.c44
-rw-r--r--src/game/tremulous.h2
4 files changed, 39 insertions, 20 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index e24edc57..5d09c9b4 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1743,7 +1743,13 @@ qboolean HMGTurret_TrackEnemy( gentity_t *self )
float temp, rotAngle;
float accuracyTolerance, angularSpeed;
- if( self->dcced )
+ if( self->lev1Grabbed )
+ {
+ //can't turn fast if grabbed
+ accuracyTolerance = MGTURRET_GRAB_ACCURACYTOLERANCE;
+ angularSpeed = MGTURRET_GRAB_ANGULARSPEED;
+ }
+ else if( self->dcced )
{
accuracyTolerance = MGTURRET_DCC_ACCURACYTOLERANCE;
angularSpeed = MGTURRET_DCC_ANGULARSPEED;
@@ -2310,6 +2316,9 @@ void G_BuildableThink( gentity_t *ent, int msec )
ent->health = bHealth;
}
+ if( ent->lev1Grabbed && ent->lev1GrabTime + LEVEL1_GRAB_TIME < level.time )
+ ent->lev1Grabbed = qfalse;
+
if( ent->clientSpawnTime > 0 )
ent->clientSpawnTime -= msec;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 2db714f2..c0f4db88 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -204,6 +204,8 @@ struct gentity_s
int nextPhysicsTime; //TA: buildables don't need to check what they're sitting on
// every single frame.. so only do it periodically
int clientSpawnTime; //TA: the time until this spawn can spawn a client
+ qboolean lev1Grabbed; //TA: for turrets interacting with lev1s
+ int lev1GrabTime; //TA: for turrets interacting with lev1s
int credits[ MAX_CLIENTS ]; //TA: human credits for each client
qboolean creditsHash[ MAX_CLIENTS ]; //TA: track who has claimed credit
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index c12c82d0..5c26002a 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -790,29 +790,35 @@ void CheckGrabAttack( gentity_t *ent )
if( !traceEnt->takedamage )
return;
- if( !traceEnt->client )
- return;
-
- if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- return;
-
- if( traceEnt->client->ps.stats[ STAT_HEALTH ] <= 0 )
- return;
-
- if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) )
+ if( traceEnt->client )
{
- AngleVectors( traceEnt->client->ps.viewangles, dir, NULL, NULL );
- traceEnt->client->ps.stats[ STAT_VIEWLOCK ] = DirToByte( dir );
+ if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
+ return;
+
+ if( traceEnt->client->ps.stats[ STAT_HEALTH ] <= 0 )
+ return;
+
+ if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) )
+ {
+ AngleVectors( traceEnt->client->ps.viewangles, dir, NULL, NULL );
+ traceEnt->client->ps.stats[ STAT_VIEWLOCK ] = DirToByte( dir );
+
+ //event for client side grab effect
+ G_AddPredictableEvent( ent, EV_LEV1_GRAB, 0 );
+ }
+
+ traceEnt->client->ps.stats[ STAT_STATE ] |= SS_GRABBED;
+ traceEnt->client->lastGrabTime = level.time;
}
-
- if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) )
+ else if( traceEnt->s.eType == ET_BUILDABLE &&
+ traceEnt->s.modelindex == BA_H_MGTURRET )
{
- //event for client side grab effect
- G_AddPredictableEvent( ent, EV_LEV1_GRAB, 0 );
+ if( !traceEnt->lev1Grabbed )
+ G_AddPredictableEvent( ent, EV_LEV1_GRAB, 0 );
+
+ traceEnt->lev1Grabbed = qtrue;
+ traceEnt->lev1GrabTime = level.time;
}
-
- traceEnt->client->ps.stats[ STAT_STATE ] |= SS_GRABBED;
- traceEnt->client->lastGrabTime = level.time;
}
/*
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index 5f7831ec..8c137c23 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -485,6 +485,8 @@
#define MGTURRET_DMG HDM(4)
#define MGTURRET_DCC_ANGULARSPEED 10
#define MGTURRET_DCC_ACCURACYTOLERANCE MGTURRET_DCC_ANGULARSPEED / 1.5f
+#define MGTURRET_GRAB_ANGULARSPEED 3
+#define MGTURRET_GRAB_ACCURACYTOLERANCE MGTURRET_GRAB_ANGULARSPEED / 1.5f
#define TESLAGEN_BP 10
#define TESLAGEN_BT 15000