Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_JumpOutUserAction.c
Go to the documentation of this file.
1 class SCR_JumpOutAction : SCR_CompartmentUserAction
2 {
3  //------------------------------------------------------------------------------------------------
4  override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
5  {
6  if (!pOwnerEntity)
7  return;
8 
9  ChimeraCharacter character = ChimeraCharacter.Cast(pUserEntity);
10  if (!character)
11  return;
12 
13  CharacterControllerComponent controller = character.GetCharacterController();
14  if (controller && controller.IsUnconscious())
15  return;
16 
17  BaseCompartmentSlot targetCompartment = GetCompartmentSlot();
18  if (!targetCompartment)
19  return;
20 
21  CompartmentAccessComponent compartmentAcess = character.GetCompartmentAccessComponent();
22  if (!compartmentAcess)
23  return;
24 
25  // Should become JumpOut when available
26  if (!compartmentAcess.GetOutVehicle(GetRelevantDoorIndex(pUserEntity), true))
27  return;
28 
29  super.PerformAction(pOwnerEntity, pUserEntity);
30  }
31 
32  //------------------------------------------------------------------------------------------------
33  override bool CanBePerformedScript(IEntity user)
34  {
35  ChimeraCharacter character = ChimeraCharacter.Cast(user);
36  if (!character)
37  return false;
38 
39  CharacterControllerComponent controller = character.GetCharacterController();
40  if (controller && controller.IsUnconscious())
41  return false;
42 
43  CompartmentAccessComponent compartmentAccess = character.GetCompartmentAccessComponent();
44  if (!compartmentAccess)
45  return false;
46 
47  if (!compartmentAccess.IsInCompartment())
48  return false;
49 
50  if (compartmentAccess.IsGettingIn() || compartmentAccess.IsGettingOut())
51  return false;
52 
53  BaseCompartmentSlot compartment = compartmentAccess.GetCompartment();
54  if (!compartment)
55  return false;
56 
57  BaseCompartmentSlot thisCompartment = GetCompartmentSlot();
58  return thisCompartment == compartment;
59  }
60 
61  //------------------------------------------------------------------------------------------------
62  override bool CanBeShownScript(IEntity user)
63  {
64  return CanBePerformed(user);
65  }
66 
67  //------------------------------------------------------------------------------------------------
68  override bool GetActionNameScript(out string outName)
69  {
70  BaseCompartmentSlot compartment = GetCompartmentSlot();
71  if (!compartment)
72  return false;
73 
74  UIInfo actionInfo = GetUIInfo();
75  if (!actionInfo)
76  return false;
77 
78  outName = actionInfo.GetName();
79 
80  return true;
81  }
82 };
UIInfo
UIInfo - declare object, allows to define UI elements.
Definition: UIInfo.c:13
GetUIInfo
SCR_UIInfo GetUIInfo()
Definition: SCR_EditableEntityCampaignBuildingModeLabelSetting.c:27
SCR_JumpOutAction
Definition: SCR_JumpOutUserAction.c:1