Fixes to the melee/ranged attack split.
This was SVN commit r3403.
This commit is contained in:
parent
c03cdd6a23
commit
a0936ede65
@ -45,6 +45,9 @@ CBaseEntity::CBaseEntity()
|
||||
AddProperty( L"traits.anchor.type", &m_anchorType );
|
||||
AddProperty( L"traits.vision.los", &m_los );
|
||||
AddProperty( L"traits.vision.permanent", &m_permanent );
|
||||
AddProperty( L"traits.health.regen_rate", &m_healthRegenRate );
|
||||
AddProperty( L"traits.health.regen_start", &m_healthRegenStart );
|
||||
AddProperty( L"traits.health.decay_rate", &m_healthDecayRate );
|
||||
|
||||
for( int t = 0; t < EVENT_LAST; t++ )
|
||||
{
|
||||
|
@ -69,6 +69,9 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation )
|
||||
AddProperty( L"traits.anchor.type", &m_anchorType );
|
||||
AddProperty( L"traits.vision.los", &m_los );
|
||||
AddProperty( L"traits.vision.permanent", &m_permanent );
|
||||
AddProperty( L"traits.health.regen_rate", &m_healthRegenRate );
|
||||
AddProperty( L"traits.health.regen_start", &m_healthRegenStart );
|
||||
AddProperty( L"traits.health.decay_rate", &m_healthDecayRate );
|
||||
|
||||
for( int t = 0; t < EVENT_LAST; t++ )
|
||||
{
|
||||
|
@ -74,6 +74,10 @@ public:
|
||||
float m_turningRadius;
|
||||
float m_runRegenRate;
|
||||
float m_runDecayRate;
|
||||
|
||||
float m_healthRegenRate;
|
||||
float m_healthRegenStart;
|
||||
float m_healthDecayRate;
|
||||
|
||||
SEntityAction m_run;
|
||||
|
||||
@ -108,9 +112,6 @@ public:
|
||||
float m_healthBarHeight;
|
||||
int m_healthBarSize;
|
||||
|
||||
float m_healthRegenRate;
|
||||
float m_healthRegenStart;
|
||||
float m_healthDecayRate;
|
||||
bool m_healthDecay;
|
||||
|
||||
// Minimap properties
|
||||
|
@ -331,21 +331,7 @@ bool CEntity::processContactAction( CEntityOrder* current, size_t UNUSED(timeste
|
||||
return( false );
|
||||
current->m_data[0].location = current->m_data[0].entity->m_position;
|
||||
float Distance = (current->m_data[0].location - m_position).length();
|
||||
|
||||
//TODO: find a better way than assuming constant action indicators.
|
||||
|
||||
if ( current->m_data[1].data == 1 )
|
||||
{
|
||||
//Are we closer using ranged attack?
|
||||
if ( fabs(Distance - m_actions[4].m_MaxRange) < fabs(Distance - action->m_MaxRange) &&
|
||||
Distance > m_actions[4].m_MinRange && !m_shouldRun && m_actions.find( 4 ) != m_actions.end())
|
||||
{
|
||||
action = &m_actions[4];
|
||||
current->m_data[1].data = 4;
|
||||
}
|
||||
else
|
||||
action = &m_actions[1];
|
||||
}
|
||||
if( Distance < action->m_MaxRange )
|
||||
{
|
||||
(int&)current->m_type = transition;
|
||||
@ -456,20 +442,6 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times
|
||||
CVector2D delta = current->m_data[0].entity->m_position - m_position;
|
||||
float deltaLength = delta.length();
|
||||
|
||||
//TODO: find a better way than assuming constant action indicators.
|
||||
if ( current->m_data[1].data == 1 )
|
||||
{
|
||||
//Are we closer using ranged attack?
|
||||
if ( fabs(deltaLength - m_actions[4].m_MaxRange) < fabs(deltaLength - action->m_MaxRange) &&
|
||||
deltaLength > m_actions[4].m_MinRange && !m_shouldRun && m_actions.find( 4 ) != m_actions.end())
|
||||
{
|
||||
action = &m_actions[4];
|
||||
current->m_data[1].data = 4;
|
||||
}
|
||||
else
|
||||
action = &m_actions[1];
|
||||
}
|
||||
|
||||
float adjRange = action->m_MaxRange + m_bounds->m_radius + current->m_data[0].entity->m_bounds->m_radius;
|
||||
|
||||
if( action->m_MinRange > 0.0f )
|
||||
|
Loading…
Reference in New Issue
Block a user