Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CharacterCommandHandler.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Character", description: "Scripted character command handler", icon: HYBRID_COMPONENT_ICON)]
3 {
4 }
5 
6 class SCR_CharacterCommandHandlerComponent : CharacterCommandHandlerComponent
7 {
8  //------------------------------------------------------------------------------------------------
9  override bool HandleMelee(CharacterInputContext pInputCtx, float pDt, int pCurrentCommandID)
10  {
11  if (pInputCtx.GetMeleeAttack())
12  {
13  GetCommandModifier_Melee().Attack();
14  pInputCtx.SetMeleeAttack(false);
15  m_MeleeComponent.PerformAttack();
16  return true;
17  }
18 
19  if (m_MeleeComponent)
20  m_MeleeComponent.Update(pDt);
21 
22  return GetCommandModifier_Melee().IsMeleeAttackTag();
23  }
24 
25  //------------------------------------------------------------------------------------------------
28  {
31 
32  return m_OnCommandActivate;
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  override void OnCommandActivate(int pCmdId)
37  {
39  m_OnCommandActivate.Invoke(pCmdId);
40 
41  super.OnCommandActivate(pCmdId);
42  }
43 
44  //------------------------------------------------------------------------------------------------
47  {
48  if (IsLoitering())
49  return;
50 
52  if (!scrCharCtrl)
53  return;
54 
56  m_CharacterAnimComp.SetCurrentCommand(m_CmdLoiter);
57  }
58 
59  //------------------------------------------------------------------------------------------------
61  {
62  AnimPhysCommandScripted currentCmdScripted = m_CharacterAnimComp.GetCommandScripted();
63  if (!currentCmdScripted)
64  return null;
65 
66  return SCR_CharacterCommandLoiter.Cast(currentCmdScripted);
67  }
68 
69  //------------------------------------------------------------------------------------------------
72  //terminateFast should be true when we are going into alerted or combat state.
73  void StopLoitering(bool terminateFast)
74  {
75  if (m_CmdLoiter)
76  m_CmdLoiter.StopLoitering(terminateFast);
77 
78  Rpc(Rpc_StopLoiter_S, false);
79  }
80 
81  //------------------------------------------------------------------------------------------------
84  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
85  void Rpc_StopLoiter_S(bool terminateFast)
86  {
87  if (m_CmdLoiter)
88  m_CmdLoiter.StopLoitering(terminateFast);
89  }
90 
91  //------------------------------------------------------------------------------------------------
94  bool IsLoitering()
95  {
96  return GetLoiterCommand() != null;
97  }
98 
99  //------------------------------------------------------------------------------------------------
100  override protected void OnInit(IEntity owner)
101  {
102  super.OnInit(owner);
103 
105  m_OwnerEntity = ChimeraCharacter.Cast(owner);
106  m_CharacterAnimComp = CharacterAnimationComponent.Cast(m_OwnerEntity.FindComponent(CharacterAnimationComponent));
108  m_WeaponManager = BaseWeaponManagerComponent.Cast(m_OwnerEntity.FindComponent(BaseWeaponManagerComponent));
110 
112  Print("Failed to bind scripted static table (see class SCR_ScriptedCommandsStaticTable). This can be caused by missing animation commands, tags, or events in the animation graph.");
113  }
114 
115  protected ChimeraCharacter m_OwnerEntity;
117  protected CharacterAnimationComponent m_CharacterAnimComp;
118  protected CharacterControllerComponent m_CharacterControllerComp;
120  protected BaseWeaponManagerComponent m_WeaponManager;
122 
124 
125  protected ref CharacterCommandMoveSettings m_MoveSettings = new CharacterCommandMoveSettings();
127 
129 }
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
m_OwnerEntity
protected ChimeraCharacter m_OwnerEntity
Definition: SCR_CharacterCommandHandler.c:115
m_MoveSettings
protected ref CharacterCommandMoveSettings m_MoveSettings
Definition: SCR_CharacterCommandHandler.c:125
SCR_ScriptedCommandsStaticTable
Definition: SCR_ScriptedCommandsStaticTable.c:1
CharacterInputContext
Definition: CharacterInputContext.c:12
GetLoiterCommand
protected SCR_CharacterCommandLoiter GetLoiterCommand()
Definition: SCR_CharacterCommandHandler.c:60
GetCommandModifier_Melee
proto external CharacterCommandMelee GetCommandModifier_Melee()
Rpc_StopLoiter_S
void Rpc_StopLoiter_S(bool terminateFast)
Definition: SCR_CharacterCommandHandler.c:85
ScriptInvokerInt
ScriptInvokerBase< ScriptInvokerIntMethod > ScriptInvokerInt
Definition: SCR_ScriptInvokerHelper.c:24
StartCommandLoitering
void StartCommandLoitering()
Definition: SCR_CharacterCommandHandler.c:46
OnCommandActivate
override void OnCommandActivate(int pCmdId)
Definition: SCR_CharacterCommandHandler.c:36
GetOnCommandActivate
ScriptInvokerInt GetOnCommandActivate()
Definition: SCR_CharacterCommandHandler.c:27
m_ClimbSettings
protected ref CharacterCommandClimbSettings m_ClimbSettings
Definition: SCR_CharacterCommandHandler.c:126
CharacterMovementState
Definition: CharacterMovementState.c:15
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
GetInputContext
proto external CharacterInputContext GetInputContext()
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
m_WeaponManager
protected BaseWeaponManagerComponent m_WeaponManager
Definition: SCR_CharacterCommandHandler.c:120
m_ScrStaticTable
protected ref SCR_ScriptedCommandsStaticTable m_ScrStaticTable
Definition: SCR_CharacterCommandHandler.c:121
m_CharacterControllerComp
protected CharacterControllerComponent m_CharacterControllerComp
Definition: SCR_CharacterCommandHandler.c:118
CharacterCommandClimbSettings
Definition: CharacterCommandClimbSettings.c:15
StopLoitering
void StopLoitering(bool terminateFast)
Definition: SCR_CharacterCommandHandler.c:73
SCR_CharacterCommandHandlerComponentClass
Definition: SCR_CharacterCommandHandler.c:2
m_CharacterAnimComp
protected CharacterAnimationComponent m_CharacterAnimComp
Definition: SCR_CharacterCommandHandler.c:117
m_MeleeComponent
protected SCR_MeleeComponent m_MeleeComponent
Definition: SCR_CharacterCommandHandler.c:119
SCR_CharacterCommandLoiter
class SCR_ScriptedCommandsStaticTable SCR_CharacterCommandLoiter
GetControllerComponent
CharacterCommandHandlerComponentClass BaseCommandHandlerComponentClass GetControllerComponent()
Returns the current character controller component.
m_MovementState
protected ref CharacterMovementState m_MovementState
Definition: SCR_CharacterCommandHandler.c:116
OnInit
override protected void OnInit(IEntity owner)
Definition: SCR_CharacterCommandHandler.c:100
CharacterCommandHandlerComponentClass
Definition: CharacterCommandHandlerComponent.c:12
IsLoitering
bool IsLoitering()
Definition: SCR_CharacterCommandHandler.c:94
m_OnCommandActivate
protected ref ScriptInvokerInt m_OnCommandActivate
Definition: SCR_CharacterCommandHandler.c:128
m_CmdLoiter
protected ref SCR_CharacterCommandLoiter m_CmdLoiter
Definition: SCR_CharacterCommandHandler.c:123
HandleMelee
SCR_CharacterCommandHandlerComponentClass CharacterCommandHandlerComponentClass HandleMelee(CharacterInputContext pInputCtx, float pDt, int pCurrentCommandID)
Definition: SCR_CharacterCommandHandler.c:9
SCR_MeleeComponent
Definition: SCR_MeleeComponent.c:23
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180