Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseGroupCommand.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
4{
5 [Attribute(defvalue: "1", desc: "Will the command be shown to leader?")]
6 protected bool m_bShowToLeader;
7
8 [Attribute(defvalue: "0", desc: "Will the command be shown to member?")]
9 protected bool m_bShowToMember;
10
11 [Attribute(defvalue: "0", desc: "Will the command be shown while commanding from map?")]
12 protected bool m_bShowOnMap;
13
14 [Attribute(defvalue: "0", desc: "Is the command available while player is dead?")]
15 protected bool m_bUsableWhileDead;
16
17 [Attribute(defvalue: "0", desc: "Is the command available while player is unconscious?")]
19
20 [Attribute(defvalue: "0", desc: "ID of the gesture in gesture state machine to be played when command is given out. 0 = no gesture")]
21 protected int m_iGestureID;
22
23 [Attribute("", UIWidgets.EditBox, "Name of the sound event to be played, leave empty for no event")]
24 protected string m_sSoundEventName;
25
26 [Attribute(defvalue: "-1", desc: "seed for the version of sound event to be played, -1 for random. For valid values refer to audio guide")]
27 protected float m_fSoundEventSeed;
28
29 [Attribute(defvalue: "0", desc: "Will the command show preview in world before it is given out")]
30 protected bool m_bShowPreview;
31
32 [Attribute(defvalue: "1", desc: "Will the AI respond with voicelines to given command")]
33 protected bool m_bPlayAIResponse;
34
35 [Attribute(SCR_ECommandVisualizationDuration.BRIEF.ToString(), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(SCR_ECommandVisualizationDuration))]
37
38 [Attribute("{10A7FB1074F322FC}Configs/Commanding/PlacedCommandInfoDisplay.conf", UIWidgets.ResourceNamePicker, params: "conf", category: "Visualization")]
40
42
43 //------------------------------------------------------------------------------------------------
44 override bool CanRoleShow()
45 {
46 SCR_PlayerControllerGroupComponent groupController = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
47 if (!groupController)
48 return false;
49
50 bool isPlayerLeader = groupController.IsPlayerLeaderOwnGroup();
51 if (isPlayerLeader && !m_bShowToLeader)
52 return false;
53
54 if (!isPlayerLeader && !m_bShowToMember)
55 return false;
56
57 return true;
58 }
59
60 //------------------------------------------------------------------------------------------------
62 {
63 return m_sSoundEventName;
64 }
65
67 {
68 return m_fSoundEventSeed;
69 }
70
71 //------------------------------------------------------------------------------------------------
73 {
74 return m_bShowPreview;
75 }
76
78 {
79 return m_bPlayAIResponse;
80 }
81
82 //------------------------------------------------------------------------------------------------
83 override bool CanShowOnMap()
84 {
85 return m_bShowOnMap;
86 }
87
88 //------------------------------------------------------------------------------------------------
90 {
91 return m_iGestureID;
92 }
93
94 //------------------------------------------------------------------------------------------------
99
100 //------------------------------------------------------------------------------------------------
102 {
103 PlayerController playerController = GetGame().GetPlayerController();
104 if (!playerController)
105 return false;
106
107 //returns true because if there is no controlled entity then player is not dead nor uncoscious.
108 ChimeraCharacter character = ChimeraCharacter.Cast(playerController.GetControlledEntity());
109 if (!character)
110 return true;
111
112 //Return true in case of component not found to prevent VME
113 CharacterControllerComponent controller = character.GetCharacterController();
114 if (!controller)
115 return true;
116
117 ECharacterLifeState lifeState = controller.GetLifeState();
118 if ((!m_bUsableWhileDead && lifeState == ECharacterLifeState.DEAD) || (!m_bUsableWhileUncouscious && lifeState == ECharacterLifeState.INCAPACITATED))
119 return false;
120
121 return true;
122 }
123
124 //------------------------------------------------------------------------------------------------
125 override void VisualizeCommand(vector targetPosition)
126 {
127 if (!m_bShowPreview)
128 return;
129
130 Resource resource = BaseContainerTools.LoadContainer(m_sInfoDisplayConfig);
131 if (!resource || !resource.IsValid())
132 return;
133
135 if (!hudManager)
136 return;
137
138 SCR_PlacedCommandInfoDisplay display = SCR_PlacedCommandInfoDisplay.Cast(BaseContainerTools.CreateInstanceFromContainer(resource.GetResource().ToBaseContainer()));
139 if (!display)
140 return;
141
142 SCR_PlayerControllerCommandingComponent commandComp = SCR_PlayerControllerCommandingComponent.GetLocalPlayerControllerCommandingComponent();
143 if (commandComp)
144 commandComp.SetShownCommand(display);
145
146 hudManager.StartDrawing(display);
147 display.VisualizeCommand(targetPosition, this);
148 }
149
150 //------------------------------------------------------------------------------------------------
151 override void VisualizeCommandPreview(vector targetPosition)
152 {
153 if (!m_bShowPreview)
154 return;
155
156 Resource resource = BaseContainerTools.LoadContainer(m_sInfoDisplayConfig);
157 if (!resource || !resource.IsValid())
158 return;
159
160 SCR_PlacedCommandInfoDisplay display = SCR_PlacedCommandInfoDisplay.Cast(BaseContainerTools.CreateInstanceFromContainer(resource.GetResource().ToBaseContainer()));
161 if (!display)
162 return;
163
165 if (!hudManager)
166 return;
167
168 SCR_PlayerControllerCommandingComponent commandComp = SCR_PlayerControllerCommandingComponent.GetLocalPlayerControllerCommandingComponent();
169 if (commandComp)
170 commandComp.SetShownCommandPreview(display);
171
172 hudManager.StartDrawing(display);
173 display.SetIsPreview(true);
174 display.VisualizeCommand(targetPosition, this);
175 }
176}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
SCR_ECommandVisualizationDuration m_eVisualizationDuration
override bool CanBeShownInCurrentLifeState()
override void VisualizeCommand(vector targetPosition)
SCR_ECommandVisualizationDuration GetVisualizationDuration()
override void VisualizeCommandPreview(vector targetPosition)
static SCR_HUDManagerComponent GetHUDManager()
void VisualizeCommand(vector targetPosition, SCR_BaseGroupCommand command)
ECharacterLifeState
SCR_FieldOfViewSettings Attribute