/* ================ rvMonsterFailedTransfer::Killed ================ */ void rvMonsterFailedTransfer::Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ) { if ( !idStr::Icmp ( GetDamageGroup( location ), "legs" ) && damage < 999 ) { allowSplit = true; } else { allowSplit = false; } idAI::Killed ( inflictor, attacker, damage, dir, location ); }
/* ===================== idActor::Pain ===================== */ bool idActor::Pain( idEntity *inflictor, idEntity *attacker, int damage, const noVec3 &dir, int location ) { if ( af.IsLoaded() ) { // clear impacts af.Rest(); // physics is turned off by calling af.Rest() BecomeActive( TH_PHYSICS ); } if ( gameLocal.time < pain_debounce_time ) { return false; } // don't play pain sounds more than necessary pain_debounce_time = gameLocal.time + pain_delay; if ( health > 75 ) { //StartSound( "snd_pain_small", SND_CHANNEL_VOICE, 0, false, NULL ); } else if ( health > 50 ) { //StartSound( "snd_pain_medium", SND_CHANNEL_VOICE, 0, false, NULL ); } else if ( health > 25 ) { //StartSound( "snd_pain_large", SND_CHANNEL_VOICE, 0, false, NULL ); } else { //StartSound( "snd_pain_huge", SND_CHANNEL_VOICE, 0, false, NULL ); } if ( !allowPain || ( gameLocal.time < painTime ) ) { // don't play a pain anim return false; } if ( pain_threshold && ( damage < pain_threshold ) ) { return false; } // set the pain anim idStr damageGroup = GetDamageGroup( location ); painAnim = ""; if ( animPrefix.Length() ) { if ( damageGroup.Length() && ( damageGroup != "legs" ) ) { sprintf( painAnim, "%s_pain_%s", animPrefix.c_str(), damageGroup.c_str() ); if ( !animator.HasAnim( painAnim ) ) { sprintf( painAnim, "pain_%s", damageGroup.c_str() ); if ( !animator.HasAnim( painAnim ) ) { painAnim = ""; } } } if ( !painAnim.Length() ) { sprintf( painAnim, "%s_pain", animPrefix.c_str() ); if ( !animator.HasAnim( painAnim ) ) { painAnim = ""; } } } else if ( damageGroup.Length() && ( damageGroup != "legs" ) ) { sprintf( painAnim, "pain_%s", damageGroup.c_str() ); if ( !animator.HasAnim( painAnim ) ) { sprintf( painAnim, "pain_%s", damageGroup.c_str() ); if ( !animator.HasAnim( painAnim ) ) { painAnim = ""; } } } if ( !painAnim.Length() ) { painAnim = "pain"; } /*if ( g_debugDamage.GetBool() ) { gameLocal.Printf( "Damage: joint: '%s', zone '%s', anim '%s'\n", animator.GetJointName( ( jointHandle_t )location ), damageGroup.c_str(), painAnim.c_str() ); }*/ return true; }