9 [
Attribute(defvalue:
"", uiwidget: UIWidgets.EditBox,
desc:
"Don't use, it's here for backwards compatibility, not guaranteed to work in all classes",
params:
"bt")]
10 string m_OverrideBehaviorTree;
15 void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message) {}
16 void PerformReaction(notnull SCR_AIGroupUtilityComponent utility,
SCR_AIMessageBase message) {}
27 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
33 utility.m_CombatComponent.UpdateLastSeenPosition(msg.m_TargetInfo.m_Entity, msg.m_TargetInfo);
34 utility.m_CombatComponent.SetAssignedTargets({msg.m_TargetInfo.m_Entity},
null);
42 const float INVESTIGATION_DURATION_S = 120.0;
44 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
51 if (!msg.m_TargetClusterState || !msg.m_TargetClusterState.m_Cluster)
55 utility.m_CombatComponent.SetAssignedTargets(
null, msg.m_TargetClusterState);
61 if (msg.m_bAllowInvestigate)
63 bool targetIdentified =
false;
64 foreach (IEntity targetEntity : msg.m_TargetClusterState.m_Cluster.m_aEntities)
66 if (utility.m_PerceptionComponent.GetTargetPerceptionObject(targetEntity,
ETargetCategory.ENEMY))
68 targetIdentified =
true;
76 if (!targetIdentified && msg.m_bAllowInvestigate)
81 vector investigatePos;
82 float investigateRadius;
86 investigatePos, radius: investigateRadius,
87 priorityLevel: msg.m_fPriorityLevel, isDangerous:
true,
88 duration: INVESTIGATION_DURATION_S);
89 utility.AddAction(investigateBehavior);
96 if (!commsHandler.CanBypass())
99 commsHandler.AddRequest(rq);
114 utility.m_CombatComponent.ResetAssignedTargets();
126 if (!commsHandler.CanBypass())
129 commsHandler.AddRequest(rq);
144 msg.m_MovePosition,
SCR_AIActionBase.PRIORITY_BEHAVIOR_MOVE_INDIVIDUALLY, msg.m_fPriorityLevel, msg.m_FollowEntity);
145 if (m_OverrideBehaviorTree !=
string.Empty)
146 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
148 utility.WrapBehaviorOutsideOfVehicle(behavior);
149 utility.AddAction(behavior);
158 auto activity =
new SCR_AIMoveActivity(utility, msg.m_RelatedWaypoint, msg.m_MovePosition,
159 msg.m_FollowEntity, msg.m_eMovementType, msg.m_bUseVehicles,
SCR_AIActionBase.PRIORITY_ACTIVITY_MOVE, priorityLevel: msg.m_fPriorityLevel);
162 utility.AddAction(activity);
169 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
177 utility.AddAction(behavior);
180 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility,
SCR_AIMessageBase message)
187 auto activity =
new SCR_AIFollowActivity(utility, msg.m_RelatedWaypoint, vector.Zero, msg.m_FollowEntity,
188 msg.m_eMovementType,
false,
SCR_AIActionBase.PRIORITY_ACTIVITY_FOLLOW, priorityLevel: msg.m_fPriorityLevel,
distance: msg.m_fDistance);
190 utility.AddAction(activity);
197 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
207 SCR_AIActionBase.PRIORITY_BEHAVIOR_MOVE_AND_INVESTIGATE, msg.m_fPriorityLevel, isDangerous: msg.m_bIsDangerous, radius: msg.m_fRadius, targetUnitType: msg.m_eTargetUnitType, duration: msg.m_fDuration);
208 utility.AddAction(behavior);
215 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
220 SCR_AIActionBase.PRIORITY_BEHAVIOR_MOVE_IN_FORMATION, msg.m_fPriorityLevel);
222 utility.AddAction(behavior);
229 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
235 auto behavior =
new SCR_AIGetInVehicle(utility, msg.m_RelatedGroupActivity, msg.m_Vehicle, msg.m_eRoleInVehicle,
SCR_AIActionBase.PRIORITY_BEHAVIOR_VEHICLE, msg.m_fPriorityLevel);
236 if (m_OverrideBehaviorTree !=
string.Empty)
237 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
239 utility.AddAction(behavior);
242 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility,
SCR_AIMessageBase message)
248 auto activity =
new SCR_AIGetInActivity(utility, msg.m_RelatedWaypoint, msg.m_Vehicle, msg.m_eRoleInVehicle, priorityLevel: msg.m_fPriorityLevel);
249 utility.AddAction(activity);
256 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
262 auto behavior =
new SCR_AIGetOutVehicle(utility, msg.m_RelatedGroupActivity, msg.m_Vehicle,
SCR_AIActionBase.PRIORITY_BEHAVIOR_GET_OUT_VEHICLE, priorityLevel: msg.m_fPriorityLevel);
263 if (m_OverrideBehaviorTree !=
string.Empty)
264 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
266 utility.AddAction(behavior);
269 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility,
SCR_AIMessageBase message)
275 auto activity =
new SCR_AIGetOutActivity(utility, msg.m_RelatedWaypoint, msg.m_Vehicle, priorityLevel: msg.m_fPriorityLevel);
276 utility.AddAction(activity);
283 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility,
SCR_AIMessageBase message)
289 auto activity =
new SCR_AISeekAndDestroyActivity(utility, msg.m_RelatedWaypoint, msg.m_MovePosition, ent: msg.m_FollowEntity, useVehicles: msg.m_bUseVehicles, priorityLevel: msg.m_fPriorityLevel);
292 utility.AddAction(activity);
299 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
305 auto behavior =
new SCR_AIMedicHealBehavior(utility, msg.m_RelatedGroupActivity, msg.m_EntityToHeal,
false, priorityLevel: msg.m_fPriorityLevel);
306 if (m_OverrideBehaviorTree !=
string.Empty)
307 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
309 utility.WrapBehaviorOutsideOfVehicle(behavior);
310 utility.AddAction(behavior);
313 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility,
SCR_AIMessageBase message)
323 float priorityLevelClamped = currentAction.GetRestrictedPriorityLevel(msg.m_fPriorityLevel);
331 if (healActivity.m_EntityToHeal.m_Value == msg.m_EntityToHeal)
333 healActivity.SetPriorityLevel(priorityLevelClamped);
337 auto activity =
new SCR_AIHealActivity(utility, msg.m_RelatedWaypoint, msg.m_EntityToHeal, priorityLevel: priorityLevelClamped);
339 utility.AddAction(activity);
346 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
352 auto behavior =
new SCR_AIHealWaitBehavior(utility, msg.m_RelatedGroupActivity, msg.m_HealProvider, msg.m_fPriorityLevel);
354 utility.AddAction(behavior);
361 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
367 auto behavior =
new SCR_AIDefendBehavior(utility, msg.m_RelatedGroupActivity, msg.m_RelatedWaypoint,
368 msg.m_vDefendLocation, msg.m_fDefendAngularRange, priorityLevel: msg.m_fPriorityLevel);
369 if (m_OverrideBehaviorTree !=
string.Empty)
370 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
372 utility.AddAction(behavior);
375 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility,
SCR_AIMessageBase message)
381 auto activity =
new SCR_AIDefendActivity(utility, msg.m_RelatedWaypoint, msg.m_RelatedWaypoint, msg.m_vDefendLocation,
382 priorityLevel: msg.m_fPriorityLevel);
383 if (m_OverrideBehaviorTree !=
string.Empty)
384 activity.m_sBehaviorTree = m_OverrideBehaviorTree;
386 utility.AddAction(activity);
393 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
399 auto behavior =
new SCR_AIPerformActionBehavior(utility, msg.m_RelatedGroupActivity, msg.m_SmartActionComponent, priorityLevel: msg.m_fPriorityLevel);
400 if (m_OverrideBehaviorTree !=
string.Empty)
401 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
403 utility.AddAction(behavior);
406 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility,
SCR_AIMessageBase message)
412 auto activity =
new SCR_AIPerformActionActivity(utility, msg.m_RelatedWaypoint, msg.m_SmartActionEntity, msg.m_SmartActionTag, priorityLevel: msg.m_fPriorityLevel);
413 if (m_OverrideBehaviorTree !=
string.Empty)
414 activity.m_sBehaviorTree = m_OverrideBehaviorTree;
416 utility.AddAction(activity);
423 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
426 if (!msg || !msg.m_RelatedGroupActivity)
429 utility.SetStateOfRelatedAction(msg.m_RelatedGroupActivity,
EAIActionState.FAILED);
441 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
448 utility.AddAction(behavior);
455 override void PerformReaction(notnull SCR_AIUtilityComponent utility,
SCR_AIMessageBase message)
462 msg.m_AmmoConsumer, msg.m_MagazineWell, msg.m_fPriorityLevel);
464 utility.AddAction(behavior);
478 msg.m_vPickupPosition, msg.m_MagazineWellType, msg.m_fPriorityLevel);
480 utility.AddAction(behavior);
487 static void UpdateLastSeenPosition2(
BaseTarget baseTarget, SCR_AITargetInfo newTargetInfo)
489 if (baseTarget && baseTarget.GetTargetEntity() == newTargetInfo.m_Entity)
490 baseTarget.UpdateLastSeenPosition(newTargetInfo.m_vWorldPos, newTargetInfo.m_fTimestamp);