// UNDONE: right now this is pretty much a copy of the squid spit with minor changes to the way it does damage void CBMortar:: Spawn( void ) { SetMoveType( MOVETYPE_FLYGRAVITY ); SetClassname( "bmortar" ); SetSolid( SOLID_BBOX ); pSprite = CSprite::SpriteCreate( "sprites/mommaspit.vmt", GetAbsOrigin(), true ); if ( pSprite ) { pSprite->SetAttachment( this, 0 ); pSprite->m_flSpriteFramerate = 5; pSprite->m_nRenderMode = kRenderTransAlpha; pSprite->SetBrightness( 255 ); m_iFrame = 0; pSprite->SetScale( 2.5f ); } UTIL_SetSize( this, Vector( 0, 0, 0), Vector(0, 0, 0) ); m_maxFrame = (float)modelinfo->GetModelFrameCount( GetModel() ) - 1; m_flDmgTime = gpGlobals->curtime + 0.4; }
/* * Custom Spawn */ void CFreedom_BusterSmall::CustomSpawn( void ) { SetClassname( "weapon_freedomrapid" ); SetV_model( "models/null.mdl" ); SetP_model( "models/p_freedom_gun.mdl" ); SetAnimPrefix( "rifle" ); SetDamage( 40 ); SetBulletType ( BULLET_PLAYER_MP5 ); }
void CReplayManager::Spawn() { SetClassname("replay_manager"); SetSimulatedEveryTick(true); SetAnimatedEveryTick(true); SetThink(&CReplayManager::Think); SetNextThink(gpGlobals->curtime); }
void CGlock::Spawn( ) { SetClassname("weapon_9mmhandgun"); // hack to allow for old names Precache( ); SetModel( "models/w_9mmhandgun.mdl"); FallInit();// get ready to fall down. }
void CReplayBall::Spawn( void ) { SetClassname("replay_ball"); Precache(); SetModelName(MAKE_STRING(BALL_MODEL)); CreateVPhysics(); //SetSolid(SOLID_NONE); SetSimulatedEveryTick(true); SetAnimatedEveryTick(true); }
void CReplayPlayer::Spawn( void ) { SetClassname("replay_player"); Precache(); SetSolidFlags(FSOLID_NOT_SOLID); SetModel( SDK_PLAYER_MODEL ); SetSolid( SOLID_BBOX ); UTIL_SetSize( this, -Vector(20,20,20), Vector(20,20,20) ); SetSimulatedEveryTick(true); SetAnimatedEveryTick(true); SetThink(&CReplayPlayer::Think); SetNextThink(gpGlobals->curtime); }
void CBaseScripted::OnDataChanged( DataUpdateType_t updateType ) { BaseClass::OnDataChanged( updateType ); if ( updateType == DATA_UPDATE_CREATED ) { if ( m_iScriptedClassname.Get() ) { SetClassname( m_iScriptedClassname.Get() ); InitScriptedEntity(); } } }
void DEntity::LoadEPairList( epair_t *epl ){ epair_t* ep = epl; while ( ep ) { if ( !strcmp( ep->key, "classname" ) ) { SetClassname( ep->value ); } else{ AddEPair( ep->key, ep->value ); } ep = ep->next; } }
C_ClientPartialRagdoll::C_ClientPartialRagdoll( bool bRestoring ) : BaseClass( bRestoring ) , m_bShrinking( true ) , m_bIsPartial( false ) , m_iBranchRootBone( -1 ) , m_iBloodColor( DONT_BLEED ) , m_strRecursiveGoreName( NULL ) , m_strRecursiveGoreMaterialName( NULL ) , m_flTouchDecalDelay( gpGlobals->curtime + 0.25f ) { SetClassname( "client_ragdoll_partial" ); Q_memset( m_iBoneFlagStorage, 0, sizeof( m_iBoneFlagStorage ) ); }
void CStomp::Spawn( void ) { Precache(); SetNextThink( gpGlobals->curtime ); SetClassname( "garg_stomp" ); m_flDmgTime = gpGlobals->curtime; m_uiFramerate = 30; // pev->rendermode = kRenderTransTexture; // SetBrightness( 0 ); CPASAttenuationFilter filter( this ); EmitSound( filter, entindex(), "Garg.Stomp" ); }
void CHL2MPScriptedWeapon::OnDataChanged( DataUpdateType_t updateType ) { BaseClass::OnDataChanged( updateType ); if ( updateType == DATA_UPDATE_CREATED ) { if ( m_iScriptedClassname.Get() && !m_pLuaWeaponInfo->bParsedScript ) { m_pLuaWeaponInfo->bParsedScript = true; SetClassname( m_iScriptedClassname.Get() ); InitScriptedWeapon(); #ifdef LUA_SDK BEGIN_LUA_CALL_WEAPON_METHOD( "Precache" ); END_LUA_CALL_WEAPON_METHOD( 0, 0 ); #endif } } }
void CSquidSpit:: Spawn( void ) { Precache(); SetMoveType ( MOVETYPE_FLY ); SetClassname( "squidspit" ); SetSolid( SOLID_BBOX ); m_nRenderMode = kRenderTransAlpha; SetRenderColorA( 255 ); SetModel( "" ); SetSprite( CSprite::SpriteCreate( "sprites/bigspit.vmt", GetAbsOrigin(), true ) ); UTIL_SetSize( this, Vector( 0, 0, 0), Vector(0, 0, 0) ); SetCollisionGroup( HL2COLLISION_GROUP_SPIT ); }
void CBaseScripted::InitScriptedEntity( void ) { #if defined ( LUA_SDK ) #if 0 #ifndef CLIENT_DLL // Let the instance reinitialize itself for the client. if ( m_nTableReference != LUA_NOREF ) return; #endif #endif SetThink( &CBaseScripted::Think ); #ifdef CLIENT_DLL SetNextClientThink( gpGlobals->curtime ); #endif SetNextThink( gpGlobals->curtime ); SetTouch( &CBaseScripted::Touch ); char className[ 255 ]; #if defined ( CLIENT_DLL ) if ( strlen( GetScriptedClassname() ) > 0 ) Q_strncpy( className, GetScriptedClassname(), sizeof( className ) ); else Q_strncpy( className, GetClassname(), sizeof( className ) ); #else Q_strncpy( m_iScriptedClassname.GetForModify(), GetClassname(), sizeof( className ) ); Q_strncpy( className, GetClassname(), sizeof( className ) ); #endif Q_strlower( className ); SetClassname( className ); if ( m_nTableReference == LUA_NOREF ) { LoadScriptedEntity(); m_nTableReference = luaL_ref( L, LUA_REGISTRYINDEX ); } else { lua_getglobal( L, "table" ); if ( lua_istable( L, -1 ) ) { lua_getfield( L, -1, "merge" ); if ( lua_isfunction( L, -1 ) ) { lua_remove( L, -2 ); lua_getref( L, m_nTableReference ); LoadScriptedEntity(); luasrc_pcall( L, 2, 0, 0 ); } else { lua_pop( L, 2 ); } } else { lua_pop( L, 1 ); } } BEGIN_LUA_CALL_ENTITY_METHOD( "Initialize" ); END_LUA_CALL_ENTITY_METHOD( 0, 0 ); #endif }
/* * Custom Spawn */ void CAf49_TwinBlade::CustomSpawn( void ) { SetClassname( "weapon_af49twinblade" ); }
DEntity::DEntity( const char *classname, int ID ){ SetClassname( classname ); m_nID = ID; QER_Entity = NULL; }
void CBaseScriptedTrigger::InitScriptedTrigger( void ) { #if defined ( LUA_SDK ) #if 0 // Let the instance reinitialize itself for the client. if ( m_nTableReference != LUA_NOREF ) return; #endif SetThink( &CBaseScriptedTrigger::Think ); SetNextThink( gpGlobals->curtime ); SetTouch( &CBaseScriptedTrigger::Touch ); char className[ 255 ]; Q_strncpy( className, GetClassname(), sizeof( className ) ); Q_strlower( className ); SetClassname( className ); lua_getglobal( L, "entity" ); if ( lua_istable( L, -1 ) ) { lua_getfield( L, -1, "get" ); if ( lua_isfunction( L, -1 ) ) { lua_remove( L, -2 ); lua_pushstring( L, className ); luasrc_pcall( L, 1, 1, 0 ); } else { lua_pop( L, 2 ); } } else { lua_pop( L, 1 ); } if ( m_nTableReference == LUA_NOREF ) { LoadScriptedTrigger(); m_nTableReference = luaL_ref( L, LUA_REGISTRYINDEX ); } else { lua_getglobal( L, "table" ); if ( lua_istable( L, -1 ) ) { lua_getfield( L, -1, "merge" ); if ( lua_isfunction( L, -1 ) ) { lua_remove( L, -2 ); lua_getref( L, m_nTableReference ); LoadScriptedTrigger(); luasrc_pcall( L, 2, 0, 0 ); } else { lua_pop( L, 2 ); } } else { lua_pop( L, 1 ); } } BEGIN_LUA_CALL_TRIGGER_METHOD( "Initialize" ); END_LUA_CALL_TRIGGER_METHOD( 0, 0 ); #endif }
/* * Custom Spawn */ void CVf1j_AlphaBomb::CustomSpawn( void ) { SetClassname( "weapon_vf1jalpha" ); SetV_model( "models/null.mdl" ); SetP_model( "models/p_vf1j_gunpod.mdl" ); SetAnimPrefix( "gunpod" ); }
void CHL2MPScriptedWeapon::InitScriptedWeapon( void ) { #if defined ( LUA_SDK ) #ifndef CLIENT_DLL // Let the instance reinitialize itself for the client. if ( m_nTableReference != LUA_NOREF ) return; #endif char className[ MAX_WEAPON_STRING ]; #if defined ( CLIENT_DLL ) if ( strlen( GetScriptedClassname() ) > 0 ) Q_strncpy( className, GetScriptedClassname(), sizeof( className ) ); else Q_strncpy( className, GetClassname(), sizeof( className ) ); #else Q_strncpy( m_iScriptedClassname.GetForModify(), GetClassname(), sizeof( className ) ); Q_strncpy( className, GetClassname(), sizeof( className ) ); #endif Q_strlower( className ); // Andrew; This redundancy is pretty annoying. // Classname Q_strncpy( m_pLuaWeaponInfo->szClassName, className, MAX_WEAPON_STRING ); SetClassname( className ); lua_getglobal( L, "weapon" ); if ( lua_istable( L, -1 ) ) { lua_getfield( L, -1, "get" ); if ( lua_isfunction( L, -1 ) ) { lua_remove( L, -2 ); lua_pushstring( L, className ); luasrc_pcall( L, 1, 1, 0 ); } else { lua_pop( L, 2 ); } } else { lua_pop( L, 1 ); } m_nTableReference = luaL_ref( L, LUA_REGISTRYINDEX ); #ifndef CLIENT_DLL m_pLuaWeaponInfo->bParsedScript = true; #endif // Printable name lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "printname" ); lua_remove( L, -2 ); if ( lua_isstring( L, -1 ) ) { Q_strncpy( m_pLuaWeaponInfo->szPrintName, lua_tostring( L, -1 ), MAX_WEAPON_STRING ); } else { Q_strncpy( m_pLuaWeaponInfo->szPrintName, WEAPON_PRINTNAME_MISSING, MAX_WEAPON_STRING ); } lua_pop( L, 1 ); // View model & world model lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "viewmodel" ); lua_remove( L, -2 ); if ( lua_isstring( L, -1 ) ) { Q_strncpy( m_pLuaWeaponInfo->szViewModel, lua_tostring( L, -1 ), MAX_WEAPON_STRING ); } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "playermodel" ); lua_remove( L, -2 ); if ( lua_isstring( L, -1 ) ) { Q_strncpy( m_pLuaWeaponInfo->szWorldModel, lua_tostring( L, -1 ), MAX_WEAPON_STRING ); } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "anim_prefix" ); lua_remove( L, -2 ); if ( lua_isstring( L, -1 ) ) { Q_strncpy( m_pLuaWeaponInfo->szAnimationPrefix, lua_tostring( L, -1 ), MAX_WEAPON_PREFIX ); } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "bucket" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iSlot = lua_tonumber( L, -1 ); } else { m_pLuaWeaponInfo->iSlot = 0; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "bucket_position" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iPosition = lua_tonumber( L, -1 ); } else { m_pLuaWeaponInfo->iPosition = 0; } lua_pop( L, 1 ); // Use the console (X360) buckets if hud_fastswitch is set to 2. #ifdef CLIENT_DLL if ( hud_fastswitch.GetInt() == 2 ) #else if ( IsX360() ) #endif { lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "bucket_360" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iSlot = lua_tonumber( L, -1 ); } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "bucket_position_360" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iPosition = lua_tonumber( L, -1 ); } lua_pop( L, 1 ); } lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "clip_size" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iMaxClip1 = lua_tonumber( L, -1 ); // Max primary clips gun can hold (assume they don't use clips by default) } else { m_pLuaWeaponInfo->iMaxClip1 = WEAPON_NOCLIP; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "clip2_size" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iMaxClip2 = lua_tonumber( L, -1 ); // Max secondary clips gun can hold (assume they don't use clips by default) } else { m_pLuaWeaponInfo->iMaxClip2 = WEAPON_NOCLIP; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "default_clip" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iDefaultClip1 = lua_tonumber( L, -1 ); // amount of primary ammo placed in the primary clip when it's picked up } else { m_pLuaWeaponInfo->iDefaultClip1 = m_pLuaWeaponInfo->iMaxClip1; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "default_clip2" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iDefaultClip2 = lua_tonumber( L, -1 ); // amount of secondary ammo placed in the secondary clip when it's picked up } else { m_pLuaWeaponInfo->iDefaultClip2 = m_pLuaWeaponInfo->iMaxClip2; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "weight" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iWeight = lua_tonumber( L, -1 ); } else { m_pLuaWeaponInfo->iWeight = 0; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "rumble" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->iWeight = lua_tonumber( L, -1 ); } else { m_pLuaWeaponInfo->iWeight = -1; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "showusagehint" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->bShowUsageHint = (int)lua_tointeger( L, -1 ) != 0 ? true : false; } else { m_pLuaWeaponInfo->bShowUsageHint = false; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "autoswitchto" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->bAutoSwitchTo = (int)lua_tointeger( L, -1 ) != 0 ? true : false; } else { m_pLuaWeaponInfo->bAutoSwitchTo = true; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "autoswitchfrom" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->bAutoSwitchFrom = (int)lua_tointeger( L, -1 ) != 0 ? true : false; } else { m_pLuaWeaponInfo->bAutoSwitchFrom = true; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "BuiltRightHanded" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->m_bBuiltRightHanded = (int)lua_tointeger( L, -1 ) != 0 ? true : false; } else { m_pLuaWeaponInfo->m_bBuiltRightHanded = true; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "AllowFlipping" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->m_bAllowFlipping = (int)lua_tointeger( L, -1 ) != 0 ? true : false; } else { m_pLuaWeaponInfo->m_bAllowFlipping = true; } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "MeleeWeapon" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->m_bMeleeWeapon = (int)lua_tointeger( L, -1 ) != 0 ? true : false; } else { m_pLuaWeaponInfo->m_bMeleeWeapon = false; } lua_pop( L, 1 ); // Primary ammo used lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "primary_ammo" ); lua_remove( L, -2 ); if ( lua_isstring( L, -1 ) ) { const char *pAmmo = lua_tostring( L, -1 ); if ( strcmp("None", pAmmo) == 0 ) Q_strncpy( m_pLuaWeaponInfo->szAmmo1, "", sizeof( m_pLuaWeaponInfo->szAmmo1 ) ); else Q_strncpy( m_pLuaWeaponInfo->szAmmo1, pAmmo, sizeof( m_pLuaWeaponInfo->szAmmo1 ) ); m_pLuaWeaponInfo->iAmmoType = GetAmmoDef()->Index( m_pLuaWeaponInfo->szAmmo1 ); } lua_pop( L, 1 ); // Secondary ammo used lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "secondary_ammo" ); lua_remove( L, -2 ); if ( lua_isstring( L, -1 ) ) { const char *pAmmo = lua_tostring( L, -1 ); if ( strcmp("None", pAmmo) == 0) Q_strncpy( m_pLuaWeaponInfo->szAmmo2, "", sizeof( m_pLuaWeaponInfo->szAmmo2 ) ); else Q_strncpy( m_pLuaWeaponInfo->szAmmo2, pAmmo, sizeof( m_pLuaWeaponInfo->szAmmo2 ) ); m_pLuaWeaponInfo->iAmmo2Type = GetAmmoDef()->Index( m_pLuaWeaponInfo->szAmmo2 ); } lua_pop( L, 1 ); // Now read the weapon sounds memset( m_pLuaWeaponInfo->aShootSounds, 0, sizeof( m_pLuaWeaponInfo->aShootSounds ) ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "SoundData" ); lua_remove( L, -2 ); if ( lua_istable( L, -1 ) ) { for ( int i = EMPTY; i < NUM_SHOOT_SOUND_TYPES; i++ ) { lua_getfield( L, -1, pWeaponSoundCategories[i] ); if ( lua_isstring( L, -1 ) ) { const char *soundname = lua_tostring( L, -1 ); if ( soundname && soundname[0] ) { Q_strncpy( m_pLuaWeaponInfo->aShootSounds[i], soundname, MAX_WEAPON_STRING ); } } lua_pop( L, 1 ); } } lua_pop( L, 1 ); lua_getref( L, m_nTableReference ); lua_getfield( L, -1, "damage" ); lua_remove( L, -2 ); if ( lua_isnumber( L, -1 ) ) { m_pLuaWeaponInfo->m_iPlayerDamage = (int)lua_tointeger( L, -1 ); } lua_pop( L, 1 ); BEGIN_LUA_CALL_WEAPON_METHOD( "Initialize" ); END_LUA_CALL_WEAPON_METHOD( 0, 0 ); #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnergyWave::Precache( void ) { SetClassname("energy_wave"); }