Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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?")]
18  protected bool m_bUsableWhileUncouscious;
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  //------------------------------------------------------------------------------------------------
27  override bool CanRoleShow()
28  {
29  SCR_PlayerControllerGroupComponent groupController = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
30  if (!groupController)
31  return false;
32 
33  bool isPlayerLeader = groupController.IsPlayerLeaderOwnGroup();
34  if (isPlayerLeader && !m_bShowToLeader)
35  return false;
36 
37  if (!isPlayerLeader && !m_bShowToMember)
38  return false;
39 
40  return true;
41  }
42 
43  //-----------------------------------------------------------------------------------------------
44  void PlayAIResponse(IEntity slaveGroup)
45  {
46  SCR_AIGroup aiGroup = SCR_AIGroup.Cast(slaveGroup);
47  if (!slaveGroup)
48  return;
49 
50  AIAgent agent = aiGroup.GetLeaderAgent();
51  if (!agent)
52  return;
53 
54  IEntity owner = agent.GetControlledEntity();
55  if (!owner)
56  return;
57 
58  SCR_CommunicationSoundComponent soundComponent = SCR_CommunicationSoundComponent.Cast(owner.FindComponent(SCR_CommunicationSoundComponent));
59  if (!soundComponent)
60  return;
61 
62  soundComponent.SoundEventPriority(SCR_SoundEvent.SOUND_CP_POSITIVEFEEDBACK, 50);
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  string GetSoundEventName()
67  {
68  return m_sSoundEventName;
69  }
70 
71  //------------------------------------------------------------------------------------------------
72  override bool CanShowOnMap()
73  {
74  return m_bShowOnMap;
75  }
76 
77  //------------------------------------------------------------------------------------------------
78  int GetCommandGestureID()
79  {
80  return m_iGestureID;
81  }
82 
83  //------------------------------------------------------------------------------------------------
84  override bool CanBeShownInCurrentLifeState()
85  {
86  PlayerController playerController = GetGame().GetPlayerController();
87  if (!playerController)
88  return false;
89 
90  //returns true because if there is no controlled entity then player is not dead nor uncoscious.
91  ChimeraCharacter character = ChimeraCharacter.Cast(playerController.GetControlledEntity());
92  if (!character)
93  return true;
94 
95  //Return true in case of component not found to prevent VME
96  CharacterControllerComponent controller = character.GetCharacterController();
97  if (!controller)
98  return true;
99 
100  ECharacterLifeState lifeState = controller.GetLifeState();
101  if ((!m_bUsableWhileDead && lifeState == ECharacterLifeState.DEAD) || (!m_bUsableWhileUncouscious && lifeState == ECharacterLifeState.INCAPACITATED))
102  return false;
103 
104  return true;
105  }
106 }
ECharacterLifeState
ECharacterLifeState
Definition: ECharacterLifeState.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_BaseRadialCommand
Definition: SCR_BaseRadialCommand.c:2
m_sSoundEventName
protected string m_sSoundEventName
Definition: SCR_VoiceoverData.c:42
SCR_BaseGroupCommand
Definition: SCR_BaseGroupCommand.c:3
SCR_AIGroup
Definition: SCR_AIGroup.c:68
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468