static int CBaseCombatWeapon___tostring (lua_State *L) { CBaseCombatWeapon *pWeapon = lua_toweapon(L, 1); if (pWeapon == NULL) lua_pushstring(L, "NULL"); else lua_pushfstring(L, "CBaseCombatWeapon: %d %s", pWeapon->entindex(), pWeapon->GetClassname()); return 1; }
//----------------------------------------------------------------------------- // Purpose: Dissolve all weapons within our volume //----------------------------------------------------------------------------- void CTriggerWeaponDissolve::DissolveThink( void ) { int numWeapons = m_pWeapons.Count(); // Dissolve all the items within the volume for ( int i = 0; i < numWeapons; i++ ) { CBaseCombatWeapon *pWeapon = m_pWeapons[i]; Vector vecConduit = GetConduitPoint( pWeapon ); // The physcannon upgrades when this happens if ( FClassnameIs( pWeapon, "weapon_physcannon" ) ) { // This must be the last weapon for us to care if ( numWeapons > 1 ) continue; //FIXME: Make them do this on a stagger! // All conduits send power to the weapon for ( int i = 0; i < m_pConduitPoints.Count(); i++ ) { CreateBeam( m_pConduitPoints[i]->GetAbsOrigin(), pWeapon, 4.0f ); } PhysCannonBeginUpgrade( pWeapon ); m_OnChargingPhyscannon.FireOutput( this, this ); EmitSound( "WeaponDissolve.Beam" ); // We're done m_pWeapons.Purge(); m_pConduitPoints.Purge(); SetContextThink( NULL, 0, s_pDissolveThinkContext ); return; } // Randomly dissolve them all float flLifetime = random->RandomFloat( 2.5f, 4.0f ); CreateBeam( vecConduit, pWeapon, flLifetime ); pWeapon->Dissolve( NULL, gpGlobals->curtime + ( 3.0f - flLifetime ), false ); m_OnDissolveWeapon.FireOutput( this, this ); CPASAttenuationFilter filter( pWeapon ); EmitSound( filter, pWeapon->entindex(), "WeaponDissolve.Dissolve" ); // Beam looping sound EmitSound( "WeaponDissolve.Beam" ); m_pWeapons.Remove( i ); SetContextThink( &CTriggerWeaponDissolve::DissolveThink, gpGlobals->curtime + random->RandomFloat( 0.5f, 1.5f ), s_pDissolveThinkContext ); return; } SetContextThink( &CTriggerWeaponDissolve::DissolveThink, gpGlobals->curtime + 0.1f, s_pDissolveThinkContext ); }