add new fixes:crowbar and new CheckButton

This commit is contained in:
IOleg-sus 2025-01-19 16:10:39 +02:00
parent ad58f94edc
commit 8fba5a9979
7 changed files with 43 additions and 24 deletions

View File

@ -367,7 +367,19 @@ int CNPC_Barney::OnTakeDamage_Alive( const CTakeDamageInfo &inputInfo )
{
Speak( BA_SHOT );
}
}
if (gpGlobals->curtime >= m_flPainTime)
{
m_flPainTime = gpGlobals->curtime + random->RandomFloat(0.5, 0.75);
CPASAttenuationFilter filter(this);
EmitSound(filter, entindex(), "Barney.Pain");
}
return ret;
}

View File

@ -12,6 +12,7 @@
// $NoKeywords: $
//=============================================================================//
#include "ai_condition.h"
#include "cbase.h"
#include "beam_shared.h"
#include "ai_default.h"
@ -236,7 +237,7 @@ void CNPC_HGrunt::Spawn()
m_bloodColor = BLOOD_COLOR_RED;
ClearEffects();
m_iHealth = sk_hgrunt_health.GetFloat();
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_flFieldOfView = 0.4;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_NPCState = NPC_STATE_NONE;
m_flNextGrenadeCheck = gpGlobals->curtime + 1;
m_flNextPainTime = gpGlobals->curtime;
@ -445,9 +446,7 @@ void CNPC_HGrunt::PrescheduleThink ( void )
if ( gpGlobals->curtime - pSquadLeader->m_flLastEnemySightTime > 5.0f )
{
// been a while since we've seen the enemy
if(GetEnemy() != NULL && GetEnemies() != NULL){
pSquadLeader->GetEnemies()->MarkAsEluded( GetEnemy() );
}
pSquadLeader->GetEnemies()->MarkAsEluded( GetEnemy() );
}
}
@ -644,6 +643,10 @@ int CNPC_HGrunt::RangeAttack1Conditions ( float flDot, float flDist )
// kick nonclients, but don't shoot at them.
return COND_NONE;
}
if (GetEnemy())
{
return COND_CAN_RANGE_ATTACK1;
}
Vector vecSrc;
QAngle angAngles;
@ -788,7 +791,7 @@ int CNPC_HGrunt::GetGrenadeConditions( float flDot, float flDist )
m_vecTossVelocity = vecToss;
// don't check again for a while.
m_flNextGrenadeCheck = gpGlobals->curtime + 0.3; // 1/3 second.
m_flNextGrenadeCheck = gpGlobals->curtime + 0.1; // 1/3 second.
return COND_CAN_RANGE_ATTACK2;
}

View File

@ -936,13 +936,13 @@ void CNPC_Tentacle::HitTouch( CBaseEntity *pOther )
//as the ragdoll only covers the top portion of the tentacle.
if ( pOther->m_takedamage )
{
CTakeDamageInfo info( this, this, m_iHitDmg, DMG_CLUB );
CTakeDamageInfo info( this, this, m_iHitDmg, DMG_CLUB | DMG_ALWAYSGIB );
Vector vDamageForce = pOther->GetAbsOrigin() - GetAbsOrigin();
VectorNormalize( vDamageForce );
CalculateMeleeDamageForce( &info, vDamageForce, pOther->GetAbsOrigin() );
pOther->TakeDamage( info );
CalculateMeleeDamageForce( &info, vDamageForce, pOther->GetAbsOrigin());
m_flHitTime = gpGlobals->curtime + 0.5;
}

View File

@ -7,6 +7,7 @@
#include "cbase.h"
#include "hl1mp_basecombatweapon_shared.h"
#include "weapon_parse.h"
#ifdef CLIENT_DLL
#include "c_baseplayer.h"
@ -22,6 +23,7 @@
#include "mathlib/mathlib.h"
#include "in_buttons.h"
#include "vstdlib/random.h"
extern ConVar sk_plr_dmg_crowbar;
@ -45,7 +47,7 @@ class CWeaponCrowbar : public CBaseHL1MPCombatWeapon
public:
DECLARE_NETWORKCLASS();
DECLARE_PREDICTABLE();
#ifndef CLIENT_DLLhl1_crowbar_tile_vol
#ifndef CLIENT_DLL
DECLARE_DATADESC();
#endif
@ -63,7 +65,7 @@ private:
virtual void Swing( void );
virtual void Hit( void );
virtual void ImpactEffect( void );
void ImpactSound( CBaseEntity *pHitEntity , trace_t &hitTrace );
void ImpactSound( bool isWorld , trace_t &hitTrace , CBaseEntity *pHitEntity);
virtual Activity ChooseIntersectionPointAndActivity( trace_t &hitTrace, const Vector &mins, const Vector &maxs, CBasePlayer *pOwner );
public:
@ -95,7 +97,7 @@ BEGIN_DATADESC( CWeaponCrowbar )
// Function Pointers
DEFINE_FUNCTION( Hit ),
END_DATADESC()
#endif
@ -184,8 +186,9 @@ void CWeaponCrowbar::Hit( void )
TraceAttackToTriggers( CTakeDamageInfo( GetOwner(), GetOwner(), sk_plr_dmg_crowbar.GetFloat(), DMG_CLUB ), m_traceHit.startpos, m_traceHit.endpos, hitDirection );
//Play an impact sound
ImpactSound( pHitEntity , m_traceHit );
ImpactSound( pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE, m_traceHit , pHitEntity );
}
#endif
//Apply an impact effect
@ -197,31 +200,31 @@ void CWeaponCrowbar::Hit( void )
// Input : pHitEntity - entity that we hit
// assumes pHitEntity is not null
//-----------------------------------------------------------------------------
void CWeaponCrowbar::ImpactSound( CBaseEntity *pHitEntity , trace_t &hitTrace )
void CWeaponCrowbar::ImpactSound( bool isWorld , trace_t &hitTrace , CBaseEntity *pHitEntity )
{
bool bIsWorld = ( pHitEntity->entindex() == 0 );
bool IsWorld = ( pHitEntity->entindex() );
#ifndef CLIENT_DLL
if ( !bIsWorld )
if ( !isWorld )
{
bIsWorld |= pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE;
isWorld |= pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE;
}
#endif
if (bIsWorld)
if( isWorld )
{
switch (random->RandomInt(0, 1))
{
case 0:
UTIL_EmitAmbientSound(GetOwner()->entindex(), GetOwner()->GetAbsOrigin(), "weapons/cbar_hit1.wav", 0.5, SNDLVL_GUNFIRE, 0, 98 + random->RandomInt(0, 3));
WeaponSound( MELEE_HIT_WORLD );
break;
case 1:
UTIL_EmitAmbientSound(GetOwner()->entindex(), GetOwner()->GetAbsOrigin(), "weapons/cbar_hit2.wav", 0.5, SNDLVL_GUNFIRE, 0, 98 + random->RandomInt(0, 3));
break;
WeaponSound( MELEE_HIT );
break;
}
}
else
else
{
WeaponSound(MELEE_HIT);
WeaponSound( MELEE_MISS );
}
}

View File

@ -67,6 +67,7 @@ void COptionsSubDifficulty::OnApplyChanges()
{
var.SetValue( 2 );
}
}

View File

@ -133,4 +133,4 @@ void COptionsSubModification::OnCommand(const char *command)
{
BaseClass::OnCommand(command); // Make sure to call the base class for any other commands
}
}
}

View File

@ -62,4 +62,4 @@ private:
CCvarSlider *m_pAspectRatioSlider;
};
#endif // OPTIONS_SUB_MODIFICATION_H
#endif // OPTIONS_SUB_MODIFICATION_H