mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-26 15:48:43 +00:00
Added entity heal capabilities/
This was SVN commit r3127.
This commit is contained in:
@@ -49,6 +49,9 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation )
|
||||
AddProperty( L"actions.gather.range", &( m_gather.m_MaxRange ) );
|
||||
AddProperty( L"actions.gather.rangemin", &( m_gather.m_MinRange ) );
|
||||
AddProperty( L"actions.gather.speed", &( m_gather.m_Speed ) );
|
||||
AddProperty( L"actions.heal.range", &( m_heal.m_MaxRange ) );
|
||||
AddProperty( L"actions.heal.rangemin", &( m_heal.m_MinRange ) );
|
||||
AddProperty( L"actions.heal.speed", &( m_hea;.m_Speed ) );
|
||||
AddProperty( L"position", &m_graphics_position, false, (NotifyFn)&CEntity::teleport );
|
||||
AddProperty( L"orientation", &m_graphics_orientation, false, (NotifyFn)&CEntity::reorient );
|
||||
AddProperty( L"player", &m_player );
|
||||
@@ -328,6 +331,12 @@ void CEntity::update( size_t timestep )
|
||||
case CEntityOrder::ORDER_GATHER_NOPATHING:
|
||||
if( processGatherNoPathing( current, timestep ) ) break;
|
||||
return;
|
||||
case CEntityOrder::ORDER_HEAL:
|
||||
if( processHeal( current, timestep ) ) break;
|
||||
return;
|
||||
case CEntityOrder::ORDER_HEAL_NOTPATHING:
|
||||
if( processHealNoPathing( current, timestamp ) ) break;
|
||||
return;
|
||||
case CEntityOrder::ORDER_GOTO:
|
||||
if( processGoto( current, timestep ) ) break;
|
||||
return;
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
float m_turningRadius;
|
||||
SEntityAction m_melee;
|
||||
SEntityAction m_gather;
|
||||
SEntityAction m_heal;
|
||||
bool m_selected;
|
||||
i32 m_grouped;
|
||||
|
||||
@@ -148,6 +149,8 @@ private:
|
||||
bool processAttackMeleeNoPathing( CEntityOrder* current, size_t timestep_milli );
|
||||
bool processGather( CEntityOrder* current, size_t timestep_milli );
|
||||
bool processGatherNoPathing( CEntityOrder* current, size_t timestep_milli );
|
||||
bool processHeal( CEntityOrder* current, size_t timestep_milli );
|
||||
bool processHealNoPathing( CEntityOrder* current, size_t timestep_milli );
|
||||
|
||||
bool processGotoNoPathing( CEntityOrder* current, size_t timestep_milli );
|
||||
bool processGoto( CEntityOrder* current, size_t timestep_milli );
|
||||
|
||||
@@ -60,6 +60,8 @@ public:
|
||||
ORDER_ATTACK_MELEE_NOPATHING,
|
||||
ORDER_GATHER,
|
||||
ORDER_GATHER_NOPATHING,
|
||||
ORDER_HEAL,
|
||||
ORDER_HEAL_NOTPATHING,
|
||||
ORDER_PATH_END_MARKER,
|
||||
ORDER_LAST
|
||||
} m_type;
|
||||
|
||||
@@ -505,7 +505,16 @@ bool CEntity::processGatherNoPathing( CEntityOrder* current, size_t timestep_mil
|
||||
if( !m_actor ) return( false );
|
||||
return( processContactActionNoPathing( current, timestep_millis, "gather", &evt, &m_gather ) );
|
||||
}
|
||||
|
||||
bool CEntity::processHeal( CEntityOrder* current, size_t timestep_millis )
|
||||
{
|
||||
return( processContactAction( current, timestep_millis, CEntityOrder::ORDER_HEAL_NOPATHING, &m_heal ) );
|
||||
}
|
||||
bool CEntity::processHealNoPathing( CEntityOrder* current, size_t timestep_millis )
|
||||
{
|
||||
CEventHeal evt( current->m_data[0].entity );
|
||||
if( !m_actor ) return( false );
|
||||
return( processContactActionNoPathing( current, timestep_millis, "heal", &evt, &m_heal ) );
|
||||
}
|
||||
bool CEntity::processGoto( CEntityOrder* current, size_t UNUSED(timestep_millis) )
|
||||
{
|
||||
// float timestep=timestep_millis/1000.0f;
|
||||
|
||||
@@ -7,7 +7,11 @@ CEventAttack::CEventAttack( CEntity* target ) : CScriptEvent( L"attack", EVENT_A
|
||||
m_target = target;
|
||||
AddLocalProperty( L"target", &m_target );
|
||||
}
|
||||
|
||||
CEventHeal::CEventHeal( CEntity* target ) : CScriptEvent( L"heal", EVENT_HEAL, true)
|
||||
{
|
||||
m_target=target;
|
||||
AddLocalProperty( L"target", &target );
|
||||
}
|
||||
CEventGather::CEventGather( CEntity* target ) : CScriptEvent( L"gather", EVENT_GATHER, true )
|
||||
{
|
||||
m_target = target;
|
||||
|
||||
@@ -35,7 +35,12 @@ class CEventGather : public CScriptEvent
|
||||
public:
|
||||
CEventGather( CEntity* target );
|
||||
};
|
||||
|
||||
class CEventHeal : public CScriptEvent
|
||||
{
|
||||
CEntity* m_target;
|
||||
public:
|
||||
CEventHeal( CEntity* target );
|
||||
}
|
||||
class CEventDamage : public CScriptEvent
|
||||
{
|
||||
CEntity* m_inflictor;
|
||||
|
||||
Reference in New Issue
Block a user