Example #1
0
void CNPC_HL1Barney::TraceAttack( const CTakeDamageInfo &inputInfo, const Vector &vecDir, trace_t *ptr )
{
	CTakeDamageInfo info = inputInfo;

	switch( ptr->hitgroup )
	{
	case HITGROUP_CHEST:
	case HITGROUP_STOMACH:
		if ( info.GetDamageType() & (DMG_BULLET | DMG_SLASH | DMG_BLAST) )
		{
			info.ScaleDamage( 0.5f );
		}
		break;
	case 10:
		if ( info.GetDamageType() & (DMG_BULLET | DMG_SLASH | DMG_CLUB) )
		{
			info.SetDamage( info.GetDamage() - 20 );
			if ( info.GetDamage() <= 0 )
			{
				g_pEffects->Ricochet( ptr->endpos, ptr->plane.normal );
				info.SetDamage( 0.01 );
			}
		}
		// always a head shot
		ptr->hitgroup = HITGROUP_HEAD;
		break;
	}

	BaseClass::TraceAttack( info, vecDir, ptr );
}
Example #2
0
//-----------------------------------------------------------------------------
// Item crates blow up immediately
//-----------------------------------------------------------------------------
int CItem_ItemCrate::OnTakeDamage( const CTakeDamageInfo &info )
{
	if ( info.GetDamageType() & DMG_AIRBOAT )
	{
		CTakeDamageInfo dmgInfo = info;
		dmgInfo.ScaleDamage( 10.0 );
		return BaseClass::OnTakeDamage( dmgInfo );
	}

	return BaseClass::OnTakeDamage( info );
}
Example #3
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CASW_PropJeep::OnTakeDamage( const CTakeDamageInfo &inputInfo )
{
	//Do scaled up physics damage to the car
	CTakeDamageInfo info = inputInfo;
	info.ScaleDamage( 25 );
	
	// HACKHACK: Scale up grenades until we get a better explosion/pressure damage system
	if ( inputInfo.GetDamageType() & DMG_BLAST )
	{
		info.SetDamageForce( inputInfo.GetDamageForce() * 10 );
	}
	VPhysicsTakeDamage( info );

	// reset the damage
	info.SetDamage( inputInfo.GetDamage() );

	// small amounts of shock damage disrupt the car, but aren't transferred to the player
	if ( info.GetDamageType() == DMG_SHOCK )
	{
		if ( info.GetDamage() <= 10 )
		{
			// take 10% damage and make the engine stall
			info.ScaleDamage( 0.1 );
			m_throttleDisableTime = gpGlobals->curtime + 2;
		}
	}

	//Check to do damage to driver
	if ( GetDriver() )
	{
		//Take no damage from physics damages
		if ( info.GetDamageType() & DMG_CRUSH )
			return 0;

		// Take the damage (strip out the DMG_BLAST)
		info.SetDamageType( info.GetDamageType() & (~DMG_BLAST) );
		GetDriver()->TakeDamage( info );
	}

	return 0;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CPropAirboat::OnTakeDamage( const CTakeDamageInfo &info )
{
	//Do scaled up physic damage to the car
	CTakeDamageInfo physDmg = info;
	physDmg.ScaleDamage( 5 );
	VPhysicsTakeDamage( physDmg );

	//Check to do damage to driver
	if ( m_hPlayer != NULL )
	{
		//Take no damage from physics damages
		if ( info.GetDamageType() & DMG_CRUSH )
			return 0;

		//Take the damage
		physDmg.ScaleDamage( 1 );
		m_hPlayer->TakeDamage( info );
	}

	return 0;
}
Example #5
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CASW_PropJeep::TraceAttack( const CTakeDamageInfo &inputInfo, const Vector &vecDir, trace_t *ptr )
{
	CTakeDamageInfo info = inputInfo;
	if ( ptr->hitbox != VEHICLE_HITBOX_DRIVER )
	{
		if ( inputInfo.GetDamageType() & DMG_BULLET )
		{
			info.ScaleDamage( 0.0001 );
		}
	}

	BaseClass::TraceAttack( info, vecDir, ptr );
}
// Крематор игнорирует урон огнем
int CNPC_Cremator::OnTakeDamage_Alive( const CTakeDamageInfo &info )
{
	CTakeDamageInfo newInfo = info;
	if( newInfo.GetDamageType() & DMG_BURN)
	{
		newInfo.ScaleDamage( 0 );
		DevMsg( "Fire damage; no actual damage is taken\n" );
	}	

	int nDamageTaken = BaseClass::OnTakeDamage_Alive( newInfo );

//	m_bHeadshot = false;
//	m_bCanisterShot = false;

	return nDamageTaken;
}
Example #7
0
int CASW_Parasite::OnTakeDamage_Alive( const CTakeDamageInfo &info )
{
	if (m_flDamageImmuneUntil >= gpGlobals->curtime)
	{
		return 0;
	}

	// scale damage up while in the air
	if (m_bMidJump)
	{
		CTakeDamageInfo newDamage = info;
		newDamage.ScaleDamage(10.0f);
		return BaseClass::OnTakeDamage_Alive(newDamage);
	}

	return BaseClass::OnTakeDamage_Alive(info);
}
Example #8
0
int CASW_Parasite::OnTakeDamage_Alive( const CTakeDamageInfo &info )
{
	int result = 0;

	// scale damage up while in the air
	if (m_bMidJump)
	{
		CTakeDamageInfo newDamage = info;		
		newDamage.ScaleDamage(10.0f);
		result = BaseClass::OnTakeDamage_Alive(newDamage);
	}
	else
	{
		result = BaseClass::OnTakeDamage_Alive(info);
	}

	return result;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CPropVehicleChoreoGeneric::OnTakeDamage( const CTakeDamageInfo &inputInfo )
{
	CTakeDamageInfo info = inputInfo;
	info.ScaleDamage( 25 );

	// reset the damage
	info.SetDamage( inputInfo.GetDamage() );

	// Check to do damage to prisoner
	if ( m_hPlayer != NULL )
	{
		// Take no damage from physics damages
		if ( info.GetDamageType() & DMG_CRUSH )
			return 0;

		// Take the damage
		m_hPlayer->TakeDamage( info );
	}

	return 0;
}
Example #10
0
//---------------------------------------------------------
//---------------------------------------------------------
int CASW_Zombie::OnTakeDamage_Alive( const CTakeDamageInfo &info )
{
#ifndef HL2_EPISODIC
	if ( info.GetDamageType() & DMG_BUCKSHOT )
	{
		if( !m_fIsTorso && info.GetDamage() > (m_iMaxHealth/3) )
		{
			// Always flinch if damaged a lot by buckshot, even if not shot in the head.
			// The reason for making sure we did at least 1/3rd of the zombie's max health
			// is so the zombie doesn't flinch every time the odd shotgun pellet hits them,
			// and so the maximum number of times you'll see a zombie flinch like this is 2.(sjb)
			AddGesture( ACT_GESTURE_FLINCH_HEAD );
		}
	}
#endif // HL2_EPISODIC
	// catching on fire
	int result = 0;

	// scale burning damage up
	if (dynamic_cast<CEntityFlame*>(info.GetAttacker()))
	{
		CTakeDamageInfo newDamage = info;		
		newDamage.ScaleDamage(asw_fire_zombie_damage_scale.GetFloat());
		result = BaseClass::OnTakeDamage_Alive(newDamage);
	}
	else
	{
		result = BaseClass::OnTakeDamage_Alive(info);
	}

	// if we take fire damage, catch on fire
	if (result > 0 && (info.GetDamageType() & DMG_BURN))
		ASW_Ignite(30.0f, 0, info.GetAttacker());

	//CASW_Marine* pMarine = dynamic_cast<CASW_Marine*>(info.GetAttacker());
	//if (pMarine)
		//pMarine->HurtAlien(this);

	return BaseClass::OnTakeDamage_Alive( info );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CNPC_CeilingTurret::OnTakeDamage( const CTakeDamageInfo &inputInfo )
{
	if ( !m_takedamage )
		return 0;

	CTakeDamageInfo info = inputInfo;

	if ( m_bActive == false )
		info.ScaleDamage( 0.1f );

	// If attacker can't do at least the min required damage to us, don't take any damage from them
	if ( info.GetDamage() < m_iMinHealthDmg )
		return 0;

	m_iHealth -= info.GetDamage();

	if ( m_iHealth <= 0 )
	{
		m_iHealth = 0;
		m_takedamage = DAMAGE_NO;

		RemoveFlag( FL_NPC ); // why are they set in the first place???

		//FIXME: This needs to throw a ragdoll gib or something other than animating the retraction -- jdw

		ExplosionCreate( GetAbsOrigin(), GetLocalAngles(), this, 100, 100, false );
		SetThink( &CNPC_CeilingTurret::DeathThink );

		StopSound( "NPC_CeilingTurret.Alert" );

		m_OnDamaged.FireOutput( info.GetInflictor(), this );

		SetNextThink( gpGlobals->curtime + 0.1f );

		return 0;
	}

	return 1;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CPropCrane::OnTakeDamage( const CTakeDamageInfo &inputInfo )
{
	//Do scaled up physics damage to the car
	CTakeDamageInfo info = inputInfo;
	info.ScaleDamage( 25 );

	// reset the damage
	info.SetDamage( inputInfo.GetDamage() );

	//Check to do damage to driver
	if ( m_hPlayer != NULL )
	{
		//Take no damage from physics damages
		if ( info.GetDamageType() & DMG_CRUSH )
			return 0;

		//Take the damage
		m_hPlayer->TakeDamage( info );
	}

	return 0;
}
Example #13
0
//-----------------------------------------------------------------------------
// Purpose:
// Input  :
// Output :
//-----------------------------------------------------------------------------
int	CNPC_Stalker::OnTakeDamage_Alive( const CTakeDamageInfo &inputInfo )
{
	CTakeDamageInfo info = inputInfo;

	// --------------------------------------------
	//	Don't take a lot of damage from Vortigaunt
	// --------------------------------------------
	if (info.GetAttacker()->Classify() == CLASS_VORTIGAUNT)
	{
		info.ScaleDamage( 0.25 );
	}


	int ret = BaseClass::OnTakeDamage_Alive( info );

	// If player shot me make sure I'm mad at him even if I wasn't earlier
	if ( (info.GetAttacker()->GetFlags() & FL_CLIENT) )
	{
		AddClassRelationship( CLASS_PLAYER, D_HT, 0 );
	}
	return ret;
}
Example #14
0
int CBaseTurret::OnTakeDamage( const CTakeDamageInfo &inputInfo )
{
	if ( !m_takedamage )
		return 0;

	CTakeDamageInfo info = inputInfo;

	if (!m_iOn)
		info.ScaleDamage( 0.1f );

	m_iHealth -= info.GetDamage();
	if (m_iHealth <= 0)
	{
		m_iHealth = 0;
		m_takedamage = DAMAGE_NO;
		m_flDamageTime = gpGlobals->curtime;

		RemoveFlag( FL_NPC ); // why are they set in the first place???

		SetThink(TurretDeath);

		m_OnDamaged.FireOutput( info.GetInflictor(), this );

		SetNextThink( gpGlobals->curtime + 0.1f );

		return 0;
	}

	if (m_iHealth <= 10)
	{
		if (m_iOn && (1 || random->RandomInt(0, 0x7FFF) > 800))
		{
			m_fBeserk = 1;
			SetThink(SearchThink);
		}
	}

	return 1;
}
// Далее следует массивая таблица просчета повреждений и урона от разных типов вооружения.
void CNPC_Cremator::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{	
	CTakeDamageInfo newInfo = info;
	// the head and the abdomen sphere are the only vulnerable parts,
	// the legs, arms and stuff under the cloak is likely just some machinery,
	// and the C. is encountered in City after the lab and in Canals when
	// the player doesn't have weapon apart from crowbar, pistol and SMG
	// TODO: torn clothes with bullets, exposing underlying machinery
	if( (newInfo.GetDamageType() & DMG_BULLET || DMG_CLUB || DMG_BUCKSHOT || DMG_ENERGYBEAM ) ) 
	{			
		// the multipliers here are so small because of the innate 
		// headshot multiplayer which makes killing a cremator with headshots
		// ridiculously easy even on Hard. So all of them were divided by 6.
		if( ptr->hitgroup == HITGROUP_HEAD ) 
		{			
			m_bHeadshot = 1;

			if( g_pGameRules->IsSkillLevel(SKILL_EASY) )
			{
				if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") ) // base damage 100
				{
					newInfo.ScaleDamage( 1.0 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") ) // base damage 40
				{
					newInfo.ScaleDamage( 0.6 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") )
				{
					newInfo.ScaleDamage( 0.1 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("10mm") )
				{
					newInfo.ScaleDamage( 0.75 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") )
				{
					newInfo.ScaleDamage( 1.0 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") )
				{
					newInfo.ScaleDamage( 0.5 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") )
				{
					newInfo.ScaleDamage( 0.192 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("CombineRounds") )
				{
					newInfo.ScaleDamage( 1.5 );
				}
			}
			else if( g_pGameRules->IsSkillLevel(SKILL_HARD) )
			{
				if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") ) // base damage 100
				{
					newInfo.ScaleDamage( 0.33 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") ) // base damage 40
				{
					newInfo.ScaleDamage( 0.33 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") )
				{
					newInfo.ScaleDamage( 0.1 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("10mm") )
				{
					newInfo.ScaleDamage( 0.5 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") )
				{
					newInfo.ScaleDamage( 0.65 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") )
				{
					newInfo.ScaleDamage( 0.45 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") )
				{
					newInfo.ScaleDamage( 0.146 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("CombineRounds") )
				{
					newInfo.ScaleDamage( 2.5 );
				}
			}			
			else
			{
				if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") )
				{
					newInfo.ScaleDamage( 0.66  );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") )
				{
					newInfo.ScaleDamage( 0.5  );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") )
				{
					newInfo.ScaleDamage( 0.1  );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("10mm") )
				{
					newInfo.ScaleDamage( 0.66 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") )
				{
					newInfo.ScaleDamage( 0.75 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") )
				{
					newInfo.ScaleDamage( 0.4 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") )
				{
					newInfo.ScaleDamage( 0.16 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("CombineRounds") )
				{
					newInfo.ScaleDamage( 2.0 );
				}
			}
		}
		else if( ptr->hitgroup == CREMATOR_CANISTER )
		{
			m_bCanisterShot = 1; // попадание в канистру на животе.

			if( g_pGameRules->IsSkillLevel(SKILL_EASY) )
			{
				if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") )
				{
					newInfo.ScaleDamage( 1.5 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") )
				{
					newInfo.ScaleDamage( 2.0 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") )
				{
					newInfo.ScaleDamage( 0.66 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") )
				{
					newInfo.ScaleDamage( 1.15 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") )
				{
					newInfo.ScaleDamage( 1.15 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") )
				{
					newInfo.ScaleDamage( 1.15 );
				}
			}
			else if( g_pGameRules->IsSkillLevel(SKILL_HARD) )
			{
				if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") )
				{
					newInfo.ScaleDamage( 1.15 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") )
				{
					newInfo.ScaleDamage( 1.75 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") )
				{
					newInfo.ScaleDamage( 0.33 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") )
				{
					newInfo.ScaleDamage( 0.75 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") )
				{
					newInfo.ScaleDamage( 0.75 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") )
				{
					newInfo.ScaleDamage( 0.875 );
				}
			}
			else if (g_pGameRules->IsSkillLevel(SKILL_VERYHARD))
			{
				if (newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG"))
				{
					newInfo.ScaleDamage(1.05);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("357"))
				{
					newInfo.ScaleDamage(1.50);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19"))
				{
					newInfo.ScaleDamage(0.25);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45"))
				{
					newInfo.ScaleDamage(0.50);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot"))
				{
					newInfo.ScaleDamage(0.50);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium"))
				{
					newInfo.ScaleDamage(0.65);
				}
			}
			else if (g_pGameRules->IsSkillLevel(SKILL_HARD))
			{
				if (newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG"))
				{
					newInfo.ScaleDamage(0.85);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("357"))
				{
					newInfo.ScaleDamage(1.25);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19"))
				{
					newInfo.ScaleDamage(0.15);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45"))
				{
					newInfo.ScaleDamage(0.25);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot"))
				{
					newInfo.ScaleDamage(0.25);
				}
				else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium"))
				{
					newInfo.ScaleDamage(0.50);
				}
			}
			else
			{
				if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") )
				{
					newInfo.ScaleDamage( 1.25 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") )
				{
					newInfo.ScaleDamage( 1.5 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") )
				{
					newInfo.ScaleDamage( 0.5 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") )
				{
					newInfo.ScaleDamage( 1.0 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") )
				{
					newInfo.ScaleDamage( 1.0 );
				}
				else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") )
				{
					newInfo.ScaleDamage( 1.0 );
				}
			}
		}
/*		// however, if the sprayer is damaged, something unpleasant may happen
		else if (ptr->hitgroup == CREMATOR_GUN )
		{
		// well, right now I can't think of any specific effect
			DevMsg( "Cremator: gear is damaged\n");
		}*/

		else
		{
			newInfo.ScaleDamage( 0.75 ); // В общем случае, крематор получает толко 25% урона (т.е. имеет сопротивление 75)
			DevMsg( "Generic 0.25 Non-specified\n" );
		}
	}
//	BaseClass::TraceAttack( newInfo, vecDir, ptr );
}
Example #16
0
void CASW_Alien::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
#ifdef GAME_DLL
    m_fNoDamageDecal = false;
    if ( m_takedamage == DAMAGE_NO )
        return;
#endif

    CTakeDamageInfo subInfo = info;

#ifdef GAME_DLL
    SetLastHitGroup( ptr->hitgroup );
    m_nForceBone = ptr->physicsbone;		// save this bone for physics forces
#endif

    Assert( m_nForceBone > -255 && m_nForceBone < 256 );

    // mining laser does reduced damage
    if ( info.GetDamageType() & DMG_ENERGYBEAM )
    {
        subInfo.ScaleDamage( asw_alien_mining_laser_damage_scale.GetFloat() );
    }

    if ( subInfo.GetDamage() >= 1.0 && !(subInfo.GetDamageType() & DMG_SHOCK )
            && !( subInfo.GetDamageType() & DMG_BURN ) )
    {
#ifdef GAME_DLL
        Bleed( subInfo, ptr->endpos + m_LagCompensation.GetLagCompensationOffset(), vecDir, ptr );
        if ( ptr->hitgroup == HITGROUP_HEAD && m_iHealth - subInfo.GetDamage() > 0 )
        {
            m_fNoDamageDecal = true;
        }
#else
        Bleed( subInfo, ptr->endpos, vecDir, ptr );
        //OnHurt();
#endif
    }

    if( !info.GetInflictor() )
    {
        subInfo.SetInflictor( info.GetAttacker() );
    }


    AddMultiDamage( subInfo, this );
#ifdef GAME_DLL
#else
    CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>( subInfo.GetAttacker() );
    CASW_Player *pPlayerAttacker = NULL;

    if ( pMarine )
    {
        pPlayerAttacker = pMarine->GetCommander();
    }

    IGameEvent * event = gameeventmanager->CreateEvent( "alien_hurt" );
    if ( event )
    {
        event->SetInt( "attacker", ( pPlayerAttacker ? pPlayerAttacker->GetUserID() : 0 ) );
        event->SetInt( "entindex", entindex() );
        event->SetInt( "amount", subInfo.GetDamage() );
        gameeventmanager->FireEventClientSide( event );
    }

    UTIL_ASW_ClientFloatingDamageNumber( subInfo );
#endif
}
Example #17
0
// make the bleeding more pronounced
void CASW_Zombie::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
	m_fNoDamageDecal = false;
	if ( m_takedamage == DAMAGE_NO )
		return;

	CTakeDamageInfo subInfo = info;

	SetLastHitGroup( ptr->hitgroup );
	m_nForceBone = ptr->physicsbone;		// save this bone for physics forces

	Assert( m_nForceBone > -255 && m_nForceBone < 256 );

	bool bDebug = showhitlocation.GetBool();

	switch ( ptr->hitgroup )
	{
	case HITGROUP_GENERIC:
		if( bDebug ) DevMsg("Hit Location: Generic\n");
		break;

	// hit gear, react but don't bleed
	case HITGROUP_GEAR:
		subInfo.SetDamage( 0.01 );
		ptr->hitgroup = HITGROUP_GENERIC;
		if( bDebug ) DevMsg("Hit Location: Gear\n");
		break;

	case HITGROUP_HEAD:
		subInfo.ScaleDamage( GetHitgroupDamageMultiplier(ptr->hitgroup, info) );
		if( bDebug ) DevMsg("Hit Location: Head\n");
		break;

	case HITGROUP_CHEST:
		subInfo.ScaleDamage( GetHitgroupDamageMultiplier(ptr->hitgroup, info) );
		if( bDebug ) DevMsg("Hit Location: Chest\n");
		break;

	case HITGROUP_STOMACH:
		subInfo.ScaleDamage( GetHitgroupDamageMultiplier(ptr->hitgroup, info) );
		if( bDebug ) DevMsg("Hit Location: Stomach\n");
		break;

	case HITGROUP_LEFTARM:
	case HITGROUP_RIGHTARM:
		subInfo.ScaleDamage( GetHitgroupDamageMultiplier(ptr->hitgroup, info) );
		if( bDebug ) DevMsg("Hit Location: Left/Right Arm\n");
		break
			;
	case HITGROUP_LEFTLEG:
	case HITGROUP_RIGHTLEG:
		subInfo.ScaleDamage( GetHitgroupDamageMultiplier(ptr->hitgroup, info) );
		if( bDebug ) DevMsg("Hit Location: Left/Right Leg\n");
		break;

	default:
		if( bDebug ) DevMsg("Hit Location: UNKNOWN\n");
		break;
	}

	if ( subInfo.GetDamage() >= 1.0 && !(subInfo.GetDamageType() & DMG_SHOCK ) )
	{
		if( !IsPlayer() || ( IsPlayer() && gpGlobals->maxClients > 1 ) )
		{
			// NPC's always bleed. Players only bleed in multiplayer.
			//SpawnBlood( ptr->endpos, vecDir, BloodColor(), subInfo.GetDamage() );// a little surface blood.
			//UTIL_ASW_DroneBleed( ptr->endpos, vecDir, 4 );
			UTIL_ASW_BloodDrips( GetAbsOrigin()+Vector(0,0,60)+vecDir*3, vecDir, BloodColor(), 5 );
		}

		TraceBleed( subInfo.GetDamage(), vecDir, ptr, subInfo.GetDamageType() );

		if ( ptr->hitgroup == HITGROUP_HEAD && m_iHealth - subInfo.GetDamage() > 0 )
		{
			m_fNoDamageDecal = true;
		}
	}

	// Airboat gun will impart major force if it's about to kill him....
	if ( info.GetDamageType() & DMG_AIRBOAT )
	{
		if ( subInfo.GetDamage() >= GetHealth() )
		{
			float flMagnitude = subInfo.GetDamageForce().Length();
			if ( (flMagnitude != 0.0f) && (flMagnitude < 400.0f * 65.0f) )
			{
				subInfo.ScaleDamageForce( 400.0f * 65.0f / flMagnitude );
			}
		}
	}

	if( info.GetInflictor() )
	{
		subInfo.SetInflictor( info.GetInflictor() );
	}
	else
	{
		subInfo.SetInflictor( info.GetAttacker() );
	}

	AddMultiDamage( subInfo, this );
}