commit 708b04f172ad3be7ff409c2dc22e396d7fcb6add Author: devhc Date: Thu Apr 21 21:08:42 2011 +0200 relax the in-power-range condition a bit for repeaters, to help unstable/imprecise physics diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 6ae822f..cdd528e 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -411,9 +411,10 @@ Return pointer to provider if so. It's different from G_FindPower because FindPower for providers will find themselves. (This doesn't check if power zones overlap) +The 2nd parameter allows power range seaches to be relaxed/restricted. ================== */ -gentity_t *G_InPowerZone( gentity_t *self ) +gentity_t *G_InPowerZone( gentity_t *self, float rangeIncr ) { int i; gentity_t *ent; @@ -441,9 +442,9 @@ gentity_t *G_InPowerZone( gentity_t *self ) VectorSubtract( self->s.origin, ent->s.origin, temp_v ); distance = VectorLength( temp_v ); - if( ent->s.modelindex == BA_H_REACTOR && distance <= REACTOR_BASESIZE ) + if( ent->s.modelindex == BA_H_REACTOR && distance <= REACTOR_BASESIZE + rangeIncr ) return ent; - else if( ent->s.modelindex == BA_H_REPEATER && distance <= REPEATER_BASESIZE ) + else if( ent->s.modelindex == BA_H_REPEATER && distance <= REPEATER_BASESIZE + rangeIncr ) return ent; } } @@ -1774,7 +1775,8 @@ void HRepeater_Think( gentity_t *self ) self->powered = G_FindPower( self, qfalse ); - powerEnt = G_InPowerZone( self ); + // relax the in-range condition a bit to help unstable/imprecise physics + powerEnt = G_InPowerZone( self, -1.0f ); if( powerEnt != NULL ) { // If the repeater is inside of another power zone then suicide diff --git a/src/game/g_local.h b/src/game/g_local.h index 1497402..87283d8 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -808,7 +808,7 @@ qboolean G_FindPower( gentity_t *self, qboolean searchUnspawned ); gentity_t *G_PowerEntityForPoint( const vec3_t origin ); gentity_t *G_PowerEntityForEntity( gentity_t *ent ); gentity_t *G_RepeaterEntityForPoint( vec3_t origin ); -gentity_t *G_InPowerZone( gentity_t *self ); +gentity_t *G_InPowerZone( gentity_t *self, float rangeIncr ); buildLog_t *G_BuildLogNew( gentity_t *actor, buildFate_t fate ); void G_BuildLogSet( buildLog_t *log, gentity_t *ent ); void G_BuildLogAuto( gentity_t *actor, gentity_t *buildable, buildFate_t fate );