3 const string GROUP_MEMBERS_EXCLUDE_PORT =
"AgentsExclude";
4 const string MEDIC_PORT =
"MedicEntity";
6 const int TIMEOUT_FAILED = 5*60*1000;
8 ref SCR_BTParam<IEntity> m_EntityToHeal =
new SCR_BTParam<IEntity>(
SCR_AIActionTask.ENTITY_PORT);
11 ref SCR_BTParam<IEntity> m_MedicEntity =
new SCR_BTParam<IEntity>(MEDIC_PORT);
14 ref array<AIAgent> m_aMedicsExclude = {};
15 ref SCR_BTParam<array<AIAgent>> m_aMedicsExcludeParam =
new SCR_BTParam<array<AIAgent>>(GROUP_MEMBERS_EXCLUDE_PORT);
17 protected float m_fTimeCreated_world;
19 protected float m_fTimeCheckConditions_world;
22 static ref array<ref SCR_AIActivityFeatureBase> s_ActivityFeatures = {
new SCR_AIHealActivitySmokeCoverFeature()};
23 override array<ref SCR_AIActivityFeatureBase> GetActivityFeatures() {
return s_ActivityFeatures; }
25 override float CustomEvaluate()
27 float worldTime =
GetGame().GetWorld().GetWorldTime();
29 if (worldTime - m_fTimeCheckConditions_world > 2500)
35 AddDebugMessage(
"Target entity is null or destroyed, action failed.");
52 SetActionIsSuspended(
false);
55 m_fTimeCheckConditions_world = worldTime;
59 if (worldTime - m_fTimeCreated_world > TIMEOUT_FAILED)
62 AddDebugMessage(
"Timeout, action failed.");
74 void InitParameters(IEntity entity, array<AIAgent> medicsToExclude,
float priorityLevel)
77 m_EntityToHeal.Init(
this, entity);
78 m_aMedicsExcludeParam.Init(
this, medicsToExclude);
80 m_MedicEntity.Init(
this, medic);
84 void SCR_AIHealActivity(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint, IEntity ent,
float priority = PRIORITY_ACTIVITY_HEAL,
float priorityLevel = PRIORITY_LEVEL_NORMAL)
86 m_sBehaviorTree =
"AI/BehaviorTrees/Chimera/Group/ActivityHeal.bt";
87 SetPriority(priority);
88 InitParameters(ent, m_aMedicsExclude, priorityLevel);
89 SetIsUniqueInActionQueue(
false);
94 m_fTimeCreated_world = game.GetWorld().GetWorldTime();
98 override string GetActionDebugInfo()
100 return this.ToString() +
" healing unit " + m_EntityToHeal.ValueToString();
103 override bool OnMessage(AIMessage msg)
110 if (healFailed.m_TargetEntity != m_EntityToHeal.m_Value)
114 m_aMedicsExclude.Insert(healFailed.GetSender());
117 AddDebugMessage(
string.Format(
"Medic %1 has failed the action. MedicsExclude: %2", healFailed.GetSender(), m_aMedicsExclude));
121 SetActionIsSuspended(
false);
131 static ref TStringArray s_aVarsOut = (
new SCR_AIHealActivity(
null,
null,
null)).GetPortNames();
132 override TStringArray GetVariablesOut() {
return s_aVarsOut; }
134 override bool VisibleInPalette() {
return true; }
139 protected static ref TStringArray s_aVarsIn = (
new SCR_AIHealActivity(
null,
null,
null)).GetPortNames();
140 override TStringArray GetVariablesIn() {
return s_aVarsIn; }
141 override bool VisibleInPalette() {
return true; }