Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
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
27 if (!characterComponent)
28 return false;
29
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(notnull SCR_ChimeraCharacter user)
52 {
53 IEntity playerControlledEntity = GetGame().GetPlayerController().GetControlledEntity();
54
55 if (!playerControlledEntity)
56 return false;
57
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}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
override bool Execute(IEntity cursorTarget, IEntity target, vector targetPosition, int playerID, bool isClient)
ref array< ref ECharacterStance > m_aAllowedStances
override bool CanBePerformed(notnull SCR_ChimeraCharacter user)
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
ECharacterStance
SCR_FieldOfViewSettings Attribute