50 m_UtilityComponent = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
53 IEntity myEntity = owner.GetControlledEntity();
108 int selectedMuzzleId;
136 int fireTreeId =
ResolveFireTree(target, visible, weaponReady, fireRate);
163 if (executedBehavior && executedBehavior.m_bUseCombatMove && !
m_UtilityComponent.m_CombatMoveState.m_bAimAtTarget)
175 int selectedMuzzleId;
179 float weaponMinDist, weaponMaxDist;
180 m_CombatComponent.GetSelectedWeaponProperties(weaponMinDist, weaponMaxDist, directDamage);
182 if (!selectedWeaponComp)
189 EWeaponType weaponType = selectedWeaponComp.GetWeaponType();
191 float targetDistance = target.GetDistance();
210 if (targetDistance < weaponMinDist || targetDistance > weaponMaxDist)
244 float lastSeenThreshold;
246 lastSeenThreshold = SCR_AICombatComponent.TARGET_MAX_LAST_SEEN_INDIRECT_ATTACK_MG;
249 if (targetDistance < SCR_AICombatComponent.CLOSE_RANGE_COMBAT_DISTANCE)
250 lastSeenThreshold = SCR_AICombatComponent.TARGET_MAX_LAST_SEEN_INDIRECT_ATTACK_CLOSE;
252 lastSeenThreshold = SCR_AICombatComponent.TARGET_MAX_LAST_SEEN_INDIRECT_ATTACK;
255 lastSeenThreshold =
Math.Max(SCR_AICombatComponent.TARGET_MIN_LAST_SEEN_INDIRECT_ATTACK, lastSeenThreshold * threat);
257 if ((!directDamage || weaponType !=
EWeaponType.WT_ROCKETLAUNCHER) &&
258 target.GetTimeSinceSeen() < lastSeenThreshold &&
259 target.GetTraceFraction() > 0.5)
261 float maxFireRate =
Math.Max(1,
Math.Map(targetDistance, 0, SCR_AICombatComponent.LONG_RANGE_COMBAT_DISTANCE, 2, 1));
262 fireRate = maxFireRate * threat;
276 array<BaseMuzzleComponent> muzzles = {};
277 weaponComp.GetMuzzlesList(muzzles);
279 if (!muzzles.IsIndexValid(muzzleId))
286 array<BaseFireMode> fireModes = {};
287 muzzle.GetFireModesList(fireModes);
300 IEntity targetEntity = target.GetTargetEntity();
313 if (character.IsInVehicle())
397 float tgtDist = currentTarget.GetDistance();
398 float baseDuration = -5.3 + 4*
Math.Log10(tgtDist + 21.2);
405 float duration =
Math.RandomFloat(baseDuration, 1.5*baseDuration);
422 vector dirToTarget = (targetPos - myPos).Normalized();
423 vector dirToThreat = (threatPos - myPos).Normalized();
424 float cosAngle =
vector.Dot(dirToTarget, dirToThreat);
SCR_EAIThreatSectorFlags flags
ArmaReforgerScripted GetGame()
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto void SetVariableOut(string name, void val)
proto bool GetVariableIn(string name, out void val)
SCR_EAIThreatSectorFlags GetSectorFlags(int sectorId)
vector GetSectorPos(int sectorId)
WorldTimestamp m_LookAtThreatsEndTime
float CalculateLookAtThreatDuration(BaseTarget currentTarget, SCR_EAIThreatSectorFlags threatFlags)
static const string BASE_TARGET_PORT
int ResolveFireTree(BaseTarget target, bool visible, bool weaponReady, out float fireRate)
CharacterControllerComponent m_CharacterController
void OnThreatSectorEscalation(SCR_AISectorThreatFilter ts, int sectorId, float dangerValue)
static const string PORT_THREAT_POSITION
static const string PORT_LAST_SEEN_POSITION
SCR_AICombatComponent m_CombatComponent
void ResolveAimpointTypes(notnull BaseTarget target, out EAimPointType aimpointType0, out EAimPointType aimpointType1)
override void OnInit(AIAgent owner)
void ~SCR_AIUpdateTargetAttackData()
static const string PORT_AIMPOINT_TYPE_0
override TStringArray GetVariablesOut()
const int FIRE_TREE_SINGLE
void LookAtThreats(float duration_s)
Activates state when we are looking at threats.
const int FIRE_TREE_MELEE
static const string PORT_AIMPOINT_TYPE_1
vector m_vLookAtThreatsPos
void OnThreatSectorDamageTaken(SCR_AISectorThreatFilter ts, int sectorId)
bool PosSameDirectionAsTarget(vector threatPos)
static const string PORT_FIRE_TREE_ID
SCR_AIUtilityComponent m_UtilityComponent
const int FIRE_TREE_INVALID
override TStringArray GetVariablesIn()
ref TStringArray s_aVarsIn
override void OnAbort(AIAgent owner, Node nodeCausingAbort)
static override bool VisibleInPalette()
static override string GetOnHoverDescription()
SCR_ChimeraAIAgent m_Agent
PerceptionComponent m_PerceptionComponent
static bool WeaponHasBurstOrAutoMode(notnull BaseWeaponComponent weaponComp, int muzzleId)
const float MELEE_MAX_DISTANCE
static const string PORT_FIRE_RATE
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
SCR_AISectorThreatFilter m_ThreatFilter
const int FIRE_TREE_SUPPRESSIVE
bool m_bWeaponHasBurstOrAuto
static const string PORT_VISIBLE
ref TStringArray s_aVarsOut
static const string WEAPON_IS_READY
static const float COS_VIEW_CONE
const float BURST_FIRE_MAX_DISTANCE
const int FIRE_TREE_LOOK_THREATS
const int FIRE_TREE_BURST
array< string > TStringArray