// // Starts the door going to its "up" position (simply ToggleData->vecPosition2). // void CBaseDoor::DoorGoUp( void ) { entvars_t *pevActivator; // It could be going-down, if blocked. ASSERT(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN); // emit door moving and stop sounds on CHAN_STATIC so that the multicast doesn't // filter them out and leave a client stuck with looping door sounds! if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM); // ALERT(at_debug, "%s go up (was %d)\n", STRING(pev->targetname), m_toggle_state); m_toggle_state = TS_GOING_UP; SetMoveDone(&CBaseDoor:: DoorHitTop ); // LRC- if synched, we fire as soon as we start to go up if (m_iImmediateMode) { if (m_iOnOffMode) SUB_UseTargets( m_hActivator, USE_ON, 0 ); else SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); } if ( FClassnameIs(pev, "func_door_rotating")) // !!! BUGBUG Triggered doors don't work with this yet { float sign = 1.0; if ( m_hActivator != NULL ) { pevActivator = m_hActivator->pev; if ( !FBitSet( pev->spawnflags, SF_DOOR_ONEWAY ) && pev->movedir.y ) // Y axis rotation, move away from the player { Vector vec = pevActivator->origin - pev->origin; Vector angles = pevActivator->angles; angles.x = 0; angles.z = 0; UTIL_MakeVectors (angles); // Vector vnext = (pevToucher->origin + (pevToucher->velocity * 10)) - pev->origin; UTIL_MakeVectors ( pevActivator->angles ); Vector vnext = (pevActivator->origin + (gpGlobals->v_forward * 10)) - pev->origin; if ( (vec.x*vnext.y - vec.y*vnext.x) < 0 ) sign = -1.0; } } AngularMove(m_vecAngle2*sign, pev->speed); } else if(m_iSpeedMode==1){ //AJH modifed to allow two types of accelerating doors LinearMove(m_vecPosition2, pev->speed); }else{ LinearMove(m_vecPosition2, pev->speed, m_fAcceleration, m_fDeceleration); } }
void CButtonTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !ShouldToggle( useType, (int)pev->frame ) ) return; pev->frame = 1-pev->frame; if ( pev->frame ) SUB_UseTargets( pActivator, USE_ON, 0 ); else SUB_UseTargets( pActivator, USE_OFF, 0 ); }
// // The door has reached the "down" position. Back to quiescence. // void CBaseDoor::DoorHitBottom( void ) { if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) { STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving) ); EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseArrived), 1, ATTN_NORM); } // ALERT(at_debug, "%s hit bottom\n", STRING(pev->targetname)); ASSERT(m_toggle_state == TS_GOING_DOWN); m_toggle_state = TS_AT_BOTTOM; // Re-instate touch method, cycle is complete if ( FBitSet ( pev->spawnflags, SF_DOOR_USE_ONLY ) && !FBitSet ( pev->spawnflags, SF_DOOR_FORCETOUCHABLE ) ) {// use only door SetTouch ( NULL ); } else // touchable door SetTouch(&CBaseDoor:: DoorTouch ); // Fire the close target (if startopen is set, then "top" is closed) - netname is the close target // LRC- 'message' is the open target if (pev->spawnflags & SF_DOOR_START_OPEN) { if (pev->message) FireTargets( STRING(pev->message), m_hActivator, this, USE_TOGGLE, 0 ); } else { if (pev->netname) FireTargets( STRING(pev->netname), m_hActivator, this, USE_TOGGLE, 0 ); } // else // { // ALERT(at_console,"didn't fire closetarget because "); // if (!(pev->netname)) // ALERT(at_console,"no netname\n"); // else if (pev->spawnflags & SF_DOOR_START_OPEN) // ALERT(at_console,"startopen\n"); // else // ALERT(at_console,"!!?!\n"); // } // LRC- if synched, don't fire now if (!m_iImmediateMode) { if (m_iOnOffMode) SUB_UseTargets( m_hActivator, USE_ON, 0 ); else SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); } }
// // The door has reached the "up" position. Either go back down, or wait for another activation. // void CBaseDoor::DoorHitTop( void ) { if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) { STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving) ); EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseArrived), 1, ATTN_NORM); } // ALERT(at_debug, "%s hit top\n", STRING(pev->targetname)); ASSERT(m_toggle_state == TS_GOING_UP); m_toggle_state = TS_AT_TOP; // toggle-doors don't come down automatically, they wait for refire. if (FBitSet(pev->spawnflags, SF_DOOR_NO_AUTO_RETURN)) { // Re-instate touch method, movement is complete if ( !FBitSet ( pev->spawnflags, SF_DOOR_USE_ONLY ) || FBitSet ( pev->spawnflags, SF_DOOR_FORCETOUCHABLE ) ) SetTouch(&CBaseDoor:: DoorTouch ); } else { // In flWait seconds, DoorGoDown will fire, unless wait is -1, then door stays open SetNextThink( m_flWait ); SetThink(&CBaseDoor:: DoorGoDown ); if ( m_flWait == -1 ) { DontThink(); } } // Fire the close target (if startopen is set, then "top" is closed) - netname is the close target if (pev->spawnflags & SF_DOOR_START_OPEN) { if (pev->netname) FireTargets( STRING(pev->netname), m_hActivator, this, USE_TOGGLE, 0 ); } else { if (pev->message) FireTargets( STRING(pev->message), m_hActivator, this, USE_TOGGLE, 0 ); } // LRC if (!m_iImmediateMode) { if (m_iOnOffMode) SUB_UseTargets( m_hActivator, USE_OFF, 0 ); else SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); } }
void CButtonTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!ShouldToggle(useType, int(pev->frame))) return; pev->frame = 1 - pev->frame; if (pev->frame) { SUB_UseTargets(pActivator, USE_ON, 0); } else SUB_UseTargets(pActivator, USE_OFF, 0); }
void trigger_onlyregistered_touch( ) { gedict_t *te; if ( strneq( other->s.v.classname, "player" ) ) return; if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } if ( self->attack_finished > g_globalvars.time ) return; self->attack_finished = g_globalvars.time + 2; if ( trap_cvar( "registered" ) ) { self->s.v.message = ""; activator = other; SUB_UseTargets( ); ent_remove( self ); } else { if ( self->s.v.message && strneq( self->s.v.message, "" ) ) { G_centerprint( other, "%s", self->s.v.message ); sound( other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM ); } } }
//----------------------------------------------------------------------------- // Purpose: Touch function that calls the virtual touch function //----------------------------------------------------------------------------- void CQuakeItem::ItemTouch( CBaseEntity *pOther ) { // if it's not a player, ignore if ( !pOther->IsPlayer() ) return; //Dead? if (pOther->pev->health <= 0) return; CBasePlayer *pPlayer = (CBasePlayer *)pOther; // Call the virtual touch function if ( MyTouch( pPlayer ) ) { SUB_UseTargets( pOther, USE_TOGGLE, 0 ); // Respawn if it's not DM==2 if (gpGlobals->deathmatch != 2) { Respawn( m_flRespawnTime ); } else { UTIL_Remove( this ); } } }
void CAirtank::TankTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) { return; } if (!m_state) { // "no oxygen" sound EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_swim2.wav", VOL_NORM, ATTN_NORM); return; } // give player 12 more seconds of air pOther->pev->air_finished = gpGlobals->time + 12.0f; // suit recharge sound EMIT_SOUND(ENT(pev), CHAN_VOICE, "doors/aliendoor3.wav", VOL_NORM, ATTN_NORM); // recharge airtank in 30 seconds pev->nextthink = gpGlobals->time + 30.0f; m_state = 0; SUB_UseTargets(this, USE_TOGGLE, 1); }
void CMessage::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { CBaseEntity *pPlayer = NULL; if ( pev->spawnflags & SF_MESSAGE_ALL ) UTIL_ShowMessageAll( STRING(pev->message) ); else { if ( pActivator && pActivator->IsPlayer() ) pPlayer = pActivator; else { pPlayer = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) ); } if ( pPlayer ) UTIL_ShowMessage( STRING(pev->message), pPlayer ); } if ( pev->noise ) { EMIT_SOUND( edict(), CHAN_BODY, STRING(pev->noise), pev->scale, pev->speed ); } if ( pev->spawnflags & SF_MESSAGE_ONCE ) UTIL_Remove( this ); SUB_UseTargets( this, USE_TOGGLE, 0 ); }
void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) { // if it's not a player, ignore if ( !pOther->IsPlayer() ) return; CBasePlayer *pPlayer = (CBasePlayer *)pOther; // can I have this? if ( !g_pGameRules->CanHavePlayerItem( pPlayer, this ) ) { if ( gEvilImpulse101 ) { UTIL_Remove( this ); } return; } if (pOther->AddPlayerItem( this )) { AttachToPlayer( pPlayer ); EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM); } SUB_UseTargets( pOther, USE_TOGGLE, 0 ); // UNDONE: when should this happen? }
void CBaseButton::TriggerAndWait(void) { ASSERT(m_toggle_state == TS_GOING_UP); if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) return; m_toggle_state = TS_AT_TOP; if (m_fStayPushed || FBitSet(pev->spawnflags, SF_BUTTON_TOGGLE)) { if (!FBitSet(pev->spawnflags, SF_BUTTON_TOUCH_ONLY)) SetTouch(NULL); else SetTouch(&CBaseButton::ButtonTouch); } else { pev->nextthink = pev->ltime + m_flWait; SetThink(&CBaseButton::ButtonReturn); } pev->frame = 1; SUB_UseTargets(m_hActivator, USE_TOGGLE, 0); }
void CBaseButton::ButtonTouch(CBaseEntity *pOther) { if (!FClassnameIs(pOther->pev, "player")) return; m_hActivator = pOther; BUTTON_CODE code = ButtonResponseToTouch(); if (code == BUTTON_NOTHING) return; if (!UTIL_IsMasterTriggered(m_sMaster, pOther)) { PlayLockSounds(pev, &m_ls, TRUE, TRUE); return; } SetTouch(NULL); if (code == BUTTON_RETURN) { EMIT_SOUND(ENT(pev), CHAN_VOICE, STRING(pev->noise), VOL_NORM, ATTN_NORM); SUB_UseTargets(m_hActivator, USE_TOGGLE, 0); ButtonReturn(); } else ButtonActivate(); }
int CBaseButton::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { BUTTON_CODE code = ButtonResponseToTouch(); if (code == BUTTON_NOTHING) return 0; SetTouch(NULL); m_hActivator = CBaseEntity::Instance(pevAttacker); if (m_hActivator == NULL) return 0; if (code == BUTTON_RETURN) { EMIT_SOUND(ENT(pev), CHAN_VOICE, STRING(pev->noise), VOL_NORM, ATTN_NORM); if (!(pev->spawnflags & SF_BUTTON_TOGGLE)) SUB_UseTargets(m_hActivator, USE_TOGGLE, 0); ButtonReturn(); } else ButtonActivate(); return 0; }
void CGameCounter::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) return; switch (useType) { case USE_ON: case USE_TOGGLE: CountUp(); break; case USE_OFF: CountDown(); break; case USE_SET: SetCountValue((int)value); break; } if (HitLimit()) { SUB_UseTargets(pActivator, USE_TOGGLE, 0); if (RemoveOnFire()) { UTIL_Remove(this); } if (ResetOnFire()) { ResetCount(); } } }
int CBaseButton :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ) { if( FBitSet( pev->spawnflags, SF_BUTTON_DAMAGED_AT_LASER ) && !( bitsDamageType & DMG_ENERGYBEAM )) return 0; BUTTON_CODE code = ButtonResponseToTouch(); if( code == BUTTON_NOTHING ) return 0; // temporarily disable the touch function, until movement is finished. SetTouch( NULL ); m_hActivator = CBaseEntity::Instance( pevAttacker ); if( m_hActivator == NULL ) return 0; if( code == BUTTON_RETURN ) { EMIT_SOUND( edict(), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM ); // toggle buttons fire when they get back to their "home" position if( !FBitSet( pev->spawnflags, SF_BUTTON_TOGGLE )) SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); ButtonReturn(); } else { // code == BUTTON_ACTIVATE ButtonActivate( ); } return 0; }
void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if( !CanFireForActivator( pActivator ) ) return; if( useType == USE_SET ) { if( value < 0 ) { m_teamIndex = -1; } else { m_teamIndex = g_pGameRules->GetTeamIndex( pActivator->TeamID() ); } return; } if( TeamMatch( pActivator ) ) { SUB_UseTargets( pActivator, triggerType, value ); if( RemoveOnFire() ) UTIL_Remove( this ); } }
void CBaseButton:: ButtonTouch( CBaseEntity *pOther ) { // ignore touches by anything but players if( !pOther->IsPlayer( )) return; m_hActivator = pOther; BUTTON_CODE code = ButtonResponseToTouch(); if( code == BUTTON_NOTHING ) return; if( IsLockedByMaster( )) { // play button locked sound PlayLockSounds( pev, &m_ls, TRUE, TRUE ); return; } // temporarily disable the touch function, until movement is finished. SetTouch( NULL ); if( code == BUTTON_RETURN ) { EMIT_SOUND( edict(), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM ); SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); ButtonReturn(); } else { ButtonActivate( ); } }
void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) { if ( !pOther->IsPlayer() ) { return; } if (!UTIL_IsMasterTriggered(m_sMaster, m_pPlayer)) // return ; // AJH allows for locked weapons if (AddAmmo( pOther )) { if ( g_pGameRules->AmmoShouldRespawn( this ) == GR_AMMO_RESPAWN_YES ) { Respawn(); } else { SetTouch( NULL ); SetThink(&CBasePlayerAmmo ::SUB_Remove); SetNextThink( 0.1 ); } SUB_UseTargets( pOther, USE_TOGGLE, 0 ); //AJH now ammo can trigger stuff too } else if (gEvilImpulse101) { // evil impulse 101 hack, kill always SetTouch( NULL ); SetThink(&CBasePlayerAmmo ::SUB_Remove); SetNextThink( 0.1 ); } }
// // The door has reached the "down" position. Back to quiescence. // void CBaseDoor::DoorHitBottom( void ) { if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) { STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving) ); EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseArrived), 1, ATTN_NORM); } ASSERT(m_toggle_state == TS_GOING_DOWN); m_toggle_state = TS_AT_BOTTOM; // Re-instate touch method, cycle is complete if ( FBitSet ( pev->spawnflags, SF_DOOR_USE_ONLY ) ) {// use only door SetTouch ( NULL ); } else // touchable door SetTouch( DoorTouch ); SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); // this isn't finished // Fire the close target (if startopen is set, then "top" is closed) - netname is the close target if ( pev->netname && !(pev->spawnflags & SF_DOOR_START_OPEN) ) FireTargets( STRING(pev->netname), m_hActivator, this, USE_TOGGLE, 0 ); }
int CSentry::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { if ( !pev->takedamage ) return 0; // if (!m_iOn) // { // SetThink( Deploy ); // SetUse( NULL ); // pev->nextthink = gpGlobals->time + 0.1; // } pev->health -= flDamage; if (pev->health <= 0) { pev->health = 0; pev->takedamage = DAMAGE_NO; pev->dmgtime = gpGlobals->time; ClearBits (pev->flags, FL_MONSTER); // why are they set in the first place??? SetUse(NULL); SetThink(&CSentry::SentryDeath); SUB_UseTargets( this, USE_ON, 0 ); // wake up others pev->nextthink = gpGlobals->time + 0.1; return 0; } return 1; }
void CAirtank::TankTouch( CBaseEntity *pOther ) { if( !pOther->IsPlayer() ) return; if( !m_bState ) { // "no oxygen" sound EMIT_SOUND( this, CHAN_BODY, "player/pl_swim2.wav", 1.0, ATTN_NORM ); return; } // give player N more seconds of air pOther->SetAirFinishedTime( gpGlobals->time + m_flAirTimeToGive ); // suit recharge sound EMIT_SOUND( this, CHAN_VOICE, "doors/aliendoor3.wav", 1.0, ATTN_NORM ); // recharge airtank in M seconds float flRechargeTime = m_flBaseRechargeTime; //This lets mappers recharge the tank before players have run out of air. //Useful when they want to force them to stay in place. - Solokiller if( !m_bDisableAccumRecharge ) { flRechargeTime += m_flAirTimeToGive; } ALERT( at_console, "giving %f more seconds of air\n", m_flAirTimeToGive ); SetNextThink( gpGlobals->time + flRechargeTime ); m_bState = false; SUB_UseTargets( this, USE_TOGGLE, 1 ); }
// // Button has reached the "in/up" position. Activate its "targets", and pause before "popping out". // void CBaseButton::TriggerAndWait(void) { ASSERT(m_toggle_state == TS_GOING_UP); if(!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) return; m_toggle_state = TS_AT_TOP; // If button automatically comes back out, start it moving out. // Else re-instate touch method if(m_fStayPushed || FBitSet(pev->spawnflags, SF_BUTTON_TOGGLE)) { if(!FBitSet(pev->spawnflags, SF_BUTTON_TOUCH_ONLY)) // this button only works if USED, not touched! { // ALL buttons are now use only SetTouch(NULL); } else SetTouch(&CBaseButton::ButtonTouch); } else { pev->nextthink = pev->ltime + m_flWait; SetThink(&CBaseButton::ButtonReturn); } pev->frame = 1; // use alternate textures SUB_UseTargets(m_hActivator, USE_TOGGLE, 0); }
//----------------------------------------------------------------------------- // Purpose: Touch function that calls the virtual touch function //----------------------------------------------------------------------------- void CItem::ItemTouch( CBaseEntity *pOther ) { // if it's not a player, ignore if ( !pOther->IsPlayer() ) { return; } CBasePlayer *pPlayer = (CBasePlayer *)pOther; // ok, a player is touching this item, but can he have it? if ( !g_pGameRules->CanHaveItem( pPlayer, this ) ) { // no? Ignore the touch. return; } if (MyTouch( pPlayer )) { SUB_UseTargets( pOther, USE_TOGGLE, 0 ); SetTouch( NULL ); // player grabbed the item. g_pGameRules->PlayerGotItem( pPlayer, this ); if ( g_pGameRules->ItemShouldRespawn( this ) == GR_ITEM_RESPAWN_YES ) { Respawn(m_flRespawnTime); } else { UTIL_Remove( this ); } } }
// // ButtonShot // int CBaseButton::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { BUTTON_CODE code = ButtonResponseToTouch(); if(code == BUTTON_NOTHING) return 0; // Temporarily disable the touch function, until movement is finished. SetTouch(NULL); m_hActivator = CBaseEntity::Instance(pevAttacker); if(m_hActivator == NULL) return 0; if(code == BUTTON_RETURN) { EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), 1, ATTN_NORM); // Toggle buttons fire when they get back to their "home" position if(!(pev->spawnflags & SF_BUTTON_TOGGLE)) SUB_UseTargets(m_hActivator, USE_TOGGLE, 0); ButtonReturn(); } else // code == BUTTON_ACTIVATE ButtonActivate(); return 0; }
// // Touching a button simply "activates" it. // void CBaseButton::ButtonTouch(CBaseEntity *pOther) { // Ignore touches by anything but players if(!FClassnameIs(pOther->pev, "player")) return; m_hActivator = pOther; BUTTON_CODE code = ButtonResponseToTouch(); if(code == BUTTON_NOTHING) return; if(!UTIL_IsMasterTriggered(m_sMaster, pOther)) { // play button locked sound PlayLockSounds(pev, &m_ls, TRUE, TRUE); return; } // Temporarily disable the touch function, until movement is finished. SetTouch(NULL); if(code == BUTTON_RETURN) { EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), 1, ATTN_NORM); SUB_UseTargets(m_hActivator, USE_TOGGLE, 0); ButtonReturn(); } else // code == BUTTON_ACTIVATE ButtonActivate(); }
/* <8d4ad> ../cstrike/dlls/func_tank.cpp:656 */ void CFuncTank::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) { if (m_fireLast != 0) { if (m_iszSpriteSmoke) { CSprite *pSprite = CSprite::SpriteCreate(STRING(m_iszSpriteSmoke), barrelEnd, TRUE); pSprite->AnimateAndDie(RANDOM_FLOAT(15, 20)); pSprite->SetTransparency(kRenderTransAlpha, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, 255, kRenderFxNone); pSprite->pev->velocity.z = RANDOM_FLOAT(40, 80); pSprite->SetScale(m_spriteScale); } if (m_iszSpriteFlash) { CSprite *pSprite = CSprite::SpriteCreate(STRING(m_iszSpriteFlash), barrelEnd, TRUE); pSprite->AnimateAndDie(60); pSprite->SetTransparency(kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation); pSprite->SetScale(m_spriteScale); // Hack Hack, make it stick around for at least 100 ms. pSprite->pev->nextthink += 0.1; } SUB_UseTargets(this, USE_TOGGLE, 0); } m_fireLast = gpGlobals->time; }
void CMultiSource::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { int i = 0; // Find the entity in our list while (i < m_iTotal) if ( m_rgEntities[i++] == pCaller ) break; // if we didn't find it, report error and leave if (i > m_iTotal) { ALERT(at_console, "MultiSrc:Used by non member %s.\n", STRING(pCaller->pev->classname)); return; } // CONSIDER: a Use input to the multisource always toggles. Could check useType for ON/OFF/TOGGLE m_rgTriggered[i-1] ^= 1; // if ( IsTriggered( pActivator ) ) { ALERT( at_aiconsole, "Multisource %s enabled (%d inputs)\n", STRING(pev->targetname), m_iTotal ); USE_TYPE useType = USE_TOGGLE; if ( m_globalstate ) useType = USE_ON; SUB_UseTargets( NULL, useType, 0 ); } }
// // The door has reached the "up" position. Either go back down, or wait for another activation. // void CBaseTrainDoor :: DoorHitTop( void ) { // STOP_SOUND( edict(), CHAN_STATIC, pev->noise1 ); ASSERT( door_state == TD_SLIDING_UP ); door_state = TD_OPENED; if( pev->impulse ) { switch( pev->impulse ) { case 1: // deactivate train if( m_pTrain ) m_pTrain->pev->speed = 0; break; case 2: // cancel trackchange m_hActivator = NULL; break; } pev->impulse = 0; } SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); }
void DelayThink() { activator = PROG_TO_EDICT( self->s.v.enemy ); SUB_UseTargets(); ent_remove( self ); }
void CMomentaryDoor :: MoveDone( void ) { // stop sounds at the next think, rather than here as another // SetPosition call might immediately follow the end of this move SetThink( StopMoveSound ); SetNextThink( 0.1f ); CBaseToggle::MoveDone(); if( GetLocalOrigin() == m_vecPosition2 ) { SUB_UseTargets( m_hActivator, USE_ON, 0 ); } else if( GetLocalOrigin() == m_vecPosition1 ) { SUB_UseTargets( m_hActivator, USE_OFF, 0 ); } }