Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_LoadCasualtySupportStationComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/SupportStation", description: "")]
3 {
4 }
5 
6 class SCR_LoadCasualtySupportStationComponent : SCR_BaseSupportStationComponent
7 {
8  protected SCR_BaseCompartmentManagerComponent m_CompartmentManager;
9  protected IEntity m_CompartmentManagerOwner;
10 
11  //------------------------------------------------------------------------------------------------
12  protected override void DelayedInit(IEntity owner)
13  {
14  if (!owner)
15  return;
16 
17  super.DelayedInit(owner);
18 
19  m_CompartmentManager = SCR_BaseCompartmentManagerComponent.Cast(owner.FindComponent(SCR_BaseCompartmentManagerComponent));
21  {
22  IEntity parent = owner.GetParent();
23  if (parent)
24  {
25  m_CompartmentManager = SCR_BaseCompartmentManagerComponent.Cast(parent.FindComponent(SCR_BaseCompartmentManagerComponent));
28  }
29  }
30  else
31  {
33  }
34 
35  //~ Could not find compartment manager
37  {
38  Print("'SCR_LoadCasualtySupportStationComponent': '" + GetOwner().GetName() + "' has no CompartmentManager!", LogLevel.ERROR);
39  return;
40  }
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  override bool IsValid(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action, vector actionPosition, out ESupportStationReasonInvalid reasonInvalid, out int supplyCost)
45  {
46  if (!super.IsValid(actionOwner, actionUser, action, actionPosition, reasonInvalid, supplyCost))
47  return false;
48 
49  //~ Has no fuel to provide so not valid
50  if (!m_CompartmentManager || !m_CompartmentManager.GetFirstFreeCompartmentOfType(SCR_PatientCompartmentSlot))
51  {
52  reasonInvalid = ESupportStationReasonInvalid.LOAD_CASUALTY_NO_SPACE;
53  return false;
54  }
55 
56  return true;
57  }
58 
59  //------------------------------------------------------------------------------------------------
61  {
62  return ESupportStationType.LOAD_CASUALTY;
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  override void OnExecutedServer(notnull IEntity actionOwner, notnull IEntity actionUser, notnull SCR_BaseUseSupportStationAction action)
67  {
68  ChimeraCharacter char = ChimeraCharacter.Cast(actionOwner);
69  if (!char)
70  return;
71 
73  if (!accessComp)
74  return;
75 
76  //~ Load casualty in vehicle
78  {
79  BaseCompartmentSlot compartmentSlot = m_CompartmentManager.GetFirstFreeCompartmentOfType(SCR_PatientCompartmentSlot);
80  if (compartmentSlot)
81  {
82  //~ Successfully moved the character
83  if (accessComp.MoveInVehicle(m_CompartmentManagerOwner, ECompartmentType.Cargo, compartmentSlot))
84  super.OnExecutedServer(actionOwner, actionUser, action);
85  }
86  }
87  }
88 }
SCR_BaseSupportStationComponentClass
Definition: SCR_BaseSupportStationComponent.c:2
DelayedInit
protected override void DelayedInit(IEntity owner)
Definition: SCR_LoadCasualtySupportStationComponent.c:12
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
m_CompartmentManager
SCR_LoadCasualtySupportStationComponentClass m_CompartmentManager
SCR_CompartmentAccessComponent
Definition: SCR_CompartmentAccessComponent.c:15
GetName
string GetName()
Definition: SCR_ScenarioFrameworkLayerBase.c:85
SCR_LoadCasualtySupportStationComponentClass
Definition: SCR_LoadCasualtySupportStationComponent.c:2
GetSupportStationType
override ESupportStationType GetSupportStationType()
Definition: SCR_LoadCasualtySupportStationComponent.c:60
GetCompartmentAccessComponent
proto external CompartmentAccessComponent GetCompartmentAccessComponent()
Returns component which stores information about compartment used by character.
ECompartmentType
ECompartmentType
Definition: ECompartmentType.c:7
SCR_PatientCompartmentSlot
Definition: SCR_PatientCompartmentSlot.c:1
OnExecutedServer
override void OnExecutedServer(notnull IEntity actionOwner, notnull IEntity actionUser, notnull SCR_BaseUseSupportStationAction action)
Definition: SCR_LoadCasualtySupportStationComponent.c:66
ESupportStationReasonInvalid
ESupportStationReasonInvalid
Definition: ESupportStationReasonInvalid.c:3
IsValid
override bool IsValid(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action, vector actionPosition, out ESupportStationReasonInvalid reasonInvalid, out int supplyCost)
Definition: SCR_LoadCasualtySupportStationComponent.c:44
ESupportStationType
ESupportStationType
Definition: ESupportStationType.c:2
m_CompartmentManagerOwner
protected IEntity m_CompartmentManagerOwner
Definition: SCR_LoadCasualtySupportStationComponent.c:9
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
SCR_BaseUseSupportStationAction
Definition: SCR_BaseUseSupportStationAction.c:1
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180