Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkAIActionShootFlare.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Target entity should shoot at.")]
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 [Attribute("", UIWidgets.Object, "Offset from target entity. If target entity doesn't exist, origin is shooter position and target vector is offset from his position. - use PointInfo")]
8 ref PointInfo m_TargeOffset;
9
10 //------------------------------------------------------------------------------------------------
11 override void OnActivate()
12 {
13 IEntity entity;
14 if (m_Getter)
15 {
16 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
17 if (!entityWrapper)
18 {
19 Print(string.Format("ScenarioFramework Action: Issue with Getter detected for Action %1.", this), LogLevel.ERROR);
20 return;
21 }
22
23 entity = entityWrapper.GetValue();
24 if (!entity)
25 {
26 Print(string.Format("ScenarioFramework Action: Entity not found for Action %1.", this), LogLevel.ERROR);
27 return;
28 }
29 }
30
32 if (!groupUtility)
33 return;
34
35 BaseWeaponComponent weaponComponent;
36 BaseMagazineComponent magazineComponent;
37 int muzzleId;
38 bool agentFound;
40
41 foreach (SCR_AIInfoComponent infoComp : groupUtility.m_aInfoComponents)
42 {
43 agent = SCR_ChimeraAIAgent.Cast(infoComp.GetOwner());
44 if (!agent)
45 continue;
46
47 // Ignore agents that are not "available", considered combat ready
48 if (!IsAgentAvailable(agent))
49 continue;
50
51 agentFound = SCR_AIActivityIllumFlareFeature.GetAgentIllumWeaponAndMuzzle(infoComp, weaponComponent, magazineComponent, muzzleId);
52 if (agentFound)
53 break;
54 }
55
56 if (!agentFound)
57 return;
58
59 AICommunicationComponent comms = groupUtility.m_Owner.GetCommunicationComponent();
60 if (!comms)
61 return;
62
63 IEntity character = agent.GetControlledEntity();
64 if (!character)
65 return;
66
67 vector targetPosition
68 if (entity)
69 targetPosition = entity.GetOrigin();
70 else
71 targetPosition = character.GetOrigin();
72
73 vector targetLocalOffset[4];
74 if (m_TargeOffset)
75 m_TargeOffset.GetLocalTransform(targetLocalOffset);
76
77 targetPosition = targetPosition + targetLocalOffset[3];
78
80 msg.m_RelatedGroupActivity = null;
81 msg.m_fPriorityLevel = SCR_AIActionBase.PRIORITY_BEHAVIOR_RETREAT_MELEE;
82 msg.SetReceiver(agent);
83 comms.RequestBroadcast(msg, agent);
84 }
85
86 //------------------------------------------------------------------------------------------------
87 protected bool IsAgentAvailable(notnull SCR_ChimeraAIAgent agent)
88 {
89 SCR_AIInfoComponent infoComp = agent.m_InfoComponent;
90
91 return agent && infoComp.GetAIState() == EUnitAIState.AVAILABLE &&
92 !infoComp.HasUnitState(EUnitState.IN_TURRET) && !infoComp.HasUnitState(EUnitState.IN_VEHICLE) &&
93 !infoComp.HasUnitState(EUnitState.UNCONSCIOUS);
94 }
95}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external vector GetOrigin()
PointInfo - allows to define position.
Definition PointInfo.c:9
bool HasUnitState(EUnitState state)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute