예제 #1
0
//-----------------------------------------------------------------------------
// The actual explosion 
//-----------------------------------------------------------------------------
void CRocketMissile::DoExplosion( void )
{
	unsigned int spawnflags = SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE;
	float explodeforce = BALANCE_VALUE( Float, lfm_rocket_launcher_explodeforce );

	// Create the actual explosion
	ExplosionCreate( GetAbsOrigin(), GetAbsAngles(), GetOwnerEntity(), 
		GetDamage(), GetDamage() * 2, spawnflags, explodeforce, this);
}
예제 #2
0
파일: Script.c 프로젝트: maxmitti/SGGP
func Damage()
{
	if(GetDamage() > 200)
	{
		CastObjects(ROCK,3,15);
		CastObjects(BONE,6,15);
	    var pZombie;
	    pZombie = CreateObject(ZCLK,0,0,-1);
	    pZombie -> SetColorDw(HSL(Random(256),255,127));
    	pZombie -> Zombize();
    	pZombie -> SetComDir(COMD_Left);
	    pZombie = CreateObject(ZCLK,0,0,-1);
	    pZombie -> SetColorDw(HSL(Random(256),255,127));
    	pZombie -> Zombize();
    	pZombie -> SetComDir(COMD_Left);
	    pZombie = CreateObject(ZCLK,0,0,-1);
	    pZombie -> SetColorDw(HSL(Random(256),255,127));
    	pZombie -> Zombize();
    	pZombie -> SetComDir(COMD_Left);
	    pZombie = CreateObject(ZCLK,0,0,-1);
	    pZombie -> SetColorDw(HSL(Random(256),255,127));
    	pZombie -> Zombize();
    	pZombie -> SetComDir(COMD_Left);
		RemoveObject();	
	}
}
예제 #3
0
void CWeaponDrainGrenade::Detonate()
{
	trace_t		tr;
	Vector		vecSpot;// trace starts here!

	SetThink( NULL );

	vecSpot = GetAbsOrigin() + Vector ( 0 , 0 , 8 );
	UTIL_TraceLine ( vecSpot, vecSpot + Vector ( 0, 0, -32 ), MASK_SHOT_HULL, this, COLLISION_GROUP_NONE, & tr);

	if( tr.startsolid )
	{
		// Since we blindly moved the explosion origin vertically, we may have inadvertently moved the explosion into a solid,
		// in which case nothing is going to be harmed by the grenade's explosion because all subsequent traces will startsolid.
		// If this is the case, we do the downward trace again from the actual origin of the grenade. (sjb) 3/8/2007  (for ep2_outland_09)
		UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, -32), MASK_SHOT_HULL, this, COLLISION_GROUP_NONE, &tr );
	}

#if !defined( CLIENT_DLL )

	Explode( GetThrower(), 
			this, 
			NULL, 
			tr.endpos, 
			GetDamage(), 
			GetDamageRadius(),
			GetFocusDrain());

	//CSoundEnt::InsertSound ( SOUND_COMBAT, GetAbsOrigin(), BASEGRENADE_EXPLOSION_VOLUME, 3.0 );

#endif //!defined( CLIENT_DLL )

	RemoveMe();
} 
예제 #4
0
Battle::Command Battle::Catapult::GetCommand(Arena & arena) const
{
    u32 shots = cat_shots;
    std::vector<u32> values(CAT_MISS + 1, 0);

    values[CAT_WALL1] = arena.GetCastleTargetValue(CAT_WALL1);
    values[CAT_WALL2] = arena.GetCastleTargetValue(CAT_WALL2);
    values[CAT_WALL3] = arena.GetCastleTargetValue(CAT_WALL3);
    values[CAT_WALL4] = arena.GetCastleTargetValue(CAT_WALL4);
    values[CAT_TOWER1] = arena.GetCastleTargetValue(CAT_TOWER1);
    values[CAT_TOWER2] = arena.GetCastleTargetValue(CAT_TOWER2);
    values[CAT_TOWER3] = arena.GetCastleTargetValue(CAT_TOWER3);
    values[CAT_BRIDGE] = arena.GetCastleTargetValue(CAT_BRIDGE);

    Command cmd(MSG_BATTLE_CATAPULT);
    cmd.GetStream() << shots;

    while(shots--)
    {
        int target = GetTarget(values);
        u32 damage = GetDamage(target, arena.GetCastleTargetValue(target));
        cmd.GetStream() << target << damage;
        values[target] -= damage;
    }

    return cmd;
}
예제 #5
0
//-----------------------------------------------------------------------------
// Purpose:
// Input  :
// Output :
//-----------------------------------------------------------------------------
void CSatchelCharge::InputExplode( inputdata_t &inputdata )
{
	ExplosionCreate( GetAbsOrigin() + Vector( 0, 0, 16 ), GetAbsAngles(), GetThrower(), GetDamage(), 200, 
		SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE, 0.0f, this);

	UTIL_Remove( this );
}
예제 #6
0
		VOID StdImpact001_T::CriticalRefix(OWN_IMPACT& rImp) const
		{
			__ENTER_FUNCTION
			SetDamage(rImp, GetDamage(rImp)*2);
			rImp.MarkCriticalFlag();
			__LEAVE_FUNCTION
		}
예제 #7
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseProjectile::ProjectileTouch( CBaseEntity *pOther )
{
	// Verify a correct "other."
	Assert( pOther );
	if ( !pOther->IsSolid() || pOther->IsSolidFlagSet( FSOLID_VOLUME_CONTENTS ) )
		return;

	// Handle hitting skybox (disappear).
	const trace_t *pTrace = &CBaseEntity::GetTouchTrace();
	trace_t *pNewTrace = const_cast<trace_t*>( pTrace );

	if( pTrace->surface.flags & SURF_SKY )
	{
		UTIL_Remove( this );
		return;
	}

	CTakeDamageInfo info;
	info.SetAttacker( GetOwnerEntity() );
	info.SetInflictor( this );
	info.SetDamage( GetDamage() );
	info.SetDamageType( GetDamageType() );
	CalculateMeleeDamageForce( &info, GetAbsVelocity(), GetAbsOrigin(), GetDamageScale() );

	Vector dir;
	AngleVectors( GetAbsAngles(), &dir );

	pOther->DispatchTraceAttack( info, dir, pNewTrace );
	ApplyMultiDamage();

	UTIL_Remove( this );
}
void CCompChoppyThrower::ReceiveMessage(SMessage &msg) {
	if (msg.m_type == EMT_SHOOT && m_lastShot >= GetCooldown()) {
		SShootMsg &shootMsg = static_cast<SShootMsg &>(msg);
		if (shootMsg.GetWeaponId() == GetId()) {
			SGetWorldMsg worldMsg;
			m_owner->ReceiveMessage(worldMsg);
			CWorld * world = worldMsg.GetWorld();
			SGetRotMsg rotMsg;
			m_owner->ReceiveMessage(rotMsg);
			SGetPosMsg posMsg;
			m_owner->ReceiveMessage(posMsg);
			SGetEnergyMsg getEnergyMsg;
			m_owner->ReceiveMessage(getEnergyMsg);
			if (rotMsg.Modified() && getEnergyMsg.Modified() &&
				getEnergyMsg.GetEnergy() - GetEnergyConsumed() > 0) {
				world->AddEntity(world->GetEntitiesFactory().SpawnEntity(
					new SBotParams(m_owner->GetSide(), GetImg(),
						posMsg.GetX(), posMsg.GetY(), m_botLifeTime, GetDamage(),
						m_speed)));
				SUpdateEnergyMsg updateEnergyMsg(-GetEnergyConsumed());
				m_owner->ReceiveMessage(updateEnergyMsg);
				m_lastShot = 0;
				AudioBuffer * buffer = new AudioBuffer("data/sounds/fusion_blaster_shoot.wav");
				AudioSource * shootAudio = new AudioSource(buffer);
				shootAudio->Play();
			}
		}
	}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGrenadeMirvProjectile::Explode( trace_t *pTrace, int bitsDamageType )
{
	// Pass through.
	BaseClass::Explode( pTrace, bitsDamageType );
// Server specific.
#ifdef GAME_DLL

	// Create the bomblets.
	for ( int iBomb = 0; iBomb < TF_WEAPON_GRENADE_MIRV_BOMB_COUNT; ++iBomb )
	{
		Vector vecSrc = pTrace->endpos + Vector( 0, 0, 1.0f ); 
		Vector vecVelocity( random->RandomFloat( -75.0f, 75.0f ) * 3.0f,
			                random->RandomFloat( -75.0f, 75.0f ) * 3.0f,
							random->RandomFloat( 30.0f, 70.0f ) * 5.0f );
		Vector vecZero( 0,0,0 );
		CTFPlayer *pPlayer = ToTFPlayer( GetThrower() );
		float flTime = 2.0f + random->RandomFloat( 0.0f, 1.0f );

		CTFGrenadeMirvBomb *pBomb = CTFGrenadeMirvBomb::Create( vecSrc, GetAbsAngles(), vecVelocity, vecZero, pPlayer, flTime );
		pBomb->SetDamage( GetDamage() * 0.5f );
		pBomb->SetDamageRadius( GetDamageRadius() );
	}

#endif
}
예제 #10
0
//
// ProjectileObj::Collided
//
// Called when the projectile colides with something
//
void ProjectileObj::Collided(MapObj *with, const Vector *veloc)
{
  // Call Parent scope first
  MapObj::Collided(with, veloc);

  StartGenericFX(0xF288B23E, NULL, TRUE); // "ProjectileObj::Hit"

  // If the projectile explodes on impact then detonate
  if (ProjectileType()->GetImpact())
  {
    // If it hit something then apply some damage to it
    if (with && !ProjectileType()->explosionType.Alive())
    {
      //FIXME(925491294, "aiarossi"); // Fri Apr 30 09:54:54 1999
      // this is passing the impulse velocity of the projectile to the map obj
      S32 deltaHp = -GetDamage(with->MapType()->GetArmourClass());

      with->ModifyHitPoints(deltaHp, source.GetPointer(), sourceTeam, veloc);

      // Apply hit modifiers
      if (deltaHp)
      {
        weaponType->GetDamage().GetModifiers().Apply(with);
      }
    }
    
    // Kaboom
    Detonate();
  }
}
예제 #11
0
//-----------------------------------------------------------------------------
// Squirrel the damage value away as BaseDamage, which will later be used to 
// calculate damage force. 
//-----------------------------------------------------------------------------
void CTakeDamageInfo::AdjustPlayerDamageInflictedForSkillLevel()
{
#ifndef CLIENT_DLL
	CopyDamageToBaseDamage();
	SetDamage( g_pGameRules->AdjustPlayerDamageInflicted(GetDamage()) );
#endif
}
예제 #12
0
		BOOL StdImpact001_T::RefixPowerByRate(OWN_IMPACT & rImp, INT nRate) const
		{
			__ENTER_FUNCTION
			nRate += 100;
			SetDamage(rImp, Float2Int((GetDamage(rImp)*nRate)/100.0f));
			__LEAVE_FUNCTION
			return TRUE;
		}
예제 #13
0
파일: Script.c 프로젝트: maxmitti/SGGP
func Damage()
{
  if(GetDamage() > 10)
  {
   Explode(30);
  }
  return(1);
}
예제 #14
0
파일: Script.c 프로젝트: Fulgen301/SGGP
func Damage()
{
  if(SEqual(GetAction(),"An")) if(LessThan(50,GetDamage()))
  {
    SetAction("FlackerAn");
    if(!Local(0)) ObjectSetAction(Local(0)=CreateObject(LJ3V,-20,16),"Neon");
  }
  return(1);
}
예제 #15
0
void CGamePlayerHurt::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	if( !CanFireForActivator( pActivator ) )
		return;

	if( pActivator->IsPlayer() )
	{
		if( GetDamage() < 0 )
			pActivator->GiveHealth( -GetDamage(), DMG_GENERIC );
		else
			pActivator->TakeDamage( this, this, GetDamage(), DMG_GENERIC );
	}

	SUB_UseTargets( pActivator, useType, value );

	if( RemoveOnFire() )
	{
		UTIL_Remove( this );
	}
}
예제 #16
0
public func Damage(int change, int cause, int cause_plr)
{
	// Only do stuff if the object has the HitPoints property.
	if (this && this.HitPoints != nil)
		if (GetDamage() >= this.HitPoints)
		{		
			// Destruction callback is made by the engine.
			return RemoveObject();
		}
	return _inherited(change, cause, cause_plr, ...);
}
예제 #17
0
void CTripmineGrenade::DelayDeathThink( void )
{
	KillBeam();
	trace_t tr;
	UTIL_TraceLine ( GetAbsOrigin() + m_vecDir * 8, GetAbsOrigin() - m_vecDir * 64,  MASK_SOLID, this, COLLISION_GROUP_NONE, & tr);
	UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );

	ExplosionCreate( GetAbsOrigin() + m_vecDir * 8, GetAbsAngles(), m_hOwner, GetDamage(), 200, 
		SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE, 0.0f, this);

	UTIL_Remove( this );
}
void AMMO_Character::MeleeAttackRaycasts()
{
	FVector BaseSocketLoc = Player_SkeletalMeshComponent->GetSocketLocation(FName("Sword_joint"));
	FVector TipSocketLoc = Player_SkeletalMeshComponent->GetSocketLocation(FName("Sword_Edge"));

	const int sub = 32;
	float curLength = (BaseSocketLoc - TipSocketLoc).Size() * 2;
	float prevLength = (prevBase - prevTip).Size();
	for (int i = 1; i < sub; i++)
	{
		FVector tmpBase = FMath::Lerp(BaseSocketLoc, prevBase, i / float(sub));
		FVector tmpTip = FMath::Lerp(TipSocketLoc, prevTip, i / float(sub));
		FVector tmpOff = (tmpTip - tmpBase);
		tmpOff.Normalize();
	}
	prevBase = BaseSocketLoc;
	prevTip = TipSocketLoc;

	FHitResult Hit;
	FCollisionQueryParams ColParams = FCollisionQueryParams(FName("NoName"), false, GetOwner());
	ColParams.AddIgnoredActor(GetOwner());
	ColParams.AddIgnoredActor(this);
	if (GetWorld()->LineTraceSingleByChannel(Hit, BaseSocketLoc, TipSocketLoc, ECollisionChannel::ECC_WorldDynamic, ColParams))
	{
		if (Hit.Actor != GetOwner() && AnimInstance->bCanDamageMelee)
		{
			if (Cast<AMMO_Mob_Character>(Hit.Actor.Get()))
			{
				if (!Cast<AMMO_Mob_Character>(Hit.Actor.Get())->bIsDead && !Cast<AMMO_Mob_Character>(Hit.Actor.Get())->bIsImmunized)
				{
					if (Role < ROLE_Authority)
					{
						AnimInstance->bCanDamageMelee = false;
						GetDamage(BaseAttack, AttackBonusMin, AttackBonusMax, Cast<AMMO_Mob_Character>(Hit.Actor.Get()));
					}
				}
			}
			else if (Cast<ABoss>(Hit.Actor.Get()))
			{
				if (!Cast<ABoss>(Hit.Actor.Get())->bIsDead)
				{
					if (Role < ROLE_Authority)
					{
						AnimInstance->bCanDamageMelee = false;

						GetDamage_Boss(BaseAttack, AttackBonusMin, AttackBonusMax, Cast<ABoss>(Hit.Actor.Get()));
					}
				}
			}
		}
	}
}
예제 #19
0
void CASW_Rocket::SetTarget( CBaseEntity *pTarget )
{
	if ( m_hHomingTarget.Get() )
	{
		// if I had an old target, strike me from its list
		m_RocketAssigner.Deallocate( m_RocketAssigner.Find(pTarget), this );
	}
	m_hHomingTarget = pTarget;
	if ( pTarget )
	{
		m_RocketAssigner.Allocate( m_RocketAssigner.Insert(pTarget), this, GetDamage() );
	}
}
예제 #20
0
void CASW_Rocket::DoExplosion( bool bHitWall )
{
	Vector vecExplosionPos = GetAbsOrigin();
	CPASFilter filter( vecExplosionPos );

	EmitSound( m_szDetonationSound );

	DispatchParticleEffect( "explosion_air_small", GetAbsOrigin(), vec3_angle );

	CTakeDamageInfo info( this, GetOwnerEntity(), GetDamage(), DMG_BLAST );
	info.SetWeapon( m_hCreatorWeapon );
	ASWGameRules()->RadiusDamage( info, GetAbsOrigin(), 50, CLASS_NONE, NULL );
}
예제 #21
0
void CSnark::Event_Killed( const CTakeDamageInfo &inputInfo )
{
//	pev->model = iStringNull;// make invisible
	SetThink( &CSnark::SUB_Remove );
	SetNextThink( gpGlobals->curtime + 0.1f );
	SetTouch( NULL );

	// since squeak grenades never leave a body behind, clear out their takedamage now.
	// Squeaks do a bit of radius damage when they pop, and that radius damage will
	// continue to call this function unless we acknowledge the Squeak's death now. (sjb)
	m_takedamage = DAMAGE_NO;

	// play squeek blast
	CPASAttenuationFilter filter( this, 0.5 );
	enginesound->EmitSound( filter, entindex(), CHAN_ITEM, "squeek/sqk_blast1.wav", 1, 0.5, 0, PITCH_NORM );

	CSoundEnt::InsertSound( SOUND_COMBAT, GetAbsOrigin(), SNARK_EXPLOSION_VOLUME, 3.0 );

	UTIL_BloodDrips( WorldSpaceCenter(), Vector( 0, 0, 0 ), BLOOD_COLOR_YELLOW, 80 );

	if ( m_hOwner != NULL )
	{
		RadiusDamage( CTakeDamageInfo( this, m_hOwner, GetDamage(), DMG_BLAST ), GetAbsOrigin(), GetDamage() * 2.5, CLASS_NONE );
	}
	else
	{
		RadiusDamage( CTakeDamageInfo( this, this, GetDamage(), DMG_BLAST ), GetAbsOrigin(), GetDamage() * 2.5, CLASS_NONE );
	}

	// reset owner so death message happens
	if ( m_hOwner != NULL )
		SetOwnerEntity( m_hOwner );

	CTakeDamageInfo info = inputInfo;
	info.SetDamageType( DMG_GIB_CORPSE );

	BaseClass::Event_Killed( info );
}
예제 #22
0
void Monster::MeleeDamage(Game_Manager* gm_, Unit* target_)
{
	int damage_ = target_->SetDamage(gm_, GetPos(), DT_MELEE, GetDamage()*GetAtkApply(), GetTeam());
	GiveDamage(gm_, target_, DT_MELEE, damage_);
	target_->SetSlow(20);
	if(target_->GetMirrorDamage())
	{
		SetDamage(gm_, target_->GetPos(), DT_MIRROR, target_->GetMirrorDamage(), target_->GetTeam());
	}
	if(target_->GetMirrorKnockback())
	{
		SetKnockback(target_->GetMirrorKnockback(), target_->GetMirrorKnockback()*2, GetAngleToTarget(target_->GetPos(),GetPos()));
	}
}
예제 #23
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFBaseRocket::Explode( trace_t *pTrace, CBaseEntity *pOther )
{
	// Save this entity as enemy, they will take 100% damage.
	m_hEnemy = pOther;

	// Invisible.
	SetModelName( NULL_STRING );
	AddSolidFlags( FSOLID_NOT_SOLID );
	m_takedamage = DAMAGE_NO;

	// Pull out a bit.
	if ( pTrace->fraction != 1.0 )
	{
		SetAbsOrigin( pTrace->endpos + ( pTrace->plane.normal * 1.0f ) );
	}

	// Play explosion sound and effect.
	Vector vecOrigin = GetAbsOrigin();
	CPVSFilter filter( vecOrigin );
	TE_TFExplosion( filter, 0.0f, vecOrigin, pTrace->plane.normal, GetWeaponID(), pOther->entindex() );
	CSoundEnt::InsertSound ( SOUND_COMBAT, vecOrigin, 1024, 3.0 );

	// Damage.
	CBaseEntity *pAttacker = GetOwnerEntity();
	IScorer *pScorerInterface = dynamic_cast<IScorer*>( pAttacker );
	if ( pScorerInterface )
	{
		pAttacker = pScorerInterface->GetScorer();
	}

	CTakeDamageInfo info( this, pAttacker, vec3_origin, vecOrigin, GetDamage(), GetDamageType() );
	float flRadius = GetRadius();
	RadiusDamage( info, vecOrigin, flRadius, CLASS_NONE, NULL );

	// Debug!
	if ( tf_rocket_show_radius.GetBool() )
	{
		DrawRadius( flRadius );
	}

	// Don't decal players with scorch.
	if ( !pOther->IsPlayer() )
	{
		UTIL_DecalTrace( pTrace, "Scorch" );
	}

	// Remove the rocket.
	UTIL_Remove( this );
}
예제 #24
0
//
// Get the threat of this explosion to the given armour class
//
U32 ExplosionObjType::GetThreat(U32 armourClass)
{
  return 
  (
    U32
    (
      F32
      (
        GetDamage().GetAmount(armourClass)
      ) * 
      (
        (areaInner + areaOuter) * 0.001f * (persist + 1.0f)
      )
    )
  );
}
예제 #25
0
void CUser::Attack(int sid, int tid)
{
	CNpc* pNpc = m_pMain->m_arNpc.GetData(tid-NPC_BAND);
	if(pNpc == NULL)	return;
	if(pNpc->m_NpcState == NPC_DEAD) return;
	if(pNpc->m_iHP == 0) return;

/*	if(pNpc->m_tNpcType == NPCTYPE_GUARD)					// 경비병이면 타겟을 해당 유저로
	{
		pNpc->m_Target.id = m_iUserId + USER_BAND;
		pNpc->m_Target.x = m_curx;
		pNpc->m_Target.y = m_cury;
		pNpc->m_Target.failCount = 0;
		pNpc->Attack(m_pIocport);
	//	return;
	}	*/

	int nDefence = 0, nFinalDamage = 0;
	// NPC 방어값 
	nDefence = pNpc->GetDefense();

	// 명중이면 //Damage 처리 ----------------------------------------------------------------//
	nFinalDamage = GetDamage(tid);
	if( m_pMain->m_byTestMode )		nFinalDamage = 3000;	// sungyong test
		
	// Calculate Target HP	 -------------------------------------------------------//
	short sOldNpcHP = pNpc->m_iHP;

	if(pNpc->SetDamage(0, nFinalDamage, m_strUserID, m_iUserId + USER_BAND, m_pIocport) == FALSE)
	{
		// Npc가 죽은 경우,,
		pNpc->SendExpToUserList(); // 경험치 분배!!
		pNpc->SendDead(m_pIocport);
		SendAttackSuccess(tid, ATTACK_TARGET_DEAD, nFinalDamage, pNpc->m_iHP);

	//	CheckMaxValue(m_dwXP, 1);		// 몹이 죽을때만 1 증가!	
	//	SendXP();
	}
	else
	{
		// 공격 결과 전송
		SendAttackSuccess(tid, ATTACK_SUCCESS, nFinalDamage, pNpc->m_iHP);
	}
	//	m_dwLastAttackTime = GetTickCount();
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pOther - 
//			tr - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CBasePlasmaProjectile::ProjectileHitShield( CBaseEntity *pOther, trace_t& tr )
{
	if ( !pOther )
		return false;

	if ( !pOther->IsPlayer() )
		return false;
#if !defined( CLIENT_DLL )
	CBaseTFPlayer* pPlayer = static_cast<CBaseTFPlayer*>(pOther);
	float flDamage = GetDamage();
	if ( !pPlayer->IsHittingShield( GetAbsVelocity(), &flDamage ) )
		return false;
#else
	return false;
#endif

	return true;
}
예제 #27
0
	void Explode( float magnitude )
	{
		//Create a concussive explosion
		CPASFilter filter( GetAbsOrigin() );

		Vector vecForward;
		AngleVectors( GetAbsAngles(), &vecForward );
		TE_ConcussiveExplosion( filter, 0.0,
			&GetAbsOrigin(),//position
			1.0f,	//scale
			GetDamageRadius()*magnitude,	//radius
			175*magnitude,	//magnitude
			&vecForward );	//normal
		
		int	colorRamp = random->RandomInt( 128, 255 );

		//Shockring
		CBroadcastRecipientFilter filter2;
		te->BeamRingPoint( filter2, 0, 
			GetAbsOrigin(),	//origin
			16,			//start radius
			GetDamageRadius()*1.17f*magnitude,		//end radius
			m_spriteTexture, //texture
			0,			//halo index
			0,			//start frame
			2,			//framerate
			0.3f,		//life
			128,		//width
			16,			//spread
			0,			//amplitude
			colorRamp,	//r
			colorRamp,	//g
			255,		//g
			24,			//a
			128			//speed
			);

		//Do the radius damage
		RadiusDamage( CTakeDamageInfo( this, GetOwnerEntity(), GetDamage(), DMG_BLAST|DMG_DISSOLVE ), GetAbsOrigin(), GetDamageRadius(), CLASS_NONE, NULL );

		UTIL_Remove( this );
	}
//-----------------------------------------------------------------------------
// Purpose: Sap the health from the object I'm attached to
//-----------------------------------------------------------------------------
void CGrenadeObjectSapper::SapperThink( void )
{
	SetNextThink( gpGlobals->curtime + 0.1f );

	// Not armed yet?
	if ( !GetArmed() )
		return;

	// Remove myself if I'm armed, but don't have an object to sap
	if ( !m_hTargetObject )
	{
		UTIL_Remove( this );
		return;
	}

	m_bSapping = true;

	// Damage our target (add DMG_CRUSH to prevent physics damage)
	m_hTargetObject->TakeDamage( CTakeDamageInfo( this, GetOwnerEntity(), GetDamage(), GetDamageType() | DMG_CRUSH ) );
}
예제 #29
0
//-----------------------------------------------------------------------------
// The actual explosion 
//-----------------------------------------------------------------------------
void CDODBaseRocket::DoExplosion( void )
{
	// Explode
	ExplosionCreate( 
		GetAbsOrigin(),	//DMG_ROCKET
		GetAbsAngles(),
		GetOwnerEntity(),
		GetDamage(),		//magnitude
		mp_rocketradius.GetFloat(),				//radius
		SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE,
		0.0f,				//explosion force
		this);				//inflictor

	// stun players in a radius
	const float flStunDamage = 75;
	const float flRadius = 150;

	CTakeDamageInfo info( this, GetOwnerEntity(), vec3_origin, GetAbsOrigin(), flStunDamage, DMG_STUN );
	DODGameRules()->RadiusStun( info, GetAbsOrigin(), flRadius );
}
예제 #30
0
void Projectile::StaticUpdate(const float timeStep)
{
	CollisionContact c;
	vector3d vel = (m_baseVel+m_dirVel) * timeStep;
	GetFrame()->GetCollisionSpace()->TraceRay(GetPosition(), vel.Normalized(), vel.Length(), &c, 0);
	
	if (c.userData1) {
		Object *o = static_cast<Object*>(c.userData1);

		if (o->IsType(Object::CITYONPLANET)) {
			Pi::game->GetSpace()->KillBody(this);
		}
		else if (o->IsType(Object::BODY)) {
			Body *hit = static_cast<Body*>(o);
			if (hit != m_parent) {
				hit->OnDamage(m_parent, GetDamage());
				Pi::game->GetSpace()->KillBody(this);
				if (hit->IsType(Object::SHIP))
					Pi::luaOnShipHit->Queue(dynamic_cast<Ship*>(hit), dynamic_cast<Body*>(m_parent));
			}
		}
	}
	if (Equip::lasers[m_type].flags & Equip::LASER_MINING) {
		// need to test for terrain hit
		if (GetFrame()->m_astroBody && GetFrame()->m_astroBody->IsType(Object::PLANET)) {
			Planet *const planet = static_cast<Planet*>(GetFrame()->m_astroBody);
			const SBody *b = planet->GetSBody();
			vector3d pos = GetPosition();
			double terrainHeight = planet->GetTerrainHeight(pos.Normalized());
			if (terrainHeight > pos.Length()) {
				// hit the f****r
				if (b->type == SBody::TYPE_PLANET_ASTEROID) {
					vector3d n = GetPosition().Normalized();
					MiningLaserSpawnTastyStuff(planet->GetFrame(), b, n*terrainHeight + 5.0*n);
					Sfx::Add(this, Sfx::TYPE_EXPLOSION);
				}
				Pi::game->GetSpace()->KillBody(this);
			}
		}
	}
}