commit df957e1e1d77a28035457679b1b067104bee57aa Author: /dev/humancontroller Date: Fri May 13 17:55:48 2011 +0200 functionality for players to use trigger_multiples by holding +buttons diff --git a/src/game/g_local.h b/src/game/g_local.h index 72b04c9..585d4d4 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -244,6 +244,7 @@ struct gentity_s int usesBuildPointZone; // does it use a zone? int resetValue; + int buttonMask; }; typedef enum diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index fa215bf..79bca29 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -91,10 +91,12 @@ void Use_Multi( gentity_t *ent, gentity_t *other, gentity_t *activator ) void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace ) { - if( !other->client && other->s.eType != ET_BUILDABLE ) - return; - - multi_trigger( self, other ); + if( ( other->client && ( self->buttonMask == -1 || + ( other->client->buttons & self->buttonMask ) ) ) || + ( other->s.eType == ET_BUILDABLE && self->buttonMask == -1 ) ) + { + multi_trigger( self, other ); + } } /*QUAKED trigger_multiple (.5 .5 .5) ? @@ -108,6 +110,7 @@ void SP_trigger_multiple( gentity_t *ent ) { G_SpawnFloat( "wait", "0.5", &ent->wait ); G_SpawnFloat( "random", "0", &ent->random ); + G_SpawnInt( "buttonmask", "-1", &ent->buttonMask ); if( ent->random >= ent->wait && ent->wait >= 0 ) {