7 ref SCR_BTParamRef<SCR_AISuppressionVolumeBase> m_SuppressionVolume =
new SCR_BTParamRef<SCR_AISuppressionVolumeBase>(
"SuppressionVolume");
8 ref SCR_BTParam<float> m_fSuppressionDuration_s =
new SCR_BTParam<float>(
"SuppressionDuration_s");
9 ref SCR_BTParam<float> m_fFireRate =
new SCR_BTParam<float>(
"FireRate");
14 m_SuppressionVolume.Init(
this, suppressionVolume);
15 m_fSuppressionDuration_s.Init(
this, suppressionDuration);
16 m_fFireRate.Init(
this, fireRate);
18 SetPriority(PRIORITY_BEHAVIOR_SUPPRESS);
20 m_sBehaviorTree =
"{447C5FFBE68FF9FE}AI/BehaviorTrees/Chimera/Soldier/SuppressBehavior.bt";
31 super.OnActionSelected();
32 EnableFriendlyFireCheck(
true);
38 super.OnActionDeselected();
39 EnableFriendlyFireCheck(
false);
43 void EnableFriendlyFireCheck(
bool enable)
46 m_Utility.m_PerceptionComponent.SetFriendlyFireCheck(enable);
79 protected ref SCR_AISuppressionVolumeClusterBox
m_Volume;
93 m_SuppressionVolume.m_Value =
m_Volume;
97 Print(
"SCR_AISuppressGroupClusterBehavior failed, no cluster state provided",
LogLevel.ERROR);
113 return vector.Distance(
m_Utility.m_OwnerEntity.GetOrigin(), clusterState.GetCenterPosition());
117 protected float GetFireRate(
float distance,
float timeSinceLastInfoS,
float soldierThreat,
float groupThreat,
float peakReactionFactor)
119 float midDist = SCR_AICombatComponent.CLOSE_RANGE_COMBAT_DISTANCE + SCR_AICombatComponent.LONG_RANGE_COMBAT_DISTANCE / 2;
123 float groupThreatFactor = 1 - soldierThreatFactor;
126 float fireRate = 1.75 * (soldierThreat * soldierThreatFactor + groupThreat * groupThreatFactor);
129 if (peakReactionFactor > 0)
131 float peakFireRate = fireRate * 1.2 * peakReactionFactor;
132 fireRate +=
Math.Max(0,
Math.AbsFloat(fireRate - peakFireRate));
144 return Math.Clamp(fireRate, 0.05, 2);
151 AIGroup group =
m_Agent.GetParentGroup();
171 float time =
GetGame().GetWorld().GetWorldTime();
185 float peakReactionFactor = 0;
193 float diff =
Math.AbsFloat(peakTime - timeSincePeak);
194 peakReactionFactor =
Math.Map(diff, 0, peakTime, 1, 0);
235 float timeSinceLastInfo =
m_ClusterState.GetTimeSinceLastNewInformation();
238 m_fFireRate.m_Value = fireRate;
242 return PRIORITY_BEHAVIOR_SUPPRESS;
ArmaReforgerScripted GetGame()
ref SCR_BTParam< float > m_fPriorityLevel
enum EAIActionFailReason PRIORITY_LEVEL_NORMAL
override void OnActionDeselected()
ResourceName m_sBehaviorTree
override void OnActionSelected()
void Fail(bool doNotCompleteWaypoint)
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
enum SCR_EAIActivityCause m_Utility
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
void SCR_AITargetClusterState(SCR_AIGroupTargetCluster cluster)
float GetFireRate()
Get rate of fire (dps). If it is below fire damage threshold, no damage will be dealt.
const float THREAT_POTENTIAL_DECAY
SCR_ChimeraAIAgent m_Agent
SCR_AICombatComponent m_CombatComponent
const int VOLUME_UPDATE_INTERVAL_MS
float m_fGroupThreatPeakTimeout
SCR_AITargetClusterState m_ClusterState
const float THREAT_MAX_INCREASE
ref SCR_AISuppressionVolumeClusterBox m_Volume
SCR_AIThreatSystem m_ThreatSystem
bool m_bGroupThreatInPeak
float m_fGroupThreatPotential
const float THREAT_MAX_DECREASE
float m_fGroupThreatPeakReactionTimeout
const int THREAT_MAX_PEAK_REACTION_DURATION_MS
float GetDistance(notnull SCR_AITargetClusterState clusterState)
override float CustomEvaluate()
const float FIRE_RATE_SCALING_MAX_DISTANCE
float GetFireRate(float distance, float timeSinceLastInfoS, float soldierThreat, float groupThreat, float peakReactionFactor)
void SCR_AISuppressGroupClusterBehavior(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, SCR_AISuppressionVolumeBase suppressionVolume, float suppressionDuration, float fireRate, float priorityLevel=PRIORITY_LEVEL_NORMAL, SCR_AITargetClusterState clusterState=null)
SCR_AITargetClusterState GetClusterState()
const int THREAT_MAX_PEAK_DURATION_MS
float m_fGroupThreatPeakDuration
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.