diff options
-rw-r--r-- | entities.def | 12 | ||||
-rw-r--r-- | src/game/g_main.c | 17 | ||||
-rw-r--r-- | src/game/g_spawn.c | 2 | ||||
-rw-r--r-- | src/game/g_trigger.c | 20 |
4 files changed, 51 insertions, 0 deletions
diff --git a/entities.def b/entities.def index df331a0a..87ed6127 100644 --- a/entities.def +++ b/entities.def @@ -1485,6 +1485,18 @@ stage: the stage at which this entity is triggered; 1 for stage 2, 2 for stage 3 //============================================================================= +/*QUAKED trigger_win (.5 .5 .5) (-8 -8 -8) (8 8 8) +Fires its targets when the team key wins. +UNTESTED: please report whether or not this works for you. + +-------- KEYS -------- +target: this points to the entity to activate. + +team: the team which triggers this entity; 1 for aliens, 2 for humans +*/ + +//============================================================================= + /*QUAKED trigger_always (.5 .5 .5) (-8 -8 -8) (8 8 8) Automatic trigger. It will fire the entities it targets as soon as it spawns in the game. diff --git a/src/game/g_main.c b/src/game/g_main.c index dc4a3064..f80bf043 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1433,6 +1433,7 @@ void LogExit( const char *string ) { int i, numSorted; gclient_t *cl; + gentity_t *ent; G_LogPrintf( "Exit: %s\n", string ); @@ -1466,6 +1467,18 @@ void LogExit( const char *string ) cl->pers.netname ); } + + for( i = 1, ent = g_entities + i ; i < level.num_entities ; i++, ent++ ) + { + if( !ent->inuse ) + continue; + + if( !Q_stricmp( ent->classname, "trigger_win" ) ) + { + if( level.lastWin == ent->stageTeam ) + ent->use( ent, ent, ent ); + } + } } @@ -1604,6 +1617,7 @@ void CheckExitRules( void ) G_LogPrintf( "STATS T:L A:%f H:%f M:%s D:%d\n", level.averageNumAlienClients, level.averageNumHumanClients, s, level.time - level.startTime ); + level.lastWin = PTE_NONE; LogExit( "Timelimit hit." ); return; } @@ -1667,7 +1681,10 @@ void CheckVote( void ) //SUPAR HAK if( !Q_stricmp( level.voteString, "vstr nextmap" ) ) + { + level.lastWin = PTE_NONE; LogExit( "Vote for next map." ); + } else trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString ) ); } diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index eae5c724..9a2fa1e9 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -179,6 +179,7 @@ void SP_trigger_push( gentity_t *ent ); void SP_trigger_teleport( gentity_t *ent ); void SP_trigger_hurt( gentity_t *ent ); void SP_trigger_stage( gentity_t *ent ); +void SP_trigger_win( gentity_t *ent ); void SP_trigger_buildable( gentity_t *ent ); void SP_trigger_class( gentity_t *ent ); void SP_trigger_equipment( gentity_t *ent ); @@ -258,6 +259,7 @@ spawn_t spawns[ ] = { "trigger_teleport", SP_trigger_teleport }, { "trigger_hurt", SP_trigger_hurt }, { "trigger_stage", SP_trigger_stage }, + { "trigger_win", SP_trigger_win }, { "trigger_buildable", SP_trigger_buildable }, { "trigger_class", SP_trigger_class }, { "trigger_equipment", SP_trigger_equipment }, diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index c3edef8d..fbcf4c4f 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -526,6 +526,26 @@ void SP_trigger_stage( gentity_t *self ) /* =============== +trigger_win +=============== +*/ +void trigger_win( gentity_t *self, gentity_t *other, gentity_t *activator ) +{ + G_UseTargets( self, self ); +} + +void SP_trigger_win( gentity_t *self ) +{ + G_SpawnInt( "team", "0", (int *)&self->stageTeam ); + + self->use = trigger_win; + + self->r.svFlags = SVF_NOCLIENT; +} + + +/* +=============== trigger_buildable_trigger =============== */ |