diff options
author | Asa Kravets <norfenstein@gmail.com> | 2011-04-04 23:34:28 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:18:03 +0000 |
commit | 99436a23e7f2ca74401f90b79c865280c5086ff1 (patch) | |
tree | d6e2e826f0266075c05a838410b1a4246b0b328b /src/game/g_weapon.c | |
parent | a8bd455bbcc8c5e582ce0526a8b5453052c26610 (diff) |
* Change trample to not lose all charge on hitting a structure, and keep track of structures to only allow one hit each (thanks Lakitu7)
Diffstat (limited to 'src/game/g_weapon.c')
-rw-r--r-- | src/game/g_weapon.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index a6566d72..1c227ffd 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -1366,6 +1366,7 @@ G_ChargeAttack void G_ChargeAttack( gentity_t *ent, gentity_t *victim ) { int damage; + int i; vec3_t forward, normal; if( ent->client->ps.stats[ STAT_MISC ] <= 0 || @@ -1376,10 +1377,26 @@ void G_ChargeAttack( gentity_t *ent, gentity_t *victim ) VectorSubtract( victim->s.origin, ent->s.origin, forward ); VectorNormalize( forward ); VectorNegate( forward, normal ); - + if( !victim->takedamage ) return; + // For buildables, track the last MAX_TRAMPLE_BUILDABLES_TRACKED buildables + // hit, and do not do damage if the current buildable is in that list + // in order to prevent dancing over stuff to kill it very quickly + if( !victim->client ) + { + for( i = 0; i < MAX_TRAMPLE_BUILDABLES_TRACKED; i++ ) + { + if( ent->client->trampleBuildablesHit[ i ] == victim - g_entities ) + return; + } + + ent->client->trampleBuildablesHit[ + ent->client->trampleBuildablesHitPos++ % MAX_TRAMPLE_BUILDABLES_TRACKED ] = + victim - g_entities; + } + WideBloodSpurt( ent, victim, NULL ); damage = LEVEL4_TRAMPLE_DMG * ent->client->ps.stats[ STAT_MISC ] / @@ -1389,9 +1406,6 @@ void G_ChargeAttack( gentity_t *ent, gentity_t *victim ) DAMAGE_NO_LOCDAMAGE, MOD_LEVEL4_TRAMPLE ); ent->client->ps.weaponTime += LEVEL4_TRAMPLE_REPEAT; - - if( !victim->client ) - ent->client->ps.stats[ STAT_MISC ] = 0; } /* |