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 NewGame () { Images.Uninit (); DoCommonInit (); if (CPlayer != NULL) { AttachToPlayer (CPlayer); } }
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); if(!gEvilImpulse101) { int i; char sample[32]; char weapon_name[32]; strcpy(weapon_name, STRING(pev->classname)); if(strncmp(weapon_name, "weapon_", 7) == 0) i = 7; else if (strncmp(weapon_name, "item_", 5) == 0) i = 5; sprintf(sample, "!%s", weapon_name + i); pPlayer->SetSuitUpdate(sample, FALSE, SUIT_NEXT_IN_30SEC); } } SUB_UseTargets( pOther, USE_TOGGLE, 0 ); // UNDONE: when should this happen? }
void AWeapon::OnEquip() { CollisionComp->SetCollisionEnabled(ECollisionEnabled::NoCollision); AttachToPlayer(); }