CGrenade * CGrenade :: ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ) { CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL ); pGrenade->pev->movetype = MOVETYPE_BOUNCE; pGrenade->pev->classname = MAKE_STRING( "grenade" ); pGrenade->pev->solid = SOLID_BBOX; SET_MODEL(ENT(pGrenade->pev), "models/grenade.mdl"); // Change this to satchel charge model UTIL_SetSize(pGrenade->pev, Vector( 0, 0, 0), Vector(0, 0, 0)); pGrenade->pev->dmg = 200; UTIL_SetOrigin( pGrenade->pev, vecStart ); pGrenade->pev->velocity = vecVelocity; pGrenade->pev->angles = g_vecZero; pGrenade->pev->owner = ENT(pevOwner); // Detonate in "time" seconds pGrenade->SetThink( &CGrenade::SUB_DoNothing ); pGrenade->SetUse( &CGrenade::DetonateUse ); pGrenade->SetTouch( &CGrenade::SlideTouch ); pGrenade->pev->spawnflags = SF_DETONATE; pGrenade->pev->friction = 0.9; return pGrenade; }
CGrenade *CGrenade::ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent) { CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL); pGrenade->Spawn(); UTIL_SetOrigin(pGrenade->pev, vecStart); pGrenade->pev->velocity = vecVelocity; pGrenade->pev->angles = pevOwner->angles; pGrenade->pev->owner = ENT(pevOwner); pGrenade->m_usEvent = usEvent; pGrenade->m_bLightSmoke = false; pGrenade->m_bDetonated = false; pGrenade->SetTouch(&CGrenade::BounceTouch); pGrenade->pev->dmgtime = gpGlobals->time + time; pGrenade->SetThink(&CGrenade::SG_TumbleThink); pGrenade->pev->nextthink = gpGlobals->time + 0.1; if (time < 0.1) { pGrenade->pev->nextthink = gpGlobals->time; pGrenade->pev->velocity = Vector(0, 0, 0); } pGrenade->pev->sequence = RANDOM_LONG(3, 6); pGrenade->pev->framerate = 1; pGrenade->m_bJustBlew = true; pGrenade->pev->gravity = 0.5; pGrenade->pev->friction = 0.8; pGrenade->m_SGSmoke = 0; SET_MODEL(ENT(pGrenade->pev), "models/w_smokegrenade.mdl"); pGrenade->pev->dmg = 35; return pGrenade; }
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ) { CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL ); pGrenade->Spawn(); // contact grenades arc lower pGrenade->pev->gravity = 0.5;// lower gravity since grenade is aerodynamic and engine doesn't know it. UTIL_SetOrigin( pGrenade->pev, vecStart ); pGrenade->pev->velocity = vecVelocity; pGrenade->pev->angles = UTIL_VecToAngles (pGrenade->pev->velocity); pGrenade->pev->owner = ENT(pevOwner); // make monsters afaid of it while in the air pGrenade->SetThink( &CGrenade::DangerSoundThink ); pGrenade->pev->nextthink = gpGlobals->time; // Tumble in air pGrenade->pev->avelocity.x = RANDOM_FLOAT ( -100, -500 ); // Explode on contact pGrenade->SetTouch( &CGrenade::ExplodeTouch ); pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade; return pGrenade; }
CGrenade* CGrenade::ShootTimed2( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int team, unsigned short usEvent ) { CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL ); pGrenade->Spawn(); UTIL_SetOrigin( pGrenade->pev, vecStart ); pGrenade->pev->velocity = vecVelocity; pGrenade->pev->angles = pevOwner->angles; pGrenade->pev->owner = ENT( pevOwner ); pGrenade->m_usEvent = usEvent; pGrenade->SetTouch( &CGrenade::BounceTouch ); pGrenade->SetThink( &CGrenade::TumbleThink ); pGrenade->pev->dmgtime = gpGlobals->time + time; pGrenade->pev->nextthink= gpGlobals->time + 0.1; pGrenade->pev->sequence = RANDOM_LONG( 3, 6 ); pGrenade->pev->framerate= 1.0; pGrenade->m_fJustBlew = TRUE; pGrenade->m_iTeam = team; pGrenade->pev->gravity = 0.55; pGrenade->pev->friction = 0.70; pGrenade->pev->dmg = 100; SET_MODEL( ENT( pGrenade->pev ), "models/w_hegrenade.mdl" ); return pGrenade; }
CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity) // Last check: 2013, May 28 { CGrenade *pGrenade = GetClassPtr((CGrenade*)NULL); pGrenade->pev->movetype = MOVETYPE_TOSS; pGrenade->pev->solid = SOLID_BBOX; if (pGrenade->pev->classname) RemoveEntityHashValue(pGrenade->pev, STRING(pGrenade->pev->classname), CLASSNAME); pGrenade->pev->classname = MAKE_STRING("grenade"); AddEntityHashValue(pGrenade->pev, STRING(pGrenade->pev->classname), CLASSNAME); SET_MODEL(ENT(pGrenade->pev), "models/w_c4.mdl"); UTIL_SetSize(pGrenade->pev, Vector(3, 6, 8), Vector(-3, -6, 0)); UTIL_SetOrigin(pGrenade->pev, vecStart); pGrenade->pev->dmg = 100; pGrenade->pev->angles = vecVelocity; pGrenade->pev->velocity = g_vecZero; pGrenade->pev->owner = ENT(pevOwner); pGrenade->SetThink(&CGrenade::C4Think); pGrenade->SetTouch(&CGrenade::C4Touch); pGrenade->pev->spawnflags = SF_DETONATE; pGrenade->pev->nextthink = gpGlobals->time + 0.1; pGrenade->m_flC4Blow = gpGlobals->time + g_pGameRules->m_iC4Timer; pGrenade->m_flNextFreqInterval = g_pGameRules->m_iC4Timer / 4; pGrenade->m_flNextFreq = gpGlobals->time; pGrenade->m_flNextBeep = gpGlobals->time + 0.5; pGrenade->m_flNextBlink = gpGlobals->time + 2.0; pGrenade->m_iCurWave = 0; pGrenade->m_fAttenu = 0; pGrenade->m_sBeepName = NULL; pGrenade->m_fNextDefuse = 0; pGrenade->m_bIsC4 = true; pGrenade->m_bStartDefuse= false; pGrenade->m_bJustBlew = false; pGrenade->pev->friction = 0.9; if (!FNullEnt(pevOwner)) { CBasePlayer *pPlayer = (CBasePlayer*)Instance(pevOwner); if (pPlayer->IsPlayer()) pGrenade->m_pentCurBombTarget = pPlayer->m_pentCurBombTarget; } else pGrenade->m_pentCurBombTarget = NULL; return pGrenade; }
CGrenade *CGrenade::ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time) { CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL); pGrenade->Spawn(); UTIL_SetOrigin(pGrenade->pev, vecStart); pGrenade->pev->velocity = vecVelocity; pGrenade->pev->angles = pevOwner->angles; pGrenade->pev->owner = ENT(pevOwner); pGrenade->SetTouch(&CGrenade::BounceTouch); pGrenade->pev->dmgtime = gpGlobals->time + time; pGrenade->SetThink(&CGrenade::TumbleThink); pGrenade->pev->nextthink = gpGlobals->time + 0.1; if (time < 0.1) { pGrenade->pev->nextthink = gpGlobals->time; pGrenade->pev->velocity = Vector(0, 0, 0); } pGrenade->pev->sequence = RANDOM_LONG(3, 6); pGrenade->pev->framerate = 1; pGrenade->m_bJustBlew = true; pGrenade->pev->gravity = 0.5; pGrenade->pev->friction = 0.8; SET_MODEL(ENT(pGrenade->pev), "models/w_flashbang.mdl"); pGrenade->pev->dmg = 35; return pGrenade; }
CGrenade* CGrenade::ShootExplosiveTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int inDamageType) { CGrenade *pGrenade = CGrenade::ShootTimed(pevOwner, vecStart, vecVelocity, time); pGrenade->SetDamageType(inDamageType); pGrenade->SetTouch(&CGrenade::ExplosiveBounceTouch); return pGrenade; }
CGrenade * CGrenade :: ShootFrag( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, int mode ) { CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL ); pGrenade->Spawn(); UTIL_SetOrigin( pGrenade->pev, vecStart ); pGrenade->pev->velocity = vecVelocity; pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity); pGrenade->pev->owner = ENT(pevOwner); pGrenade->pev->solid = SOLID_BBOX; if ( mode == 1 ) { SET_MODEL(ENT(pGrenade->pev), "models/w_fgrenade.mdl"); pGrenade->SetTouch( FragTouch ); pGrenade->SetThink( FragThink ); pGrenade->pev->nextthink = gpGlobals->time + 0.1; } else { SET_MODEL(ENT(pGrenade->pev), "models/w_frag.mdl"); pGrenade->SetThink( Detonate ); pGrenade->pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 2,3 ); pGrenade->pev->solid = SOLID_NOT; } MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); WRITE_BYTE( TE_BEAMFOLLOW ); WRITE_SHORT(pGrenade->entindex()); // entity WRITE_SHORT(iFgTrail ); // model WRITE_BYTE( 10 ); // life WRITE_BYTE( 1.5 ); // width WRITE_BYTE( 240 ); // r, g, b WRITE_BYTE( 215 ); // r, g, b WRITE_BYTE( 80 ); // r, g, b WRITE_BYTE( 200 ); // brightness MESSAGE_END(); pGrenade->pev->sequence = 4; pGrenade->pev->framerate = 6; pGrenade->pev->gravity = 0.35; pGrenade->pev->friction = 0.9; pGrenade->pev->dmg = 100; return pGrenade; }
CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ) { CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL ); pGrenade->Spawn(); UTIL_SetOrigin( pGrenade->pev, vecStart ); pGrenade->pev->velocity = vecVelocity; pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity); pGrenade->pev->owner = ENT(pevOwner); pGrenade->SetTouch( &CGrenade::BounceTouch ); // Bounce if touched #ifdef DEBUG if(ns_cvar_float(&avh_bulletcam)) { SET_VIEW(ENT(pevOwner), ENT(pGrenade->pev)); } #endif // Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate // will insert a DANGER sound into the world sound list and delay detonation for one second so that // the grenade explodes after the exact amount of time specified in the call to ShootTimed(). pGrenade->pev->dmgtime = gpGlobals->time + time; pGrenade->SetThink( &CGrenade::TumbleThink ); pGrenade->pev->nextthink = gpGlobals->time + 0.1; if (time < 0.1) { pGrenade->pev->nextthink = gpGlobals->time; pGrenade->pev->velocity = Vector( 0, 0, 0 ); } pGrenade->pev->sequence = 0;//RANDOM_LONG( 3, 6 ); pGrenade->pev->framerate = 1.0; // Tumble through the air pGrenade->pev->avelocity.x = RANDOM_LONG(-800, -300); // Also explode on contact //pGrenade->SetTouch( ExplodeTouch ); pGrenade->pev->gravity = 0.5; pGrenade->pev->friction = 0.8; SET_MODEL(ENT(pGrenade->pev), "models/w_grenade.mdl"); return pGrenade; }
CGrenade *CGrenade::ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity) { CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL); pGrenade->Spawn(); pGrenade->pev->gravity = 0.5; UTIL_SetOrigin(pGrenade->pev, vecStart); pGrenade->pev->velocity = vecVelocity; pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity); pGrenade->pev->owner = ENT(pevOwner); pGrenade->SetThink(&CGrenade::DangerSoundThink); pGrenade->pev->nextthink = gpGlobals->time; pGrenade->pev->avelocity.x = RANDOM_FLOAT(-100, -500); pGrenade->SetTouch(&CGrenade::ExplodeTouch); pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade; pGrenade->m_bJustBlew = true; return pGrenade; }
CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ) { CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL ); pGrenade->Spawn(); UTIL_SetOrigin( pGrenade, vecStart ); pGrenade->SetAbsVelocity( vecVelocity ); pGrenade->SetLocalAngles( UTIL_VecToAngles( pGrenade->GetAbsVelocity( ))); pGrenade->pev->owner = ENT( pevOwner ); pGrenade->SetTouch( &CGrenade::BounceTouch ); // Bounce if touched // Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate // will insert a DANGER sound into the world sound list and delay detonation for one second so that // the grenade explodes after the exact amount of time specified in the call to ShootTimed(). pGrenade->pev->dmgtime = gpGlobals->time + time; pGrenade->SetThink( &CGrenade::TumbleThink ); pGrenade->SetNextThink( 0.1 ); if( time < 0.1 ) { pGrenade->SetNextThink( 0 ); pGrenade->SetLocalVelocity( g_vecZero ); } pGrenade->pev->sequence = RANDOM_LONG( 3, 6 ); pGrenade->pev->framerate = 1.0; pGrenade->pev->gravity = 0.5; pGrenade->pev->friction = 0.8; SET_MODEL( pGrenade->edict(), "models/w_grenade.mdl" ); pGrenade->pev->dmg = 100; return pGrenade; }
CGrenade* CGrenade::ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ) { CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL ); pGrenade->pev->movetype = MOVETYPE_BOUNCE; pGrenade->pev->solid = SOLID_BBOX; // TODO: Implements me. // if( pev->classname ) // this->RemoveEntityHashValue( STRING( pev->classname ) ); pGrenade->pev->classname = MAKE_STRING( "grenade" ); // TODO: Implements me. // this->AddEntityHashValue( STRING( pev->classname ) ); // SET_MODEL( ENT( pGrenade->pev ), "models/w_c4.mdl" ); UTIL_SetSize( pGrenade->pev, Vector( 3, 6, 8 ), Vector( -3, -6, 0 ) ); UTIL_SetOrigin( pGrenade->pev, vecStart ); pGrenade->pev->dmg = 100; pGrenade->pev->angles = vecVelocity; pGrenade->pev->velocity = g_vecZero; pGrenade->pev->owner = ENT( pevOwner ); pGrenade->SetThink( &CGrenade::C4Think ); pGrenade->SetTouch( &CGrenade::C4Touch ); pGrenade->pev->spawnflags = SF_DETONATE; pGrenade->pev->nextthink = gpGlobals->time + 0.1; pGrenade->m_flC4Blow = gpGlobals->time + g_pGameRules->m_flC4DetonateDelay; pGrenade->m_flNextFreqInterval = g_pGameRules->m_flC4DetonateDelay / 4; pGrenade->m_flNextFreq = gpGlobals->time; pGrenade->m_flNextBeep = gpGlobals->time + 0.5; pGrenade->m_flNextBlink = gpGlobals->time + 2.0; pGrenade->m_iC4Beep = 0; pGrenade->m_flAttenu = 0; pGrenade->m_sBeepName = NULL; pGrenade->m_flNextDefuseTime = 0; pGrenade->m_fPlantedC4 = TRUE; pGrenade->m_fStartDefuse= FALSE; pGrenade->m_fJustBlew = FALSE; pGrenade->pev->friction = 0.9; if( !FNullEnt( pevOwner ) ) { CBasePlayer *pPlayer = (CBasePlayer *)Instance( pevOwner ); pGrenade->m_pentCurBombTarget = pPlayer->m_pentBombTarget; } else pGrenade->m_pentCurBombTarget = NULL; return pGrenade; }