Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseContinuousEmoteCommand.c
Go to the documentation of this file.
3 {
4  protected ref SCR_ScriptedCharacterInputContext m_pScrInputContext;
5 
6  [Attribute(uiwidget: UIWidgets.SearchComboBox, desc: "Loiter animation", enums: ParamEnumArray.FromEnum(ELoiteringType))]
7  protected ELoiteringType m_eLoiterType;
8 
9  [Attribute(defvalue: "1", desc: "Unequip items in hand before doing emote?")]
10  protected bool m_bUnequipItems;
11 
12  [Attribute(uiwidget: UIWidgets.SearchComboBox, desc: "Available stances. All stances allowed if empty", enums: ParamEnumArray.FromEnum(ECharacterStance))]
13  protected ref array<ref ECharacterStance> m_aAllowedStances;
14 
15  protected ResourceName m_sHint = "{3D2B20A0A9C3248A}Configs/Hints/GeneralHints.conf";
16 
17  //------------------------------------------------------------------------------------------------
18  override bool Execute(IEntity cursorTarget, IEntity target, vector targetPosition, int playerID, bool isClient)
19  {
20  //TODO: Implement optional local-only commands to safe networking for commands of this style
21  if (SCR_PlayerController.GetLocalPlayerId() != playerID)
22  return true;
23 
24  IEntity playerControlledEntity = GetGame().GetPlayerController().GetControlledEntity();
25  if (!playerControlledEntity)
26  return false;
27 
28  SCR_CharacterControllerComponent characterController = SCR_CharacterControllerComponent.Cast(playerControlledEntity.FindComponent(SCR_CharacterControllerComponent));
29  if (!characterController)
30  return false;
31 
32  SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.Cast(playerControlledEntity.FindComponent(SCR_GadgetManagerComponent));
33  if (!gadgetManager)
34  return false;
35 
36  if (characterController.IsLoitering())
37  {
38  characterController.StopLoitering(false);
39  return true;
40  }
41 
42  if (m_bUnequipItems && (gadgetManager.GetHeldGadget() || characterController.GetWeaponManagerComponent().GetCurrentWeapon()))
43  {
44  if (characterController.IsGadgetInHands())
45  characterController.RemoveGadgetFromHand();
46 
47  characterController.SelectWeapon(null);
48 
49  //Call the animation later when the unequipping of the items is done.
50  GetGame().GetCallqueue().CallLater(StartLoiter, 1500, false);
51  return true;
52  }
53 
54  StartLoiter();
55  return true;
56  }
57 
58  //------------------------------------------------------------------------------------------------
59  override bool CanBePerformed()
60  {
61  IEntity playerControlledEntity = GetGame().GetPlayerController().GetControlledEntity();
62 
63  if (!playerControlledEntity)
64  return false;
65 
66  SCR_CharacterControllerComponent characterComponent = SCR_CharacterControllerComponent.Cast(playerControlledEntity.FindComponent(SCR_CharacterControllerComponent));
67  if (!characterComponent)
68  return false;
69 
70  if (m_aAllowedStances.IsEmpty())
71  return true;
72 
73  return (m_aAllowedStances.Contains(characterComponent.GetStance()));
74  }
75 
76  //------------------------------------------------------------------------------------------------
77  bool StartLoiter()
78  {
79  IEntity playerControlledEntity = GetGame().GetPlayerController().GetControlledEntity();
80  if (!playerControlledEntity)
81  return false;
82 
83  SCR_CharacterControllerComponent characterController = SCR_CharacterControllerComponent.Cast(playerControlledEntity.FindComponent(SCR_CharacterControllerComponent));
84  if (!characterController)
85  return false;
86 
87  vector emptyVector[4];
88  characterController.StartLoitering(m_eLoiterType, false, true, false, emptyVector);
89 
90  Resource holder = BaseContainerTools.LoadContainer(m_sHint);
91  if (!holder.IsValid())
92  return true;
93 
94  //show hint explaining continuous emote
95  BaseContainer container = holder.GetResource().ToBaseContainer();
96  SCR_GeneralHintStorage hintStorage = SCR_GeneralHintStorage.Cast(BaseContainerTools.CreateInstanceFromContainer(container));
97  SCR_HintManagerComponent.ShowHint(hintStorage.GetHintByType(EHint.EMOTES_INTRO));
98 
99  return true;
100  }
101 }
SCR_ScriptedCharacterInputContext
Definition: SCR_ScriptedCharacterInputContext.c:1
SCR_PlayerController
Definition: SCR_PlayerController.c:31
ELoiteringType
ELoiteringType
Definition: SCR_LoiterUserAction.c:1
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_GadgetManagerComponent
Definition: SCR_GadgetManagerComponent.c:138
SCR_GeneralHintStorage
Definition: SCR_GeneralHintsConfig.c:2
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
SCR_ContinuousLoiterCommand
Definition: SCR_BaseContinuousEmoteCommand.c:2
EHint
EHint
Definition: EHint.c:10
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