summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2011-01-22 17:57:47 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:53 +0000
commita363a414e0e1d5c74ba15239b375e4c3e940cc6a (patch)
tree763ec6d0082070407cceee6d9a7ede70f24b10b4 /src/game
parentdcc1aa0ccfef2ff8d14e96c61102214c5536ae4d (diff)
* (bug 4818) Do not queue BP from reactors when a reactor is built nearby (thanks Asvarox)
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_buildable.c26
-rw-r--r--src/game/g_local.h2
2 files changed, 19 insertions, 9 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 786dd19f..bdca875b 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -370,11 +370,14 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance )
==================
G_InPowerZone
-See if a buildable is inside of another power zone
+See if a buildable is inside of another power zone.
+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)
==================
*/
-qboolean G_InPowerZone( gentity_t *self )
+gentity_t *G_InPowerZone( gentity_t *self )
{
int i;
gentity_t *ent;
@@ -403,13 +406,13 @@ qboolean G_InPowerZone( gentity_t *self )
distance = VectorLength( temp_v );
if( ent->s.modelindex == BA_H_REACTOR && distance <= REACTOR_BASESIZE )
- return qtrue;
+ return ent;
else if( ent->s.modelindex == BA_H_REPEATER && distance <= REPEATER_BASESIZE )
- return qtrue;
+ return ent;
}
}
- return qfalse;
+ return NULL;
}
/*
@@ -1732,6 +1735,7 @@ void HRepeater_Think( gentity_t *self )
int i;
qboolean reactor = qfalse;
gentity_t *ent;
+ gentity_t *powerEnt;
buildPointZone_t *zone;
if( self->spawned )
@@ -1747,10 +1751,16 @@ void HRepeater_Think( gentity_t *self )
}
}
- if( G_InPowerZone( self ) )
+ powerEnt = G_InPowerZone( self );
+ if( powerEnt != NULL )
{
- // if the repeater is inside of another power zone then disappear
- G_Damage( self, NULL, NULL, NULL, NULL, self->health, 0, MOD_SUICIDE );
+ // If the repeater is inside of another power zone then suicide
+ // Attribute death to whoever built the reactor if that's a human,
+ // which will ensure that it does not queue the BP
+ if( powerEnt->builtBy >= 0 )
+ G_Damage( self, NULL, g_entities + powerEnt->builtBy, NULL, NULL, self->health, 0, MOD_SUICIDE );
+ else
+ G_Damage( self, NULL, NULL, NULL, NULL, self->health, 0, MOD_SUICIDE );
return;
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 277556d9..e8575049 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -807,7 +807,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 );
-qboolean G_InPowerZone( gentity_t *self );
+gentity_t *G_InPowerZone( gentity_t *self );
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 );