void CASW_Simple_Alien::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ) { if ( m_takedamage == DAMAGE_NO ) return; CTakeDamageInfo subInfo = info; m_nForceBone = ptr->physicsbone; // save this bone for physics forces Assert( m_nForceBone > -255 && m_nForceBone < 256 ); if ( subInfo.GetDamage() >= 1.0 && !(subInfo.GetDamageType() & DMG_SHOCK ) && !(subInfo.GetDamageType() & DMG_BURN )) { // 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 ); // + m_LagCompensation.GetLagCompensationOffset() ASWTraceBleed( subInfo.GetDamage(), vecDir, ptr, subInfo.GetDamageType() ); } if( info.GetInflictor() ) { subInfo.SetInflictor( info.GetInflictor() ); } else { subInfo.SetInflictor( info.GetAttacker() ); } AddMultiDamage( subInfo, this ); }
void C_HL2MP_Player::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator ) { Vector vecOrigin = ptr->endpos - vecDir * 4; float flDistance = 0.0f; if ( info.GetAttacker() ) { flDistance = (ptr->endpos - info.GetAttacker()->GetAbsOrigin()).Length(); } if ( m_takedamage ) { AddMultiDamage( info, this ); int blood = BloodColor(); CBaseEntity *pAttacker = info.GetAttacker(); if ( pAttacker ) { if ( HL2MPRules()->IsTeamplay() && pAttacker->InSameTeam( this ) == true ) return; } if ( blood != DONT_BLEED ) { SpawnBlood( vecOrigin, vecDir, blood, flDistance );// a little surface blood. TraceBleed( flDistance, vecDir, ptr, info.GetDamageType() ); } } }
/* ================ TraceAttack ================ */ void TraceAttack( float damage, vec3_t dir ) { vec3_t vel, org, tmp; VectorScale( g_globalvars.v_up, crandom(), tmp ); VectorAdd( dir, tmp, vel ); VectorScale( g_globalvars.v_right, crandom(), tmp ); VectorAdd( vel, tmp, vel ); VectorNormalize( vel ); VectorScale( g_globalvars.trace_plane_normal, 2, tmp ); VectorAdd( vel, tmp, vel ); VectorScale( vel, 200, vel ); /*vel = normalize(dir + v_up*crandom() + v_right*crandom()); vel = vel + 2*trace_plane_normal; vel = vel * 200; */ VectorScale( dir, 4, tmp ); VectorSubtract( g_globalvars.trace_endpos, tmp, org ); // org = trace_endpos - dir*4; if ( PROG_TO_EDICT( g_globalvars.trace_ent )->s.v.takedamage ) { blood_count = blood_count + 1; VectorCopy( org, blood_org ); // blood_org = org; AddMultiDamage( PROG_TO_EDICT( g_globalvars.trace_ent ), damage ); } else { puff_count = puff_count + 1; } }
void CASW_Queen_Divers::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ) { if ( m_takedamage == DAMAGE_NO ) return; CTakeDamageInfo subInfo = info; m_nForceBone = ptr->physicsbone; // save this bone for physics forces Assert( m_nForceBone > -255 && m_nForceBone < 256 ); if ( subInfo.GetDamage() >= 1.0 && !(subInfo.GetDamageType() & DMG_SHOCK ) && !(subInfo.GetDamageType() & DMG_BURN )) { UTIL_ASW_DroneBleed( ptr->endpos, vecDir, 4 ); ASWTraceBleed( subInfo.GetDamage(), vecDir, ptr, subInfo.GetDamageType() ); } if( info.GetInflictor() ) { subInfo.SetInflictor( info.GetInflictor() ); } else { subInfo.SetInflictor( info.GetAttacker() ); } AddMultiDamage( subInfo, this ); }
void COsprey::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { // ALERT( at_console, "%d %.0f\n", ptr->iHitgroup, flDamage ); // only so much per engine if (ptr->iHitgroup == 3) { if (m_flRightHealth < 0) return; else m_flRightHealth -= flDamage; m_iDoLeftSmokePuff = 3 + (flDamage / 5.0); } if (ptr->iHitgroup == 2) { if (m_flLeftHealth < 0) return; else m_flLeftHealth -= flDamage; m_iDoRightSmokePuff = 3 + (flDamage / 5.0); } // hit hard, hits cockpit, hits engines if (flDamage > 50 || ptr->iHitgroup == 1 || ptr->iHitgroup == 2 || ptr->iHitgroup == 3) { // ALERT( at_console, "%.0f\n", flDamage ); AddMultiDamage(pevAttacker, this, flDamage, bitsDamageType); } else { UTIL_Sparks(ptr->vecEndPos); } }
void CApache::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { // ALERT( at_console, "%d %.0f\n", ptr->iHitgroup, flDamage ); //modif de Julien if ( FClassnameIs( ENT( pevAttacker ), "hvr_rocket" ) ) { return; } // ignore blades if (ptr->iHitgroup == 6 && (bitsDamageType & (DMG_ENERGYBEAM|DMG_BULLET|DMG_CLUB))) return; // hit hard, hits cockpit, hits engines if (flDamage > 50 || ptr->iHitgroup == 1 || ptr->iHitgroup == 2) { // ALERT( at_console, "%.0f\n", flDamage ); AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); m_iDoSmokePuff = 3 + (flDamage / 5.0); } else { // do half damage in the body // AddMultiDamage( pevAttacker, this, flDamage / 2.0, bitsDamageType ); UTIL_Ricochet( ptr->vecEndPos, 2.0 ); } }
void CFuncMachinegun::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { if (!pev->takedamage) return; AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); }
//========================================================= // TraceAttack //========================================================= void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { if ( pev->takedamage ) { SpawnBlood(ptr->vecEndPos, BloodColor(), flDamage);// a little surface blood. TraceBleed( flDamage, vecDir, ptr, bitsDamageType ); AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); } }
/* ================ TraceAttack ================ */ void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { Vector vecOrigin = ptr->vecEndPos - vecDir * 4; if ( pev->takedamage ) { AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); int blood = BloodColor(); if ( blood != DONT_BLEED ) { SpawnBlood(vecOrigin, blood, flDamage);// a little surface blood. TraceBleed( flDamage, vecDir, ptr, bitsDamageType ); } } }
void CNPC_AlienGrunt::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ) { CTakeDamageInfo ainfo = info; float flDamage = ainfo.GetDamage(); if ( ptr->hitgroup == 10 && (ainfo.GetDamageType() & (DMG_BULLET | DMG_SLASH | DMG_CLUB))) { // hit armor if ( m_flDamageTime != gpGlobals->curtime || (random->RandomInt(0,10) < 1) ) { CPVSFilter filter( ptr->endpos ); te->ArmorRicochet( filter, 0.0, &ptr->endpos, &ptr->plane.normal ); m_flDamageTime = gpGlobals->curtime; } if ( random->RandomInt( 0, 1 ) == 0 ) { Vector vecTracerDir = vecDir; vecTracerDir.x += random->RandomFloat( -0.3, 0.3 ); vecTracerDir.y += random->RandomFloat( -0.3, 0.3 ); vecTracerDir.z += random->RandomFloat( -0.3, 0.3 ); vecTracerDir = vecTracerDir * -512; Vector vEndPos = ptr->endpos + vecTracerDir; UTIL_Tracer( ptr->endpos, vEndPos, ENTINDEX( edict() ) ); } flDamage -= 20; if (flDamage <= 0) flDamage = 0.1;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated ainfo.SetDamage( flDamage ); } else { SpawnBlood( ptr->endpos, vecDir, BloodColor(), flDamage);// a little surface blood. TraceBleed( flDamage, vecDir, ptr, ainfo.GetDamageType() ); } AddMultiDamage( ainfo, this ); }
//========================================================= // TraceAttack //========================================================= void CAGrunt :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { if ( ptr->iHitgroup == 10 && (bitsDamageType & (DMG_BULLET | DMG_SLASH | DMG_CLUB))) { // hit armor if ( pev->dmgtime != gpGlobals->time || (RANDOM_LONG(0,10) < 1) ) { UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 1, 2) ); pev->dmgtime = gpGlobals->time; } if ( RANDOM_LONG( 0, 1 ) == 0 ) { Vector vecTracerDir = vecDir; vecTracerDir.x += RANDOM_FLOAT( -0.3, 0.3 ); vecTracerDir.y += RANDOM_FLOAT( -0.3, 0.3 ); vecTracerDir.z += RANDOM_FLOAT( -0.3, 0.3 ); vecTracerDir = vecTracerDir * -512; MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, ptr->vecEndPos ); WRITE_BYTE( TE_TRACER ); WRITE_COORD( ptr->vecEndPos.x ); WRITE_COORD( ptr->vecEndPos.y ); WRITE_COORD( ptr->vecEndPos.z ); WRITE_COORD( vecTracerDir.x ); WRITE_COORD( vecTracerDir.y ); WRITE_COORD( vecTracerDir.z ); MESSAGE_END(); } flDamage -= 20; if (flDamage <= 0) flDamage = 0.1;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated } else { SpawnBlood(ptr->vecEndPos, BloodColor(), flDamage);// a little surface blood. TraceBleed( flDamage, vecDir, ptr, bitsDamageType ); } AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); }
void CNihilanth::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { if (m_irritation == 3) m_irritation = 2; if (m_irritation == 2 && ptr->iHitgroup == 2 && flDamage > 2) m_irritation = 3; if (m_irritation != 3) { Vector vecBlood = (ptr->vecEndPos - pev->origin).Normalize( ); UTIL_BloodStream( ptr->vecEndPos, vecBlood, BloodColor(), flDamage + (100 - 100 * (pev->health / gSkillData.nihilanthHealth))); } // SpawnBlood(ptr->vecEndPos, BloodColor(), flDamage * 5.0);// a little surface blood. AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); }
void CBaseMonster::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { Vector vecOrigin = ptr->vecEndPos - vecDir * 4; if (pev->takedamage == DAMAGE_YES) { m_LastHitGroup = ptr->iHitgroup; switch (ptr->iHitgroup) { case HITGROUP_GENERIC: break; case HITGROUP_HEAD: flDamage *= 3; break; case HITGROUP_CHEST: case HITGROUP_STOMACH: flDamage *= 1.5; break; case HITGROUP_LEFTARM: case HITGROUP_RIGHTARM: flDamage *= 1.0; break; case HITGROUP_LEFTLEG: case HITGROUP_RIGHTLEG: flDamage *= 0.75; break; case HITGROUP_SHIELD: flDamage = 0; break; default: break; } AddMultiDamage(pevAttacker, this, flDamage, bitsDamageType); int blood = BloodColor(); if (blood != DONT_BLEED) { // a little surface blood. SpawnBlood(vecOrigin, blood, flDamage); } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CUnitBase::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ) { Vector vecOrigin = ptr->endpos - vecDir * 4; if ( m_takedamage ) { AddMultiDamage( info, this ); // Must always be called from the client to save data #ifdef CLIENT_DLL int blood = BloodColor(); if ( blood != DONT_BLEED ) { SpawnBlood( vecOrigin, vecDir, blood, info.GetDamage() );// a little surface blood. TraceBleed( info.GetDamage(), vecDir, ptr, info.GetDamageType() ); } #endif // CLIENT_DLL } }
void CBaseTurret :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { if ( ptr->iHitgroup == 10 ) { // hit armor if ( pev->dmgtime != gpGlobals->time || (RANDOM_LONG(0,10) < 1) ) { UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 1, 2) ); pev->dmgtime = gpGlobals->time; } flDamage = 0.1;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated } if ( !pev->takedamage ) return; AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); }
void CBaseTurret::TraceAttack( const CTakeDamageInfo &inputInfo, const Vector &vecDir, trace_t *ptr ) { CTakeDamageInfo info = inputInfo; if ( ptr->hitgroup == 10 ) { // hit armor if ( m_flDamageTime != gpGlobals->curtime || (random->RandomInt(0,10) < 1) ) { g_pEffects->Ricochet( ptr->endpos, (vecDir*-1.0f) ); m_flDamageTime = gpGlobals->curtime; } info.SetDamage( 0.1 );// don't hurt the NPC much, but allow bits_COND_LIGHT_DAMAGE to be generated } if ( !m_takedamage ) return; AddMultiDamage( info, this ); }
//========================================================= // TraceAttack - being attacked //========================================================= void CNPC_BaseTurret::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ) { CTakeDamageInfo ainfo = info; if ( ptr->hitgroup == 10 ) { // hit armor if ( m_flDamageTime != gpGlobals->curtime || (random->RandomInt(0,10) < 1) ) { g_pEffects->Ricochet( ptr->endpos, ptr->plane.normal ); m_flDamageTime = gpGlobals->curtime; } ainfo.SetDamage( 0.1 );// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated } if ( m_takedamage == DAMAGE_NO ) return; //DevMsg( 1, "traceattack: %f\n", ainfo.GetDamage() ); AddMultiDamage( info, this ); }
//========================================================= // TraceAttack //========================================================= void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { if ( pev->takedamage ) { m_LastHitGroup = ptr->iHitgroup; switch ( ptr->iHitgroup ) { case HITGROUP_GENERIC: break; case HITGROUP_HEAD: flDamage *= gSkillData.monHead; break; case HITGROUP_CHEST: flDamage *= gSkillData.monChest; break; case HITGROUP_STOMACH: flDamage *= gSkillData.monStomach; break; case HITGROUP_LEFTARM: case HITGROUP_RIGHTARM: flDamage *= gSkillData.monArm; break; case HITGROUP_LEFTLEG: case HITGROUP_RIGHTLEG: flDamage *= gSkillData.monLeg; break; default: break; } SpawnBlood(ptr->vecEndPos, BloodColor(), flDamage);// a little surface blood. TraceBleed( flDamage, vecDir, ptr, bitsDamageType ); AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); } }
// 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 ); }
void EXT_FUNC AddMultiDamage_api(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) { AddMultiDamage(pevInflictor, pEntity, flDamage, bitsDamageType); }
void CGMan::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { UTIL_Ricochet( ptr->vecEndPos, 1.0 ); AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); }
static int luasrc_AddMultiDamage (lua_State *L) { AddMultiDamage(luaL_checkdamageinfo(L, 1), luaL_checkentity(L, 2)); return 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 }