//------------------------------------------------ // Spawn //------------------------------------------------ void CPropAPC::Spawn( void ) { BaseClass::Spawn(); SetBlocksLOS( true ); m_iHealth = m_iMaxHealth = sk_apc_health.GetFloat(); SetCycle( 0 ); m_iMachineGunBurstLeft = MACHINE_GUN_BURST_SIZE; m_iRocketSalvoLeft = ROCKET_SALVO_SIZE; m_nRocketSide = 0; m_lifeState = LIFE_ALIVE; m_bInFiringCone = false; m_flHandbrakeTime = gpGlobals->curtime + 0.1; m_bInitialHandbrake = false; // Reset the gun to a default pose. SetPoseParameter( "vehicle_weapon_pitch", 0 ); SetPoseParameter( "vehicle_weapon_yaw", 90 ); CreateAPCLaserDot(); if ( IsXbox() ) { AddFlag( FL_AIMTARGET ); } }
//----------------------------------------------------------------------------- // Purpose: Sets up the entity's initial state //----------------------------------------------------------------------------- void CCompanionCube::Spawn( void ) { Precache(); SetMoveType( MOVETYPE_FLYGRAVITY ); SetSolid( SOLID_BBOX ); //Don't want turrets seeing us if crouched behind it. SetBlocksLOS( true ); SetTouch(&CCompanionCube::ItemTouch); SetModel( ENTITY_MODEL ); UTIL_SetSize( this, -Vector(10,10,10), Vector(10,10,10) ); if ( CreateItemVPhysicsObject() == false ) return; m_takedamage = DAMAGE_EVENTS_ONLY; #if defined( HL2MP ) SetThink( &CItem::FallThink ); SetNextThink( gpGlobals->curtime + 0.1f ); #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CItem::Spawn( void ) { if ( g_pGameRules->IsAllowedToSpawn( this ) == false ) { UTIL_Remove( this ); return; } SetMoveType( MOVETYPE_FLYGRAVITY ); SetSolid( SOLID_BBOX ); SetBlocksLOS( false ); AddEFlags( EFL_NO_ROTORWASH_PUSH ); if( IsXbox() ) { AddEffects( EF_ITEM_BLINK ); } // This will make them not collide with the player, but will collide // against other items + weapons SetCollisionGroup( COLLISION_GROUP_WEAPON ); CollisionProp()->UseTriggerBounds( true, ITEM_PICKUP_BOX_BLOAT ); SetTouch(&CItem::ItemTouch); if ( CreateItemVPhysicsObject() == false ) return; m_takedamage = DAMAGE_EVENTS_ONLY; #if defined( HL2MP ) SetThink( &CItem::FallThink ); SetNextThink( gpGlobals->curtime + 0.1f ); #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CItem::Spawn( void ) { if ( g_pGameRules->IsAllowedToSpawn( this ) == false ) { UTIL_Remove( this ); return; } SetMoveType( MOVETYPE_FLYGRAVITY ); SetSolid( SOLID_BBOX ); SetBlocksLOS( false ); AddEFlags( EFL_NO_ROTORWASH_PUSH ); if( IsX360() ) { AddEffects( EF_ITEM_BLINK ); } // This will make them not collide with the player, but will collide // against other items + weapons SetCollisionGroup( COLLISION_GROUP_WEAPON ); CollisionProp()->UseTriggerBounds( true, ITEM_PICKUP_BOX_BLOAT ); SetTouch(&CItem::ItemTouch); if ( CreateItemVPhysicsObject() == false ) return; m_takedamage = DAMAGE_EVENTS_ONLY; #if !defined( CLIENT_DLL ) // Constrained start? if ( HasSpawnFlags( SF_ITEM_START_CONSTRAINED ) ) { //Constrain the weapon in place IPhysicsObject *pReferenceObject, *pAttachedObject; pReferenceObject = g_PhysWorldObject; pAttachedObject = VPhysicsGetObject(); if ( pReferenceObject && pAttachedObject ) { constraint_fixedparams_t fixed; fixed.Defaults(); fixed.InitWithCurrentObjectState( pReferenceObject, pAttachedObject ); fixed.constraint.forceLimit = lbs2kg( 10000 ); fixed.constraint.torqueLimit = lbs2kg( 10000 ); m_pConstraint = physenv->CreateFixedConstraint( pReferenceObject, pAttachedObject, NULL, fixed ); m_pConstraint->SetGameData( (void *) this ); } } #endif //CLIENT_DLL #if defined( HL2MP ) SetThink( &CItem::FallThink ); SetNextThink( gpGlobals->curtime + 0.1f ); #endif }
//----------------------------------------------------------------------------- // Purpose: This used to have something to do with bees flying, but // now it only initializes moving furniture in scripted sequences //----------------------------------------------------------------------------- void CNPC_Furniture::Spawn( ) { Precache(); SetModel( STRING(GetModelName()) ); SetMoveType( MOVETYPE_STEP ); SetSolid( SOLID_BBOX ); // Our collision, if needed, will be done through bone followers AddSolidFlags( FSOLID_NOT_SOLID ); SetBloodColor( DONT_BLEED ); m_iHealth = TOO_MUCH_HEALTH_TO_DIE; //wow m_takedamage = DAMAGE_AIM; SetSequence( 0 ); SetCycle( 0 ); SetNavType( NAV_FLY ); AddFlag( FL_FLY ); CapabilitiesAdd( bits_CAP_MOVE_FLY | bits_CAP_TURN_HEAD | bits_CAP_ANIMATEDFACE ); AddEFlags( EFL_NO_MEGAPHYSCANNON_RAGDOLL ); // pev->nextthink += 1.0; // SetThink (WalkMonsterDelay); ResetSequenceInfo( ); SetCycle( 0 ); NPCInit(); // Furniture needs to block LOS SetBlocksLOS( true ); }
// as CItem, but we don't install the touch function void CASW_Pickup::Spawn( void ) { SetMoveType( MOVETYPE_FLYGRAVITY ); SetSolid( SOLID_BBOX ); SetBlocksLOS( false ); AddEFlags( EFL_NO_ROTORWASH_PUSH ); // This will make them not collide with the player, but will collide // against other items + weapons SetCollisionGroup( COLLISION_GROUP_WEAPON ); CollisionProp()->UseTriggerBounds( true, ITEM_PICKUP_BOX_BLOAT ); //SetTouch(&CItem::ItemTouch); if ( CreateItemVPhysicsObject() == false ) return; m_takedamage = DAMAGE_EVENTS_ONLY; #ifdef HL2MP SetThink( &CItem::FallThink ); SetNextThink( gpGlobals->curtime + 0.1f ); #endif if ( m_bFreezePickup ) { IPhysicsObject *pPhysicsObject = VPhysicsGetObject(); if ( pPhysicsObject != NULL ) { pPhysicsObject->EnableMotion( false ); } } }
//------------------------------------------------ // Spawn //------------------------------------------------ void CPropAPC2::Spawn( void ) { SetVehicleType( VEHICLE_TYPE_CAR_WHEELS ); BaseClass::Spawn(); SetBlocksLOS( true ); m_iHealth = m_iMaxHealth = 500; m_iAmmoCount=30; // Balas seguidas que podemos disparar m_iCannonCount=100; // Tanto por cien de cañon. SetCycle( 0 ); m_iMachineGunBurstLeft = MACHINE_GUN_BURST_SIZE; m_iRocketSalvoLeft = ROCKET_SALVO_SIZE; m_fReloadTime=gpGlobals->curtime+0.5f; m_fCannonCharge=gpGlobals->curtime+0.05f; m_nRocketSide = 0; m_lifeState = LIFE_ALIVE; m_bInFiringCone = false; m_flHandbrakeTime = gpGlobals->curtime + 0.1; m_bInitialHandbrake = false; // Reset the gun to a default pose. SetPoseParameter( "vehicle_weapon_pitch", 0 ); SetPoseParameter( "vehicle_weapon_yaw", 90 ); AddSolidFlags( FSOLID_NOT_STANDABLE ); m_vOriginalSpawnOrigin = GetAbsOrigin(); m_vOriginalSpawnAngles = GetAbsAngles(); m_bSpawn=false; CreateAPCLaserDot(); }
//========================================================= // Crea el objeto. //========================================================= void CLoot::Spawn() { Precache(); SetModel(MODEL); SetSolid(SOLID_BBOX); SetBlocksLOS( false ); BaseClass::Spawn(); }
void CEconWearable::Spawn( void ) { GetAttributeContainer()->InitializeAttributes( this ); Precache(); SetModel( m_Item.GetPlayerDisplayModel() ); BaseClass::Spawn(); AddEffects( EF_BONEMERGE ); AddEffects( EF_BONEMERGE_FASTCULL ); SetCollisionGroup( COLLISION_GROUP_WEAPON ); SetBlocksLOS( false ); }
bool C_ASW_Snow_Volume::Initialize() { if ( InitializeAsClientEntity( NULL, false ) == false ) { return false; } Spawn(); const model_t *mod = GetModel(); if ( mod ) { Vector mins, maxs; modelinfo->GetModelBounds( mod, mins, maxs ); SetCollisionBounds( mins, maxs ); } SetBlocksLOS( false ); // this should be a small object SetNextClientThink( CLIENT_THINK_NEVER ); return true; }
void Spawn( void ) { Precache(); BaseClass::Spawn(); SetModel(ENTITY_MODEL); SetMoveType(MOVETYPE_FLYGRAVITY); SetSolid(SOLID_BBOX); SetBlocksLOS(false); AddEFlags(EFL_NO_ROTORWASH_PUSH); SetCollisionGroup(COLLISION_GROUP_WEAPON); int nSolidFlags = GetSolidFlags() | FSOLID_NOT_STANDABLE | FSOLID_NOT_STANDABLE | FSOLID_TRIGGER | FSOLID_USE_TRIGGER_BOUNDS; VPhysicsInitNormal(SOLID_VPHYSICS, nSolidFlags, false); CollisionProp()->UseTriggerBounds(true, 64); SetUse(&CItemFlashlightBattery::Pickup); SetGlow(true); };
bool C_PhysPropClientside::Initialize() { if ( InitializeAsClientEntity( STRING(GetModelName()), RENDER_GROUP_OPAQUE_ENTITY ) == false ) { return false; } const model_t *mod = GetModel(); if ( mod ) { Vector mins, maxs; modelinfo->GetModelBounds( mod, mins, maxs ); SetCollisionBounds( mins, maxs ); } solid_t tmpSolid; // Create the object in the physics system if ( !PhysModelParseSolid( tmpSolid, this, GetModelIndex() ) ) { DevMsg("C_PhysPropClientside::Initialize: PhysModelParseSolid failed for entity %i.\n", GetModelIndex() ); return false; } else { m_pPhysicsObject = VPhysicsInitNormal( SOLID_VPHYSICS, 0, m_spawnflags & SF_PHYSPROP_START_ASLEEP, &tmpSolid ); if ( !m_pPhysicsObject ) { // failed to create a physics object DevMsg(" C_PhysPropClientside::Initialize: VPhysicsInitNormal() failed for %s.\n", STRING(GetModelName()) ); return false; } } // We want touch calls when we hit the world unsigned int flags = VPhysicsGetObject()->GetCallbackFlags(); VPhysicsGetObject()->SetCallbackFlags( flags | CALLBACK_GLOBAL_TOUCH_STATIC ); if ( m_spawnflags & SF_PHYSPROP_MOTIONDISABLED ) { m_pPhysicsObject->EnableMotion( false ); } Spawn(); // loads breakable & prop data if ( m_iPhysicsMode == PHYSICS_MULTIPLAYER_AUTODETECT ) { m_iPhysicsMode = GetAutoMultiplayerPhysicsMode( CollisionProp()->OBBSize(), m_pPhysicsObject->GetMass() ); } if ( m_spawnflags & SF_PHYSPROP_FORCE_SERVER_SIDE ) { // forced to be server-side by map maker return false; } if ( m_iPhysicsMode != PHYSICS_MULTIPLAYER_CLIENTSIDE ) { // spawn only clientside entities return false; } else { if ( engine->IsInEditMode() ) { // don't spawn in map edit mode return false; } } if ( m_fadeMinDist < 0 ) { // start fading out at 75% of r_propsmaxdist m_fadeMaxDist = r_propsmaxdist.GetFloat(); m_fadeMinDist = r_propsmaxdist.GetFloat() * 0.75f; } // player can push it away SetCollisionGroup( COLLISION_GROUP_PUSHAWAY ); UpdatePartitionListEntry(); CollisionProp()->UpdatePartition(); SetBlocksLOS( false ); // this should be a small object // Set up shadows; do it here so that objects can change shadowcasting state CreateShadow(); UpdateVisibility(); SetNextClientThink( CLIENT_THINK_NEVER ); return true; }
void CE_Cycler_Fix::Spawn(void) { //according CBaseCombatCharacter SetBlocksLOS( false ); }