Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EmoteBaseCommand.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  [Attribute(defvalue: "1", desc: "Unequip items in hand before doing emote?")]
6  protected bool m_bUnequipItems;
7 
8  [Attribute(defvalue: "0", desc: "ID of the gesture in gesture state machine to be played, 0 = no gesture")]
9  protected int m_iGestureID;
10 
11  [Attribute(uiwidget: UIWidgets.SearchComboBox, desc: "Available stances. All stances allowed if empty", enums: ParamEnumArray.FromEnum(ECharacterStance))]
12  protected ref array<ref ECharacterStance> m_aAllowedStances;
13 
14  //------------------------------------------------------------------------------------------------
15  override bool Execute(IEntity cursorTarget, IEntity target, vector targetPosition, int playerID, bool isClient)
16  {
17  //TODO: Implement optional local-only commands to safe networking for commands of this style
18  if (SCR_PlayerController.GetLocalPlayerId() != playerID)
19  return true;
20 
21  IEntity playerControlledEntity = GetGame().GetPlayerController().GetControlledEntity();
22 
23  if (!playerControlledEntity)
24  return false;
25 
26  SCR_CharacterControllerComponent characterComponent = SCR_CharacterControllerComponent.Cast(playerControlledEntity.FindComponent(SCR_CharacterControllerComponent));
27  if (!characterComponent)
28  return false;
29 
30  SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.Cast(playerControlledEntity.FindComponent(SCR_GadgetManagerComponent));
31  if (!gadgetManager)
32  return false;
33 
34  if (m_bUnequipItems && (gadgetManager.GetHeldGadget() || characterComponent.GetWeaponManagerComponent().GetCurrentWeapon()))
35  {
36  if (characterComponent.IsGadgetInHands())
37  characterComponent.RemoveGadgetFromHand();
38  characterComponent.SelectWeapon(null);
39 
40  //Call the animation later when the unequipping of the items is done.
41  GetGame().GetCallqueue().CallLater(characterComponent.TryStartCharacterGesture, 1500, false, m_iGestureID, 2000 );
42 
43  return true;
44  }
45 
46  characterComponent.TryStartCharacterGesture(m_iGestureID, 2000);
47  return true;
48  }
49 
50  //------------------------------------------------------------------------------------------------
51  override bool CanBePerformed()
52  {
53  IEntity playerControlledEntity = GetGame().GetPlayerController().GetControlledEntity();
54 
55  if (!playerControlledEntity)
56  return false;
57 
58  SCR_CharacterControllerComponent characterComponent = SCR_CharacterControllerComponent.Cast(playerControlledEntity.FindComponent(SCR_CharacterControllerComponent));
59  if (!characterComponent)
60  return false;
61 
62  if (m_aAllowedStances.IsEmpty())
63  return true;
64 
65  return (m_aAllowedStances.Contains(characterComponent.GetStance()));
66  }
67 }
SCR_EmoteBaseCommand
Definition: SCR_EmoteBaseCommand.c:3
SCR_PlayerController
Definition: SCR_PlayerController.c:31
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_GadgetManagerComponent
Definition: SCR_GadgetManagerComponent.c:138
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_BaseRadialCommand
Definition: SCR_BaseRadialCommand.c:2
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