3     static const string PORT_FIRE_BURST = 
"FireBurstTime";
 
    4     static const string PORT_STABILIZATION = 
"StabilizationTime";
 
    5     static const string PORT_SUPPRESSION = 
"SuppressionTime";
 
    6     static const string PORT_REJECT_TIME = 
"RejectAimingTime";
 
    8     protected static string TARGET_ENTITY_PORT = 
"TargetEntity";
 
    9     protected static string TARGET_POSITION_PORT = 
"TargetPosition";
 
   11     static const float CLOSE_RANGE_THRESHOLD_SQ = 15 * 15;
 
   13     private SCR_AICombatComponent m_CombatComponent;
 
   14     private SCR_AIUtilityComponent m_Utility;
 
   18     override void OnInit(AIAgent owner)
 
   20         IEntity ent = owner.GetControlledEntity();
 
   22             m_CombatComponent = SCR_AICombatComponent.Cast(ent.FindComponent(SCR_AICombatComponent));       
 
   26     protected static ref TStringArray s_aVarsOut = {
 
   32     override array<string> GetVariablesOut()
 
   38     protected static ref TStringArray s_aVarsIn = {TARGET_ENTITY_PORT, TARGET_POSITION_PORT};
 
   39     override TStringArray GetVariablesIn() { 
return s_aVarsIn; }
 
   42     override ENodeResult EOnTaskSimulate(AIAgent owner, 
float dt)
 
   46             return ENodeResult.FAIL;
 
   49         float random = Math.RandomFloat(0.1,0.3); 
 
   52         float distStabilizationTimeFactor = 1;
 
   53         float distBurstTimeFactor = 1;
 
   56         IEntity ownerEntity = owner.GetControlledEntity();
 
   59             return ENodeResult.FAIL;
 
   63         if (GetVariableIn(TARGET_ENTITY_PORT, targetEntity))
 
   64             targetPos = targetEntity.GetOrigin();
 
   66             GetVariableIn(TARGET_POSITION_PORT, targetPos);
 
   68         if (targetPos != vector.Zero)
 
   70             float distToTargetSq = vector.DistanceSq(ownerEntity.GetOrigin(), targetPos);
 
   72             if (distToTargetSq < CLOSE_RANGE_THRESHOLD_SQ)
 
   74                 distStabilizationTimeFactor = Math.Map(distToTargetSq, 0, CLOSE_RANGE_THRESHOLD_SQ, 0, 1);
 
   75                 distBurstTimeFactor = Math.Map(distToTargetSq, 0, CLOSE_RANGE_THRESHOLD_SQ, 0, 1);
 
   83                 SetVariableOut(PORT_FIRE_BURST, random * distBurstTimeFactor);
 
   84                 SetVariableOut(PORT_STABILIZATION, 0.5 * distStabilizationTimeFactor);
 
   85                 SetVariableOut(PORT_SUPPRESSION, 0.5 + random);
 
   86                 SetVariableOut(PORT_REJECT_TIME, 0.5);
 
   91                 SetVariableOut(PORT_FIRE_BURST, random * 2 * distBurstTimeFactor);
 
   92                 SetVariableOut(PORT_STABILIZATION, 0.3 * distStabilizationTimeFactor);
 
   93                 SetVariableOut(PORT_SUPPRESSION, 0.3 + random*2);
 
   94                 SetVariableOut(PORT_REJECT_TIME, 0.5);
 
   99                 ClearVariable(PORT_FIRE_BURST);
 
  100                 SetVariableOut(PORT_STABILIZATION, 3.0 * distStabilizationTimeFactor);
 
  101                 ClearVariable(PORT_SUPPRESSION);
 
  102                 SetVariableOut(PORT_REJECT_TIME, 10.0);
 
  107                 ClearVariable(PORT_FIRE_BURST);
 
  108                 SetVariableOut(PORT_STABILIZATION, 3.0 * distStabilizationTimeFactor);
 
  109                 ClearVariable(PORT_SUPPRESSION);
 
  110                 SetVariableOut(PORT_REJECT_TIME, 10.0);
 
  115                 ClearVariable(PORT_FIRE_BURST);
 
  116                 SetVariableOut(PORT_STABILIZATION, 1.0 * distStabilizationTimeFactor);
 
  117                 ClearVariable(PORT_SUPPRESSION);
 
  118                 SetVariableOut(PORT_REJECT_TIME, 1.0);
 
  123                 ClearVariable(PORT_FIRE_BURST);
 
  124                 SetVariableOut(PORT_STABILIZATION, 0.5 * distStabilizationTimeFactor);
 
  125                 ClearVariable(PORT_SUPPRESSION);
 
  126                 SetVariableOut(PORT_REJECT_TIME, 10.0);
 
  131                 ClearVariable(PORT_FIRE_BURST);
 
  132                 SetVariableOut(PORT_STABILIZATION, 1.0 * distStabilizationTimeFactor);
 
  133                 ClearVariable(PORT_SUPPRESSION);
 
  134                 SetVariableOut(PORT_REJECT_TIME, 20.0);
 
  139                 SetVariableOut(PORT_FIRE_BURST, random * 3 * distBurstTimeFactor);
 
  140                 ClearVariable(PORT_STABILIZATION);
 
  141                 SetVariableOut(PORT_SUPPRESSION, random * 3);
 
  142                 SetVariableOut(PORT_REJECT_TIME, 0.5);
 
  147         return ENodeResult.SUCCESS;
 
  151     override bool VisibleInPalette() {
return true;}
 
  154     protected override string GetOnHoverDescription() {
return "Get all time constants for fire - it is weapon dependent";}