Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_LoadCasualtySupportStationComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/SupportStation", description: "")]
5
6class SCR_LoadCasualtySupportStationComponent : SCR_BaseSupportStationComponent
7{
8 protected SCR_BaseCompartmentManagerComponent m_CompartmentManager;
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 supplyAmount)
45 {
46 if (!super.IsValid(actionOwner, actionUser, action, actionPosition, reasonInvalid, supplyAmount))
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
72 SCR_CompartmentAccessComponent accessComp = SCR_CompartmentAccessComponent.Cast(char.GetCompartmentAccessComponent());
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 ChimeraWorld world = GetGame().GetWorld();
84 if (accessComp.MoveInVehicle(m_CompartmentManagerOwner, ECompartmentType.CARGO, world.IsGameTimePaused(), compartmentSlot))
85 super.OnExecutedServer(actionOwner, actionUser, action);
86 }
87 }
88 }
89}
ECompartmentType
ESupportStationType
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
override void OnExecutedServer(notnull IEntity actionOwner, notnull IEntity actionUser, notnull SCR_BaseUseSupportStationAction action)
ESupportStationType GetSupportStationType()
override void DelayedInit()
SCR_BaseCompartmentManagerComponent m_CompartmentManager
proto external Managed FindComponent(typename typeName)
proto external IEntity GetParent()
bool MoveInVehicle(IEntity vehicle, ECompartmentType compartmentType, bool performWhenPaused=false, BaseCompartmentSlot customSlot=null)
IEntity GetOwner()
Owner entity of the fuel tank.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14