Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_HelicopterControllerComponent.c
Go to the documentation of this file.
4
9class SCR_HelicopterControllerComponent : HelicopterControllerComponent
10{
11 BaseContainer gameplaySettings = GetGame().GetGameUserSettings().GetModule("SCR_GameplaySettings");
12
13 //------------------------------------------------------------------------------------------------
14 override void OnCompartmentEntered(IEntity vehicle, BaseCompartmentManagerComponent mgr, IEntity occupant, int managerId, int slotID)
15 {
16 super.OnCompartmentEntered(vehicle, mgr, occupant, managerId, slotID);
17
18 if (mgr.FindCompartment(slotID, managerId) == GetPilotCompartmentSlot())
19 {
20 GetGame().GetInputManager().AddActionListener("HelicopterLightsTaxiToggle", EActionTrigger.DOWN, ActionHelicopterLightsTaxiToggle);
21 GetGame().GetInputManager().AddActionListener("HelicopterLightsLandingToggle", EActionTrigger.DOWN, ActionHelicopterLightsLandingToggle);
22 }
23 }
24
25 //------------------------------------------------------------------------------------------------
26 override void OnCompartmentLeft(IEntity vehicle, BaseCompartmentManagerComponent mgr, IEntity occupant, int managerId, int slotID)
27 {
28 super.OnCompartmentLeft(vehicle, mgr, occupant, managerId, slotID);
29
30 if (mgr.FindCompartment(slotID, managerId) == GetPilotCompartmentSlot())
31 {
32 GetGame().GetInputManager().RemoveActionListener("HelicopterLightsTaxiToggle", EActionTrigger.DOWN, ActionHelicopterLightsTaxiToggle);
33 GetGame().GetInputManager().RemoveActionListener("HelicopterLightsLandingToggle", EActionTrigger.DOWN, ActionHelicopterLightsLandingToggle);
34 }
35 }
36
37 //------------------------------------------------------------------------------------------------
38 protected void ActionHelicopterLightsTaxiToggle(float value, EActionTrigger trigger)
39 {
41 if (!pilotSlot || pilotSlot.GetOccupant() != SCR_PlayerController.GetLocalControlledEntity())
42 return;
43
44 BaseLightManagerComponent lightManager = GetLightManager();
45 if (lightManager)
46 lightManager.SetLightsState(ELightType.SearchLight, !lightManager.GetLightsState(ELightType.SearchLight));
47 }
48
49 //------------------------------------------------------------------------------------------------
50 protected void ActionHelicopterLightsLandingToggle(float value, EActionTrigger trigger)
51 {
53 if (!pilotSlot || pilotSlot.GetOccupant() != SCR_PlayerController.GetLocalControlledEntity())
54 return;
55
56 BaseLightManagerComponent lightManager = GetLightManager();
57 if (lightManager)
58 lightManager.SetLightsState(ELightType.HiBeam, !lightManager.GetLightsState(ELightType.HiBeam));
59 }
60
61 //------------------------------------------------------------------------------------------------
62 // This is required because GameCode CollectiveMode has more options that are not available in the settings (ECollectiveModeForSettings).
63 // The usage of this function can not be avoided by explicitly specifying enumerator values for ECollectiveModeForSettings because that will break UI.
65 {
66 if (settingCollectiveMode == ECollectiveModeForSettings.Default)
67 return CollectiveMode.LocalYOffsetAuto;
68 return settingCollectiveMode;
69 }
70
71 //------------------------------------------------------------------------------------------------
72 override protected event void OnPrepareControls()
73 {
74 // Set the collective based on the last used input device.
75 EInputDeviceType deviceType = GetCollectiveInputType();
76 if (deviceType == EInputDeviceType.GAMEPAD)
77 {
78 ECollectiveModeForSettings collectiveMode;
79 if (gameplaySettings.Get("m_eGamepadCollective", collectiveMode))
80 SetCollectiveMode(GetCollectiveModeFromSettings(collectiveMode));
81 }
82 else if (deviceType == EInputDeviceType.JOYSTICK)
83 {
84 ECollectiveModeForSettings collectiveMode;
85 if (gameplaySettings.Get("m_eHotasCollective", collectiveMode))
86 SetCollectiveMode(GetCollectiveModeFromSettings(collectiveMode));
87 }
88 else
89 {
90 ECollectiveModeForSettings collectiveMode;
91 if (gameplaySettings.Get("m_eKeyboardCollective", collectiveMode))
92 SetCollectiveMode(GetCollectiveModeFromSettings(collectiveMode));
93 }
94 }
95}
ELightType
Definition ELightType.c:8
ArmaReforgerScripted GetGame()
Definition game.c:1398
void OnCompartmentEntered(AIAgent agent, IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
void OnCompartmentLeft(AIAgent agent, IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
ECollectiveModeForSettings
CollectiveMode GetCollectiveModeFromSettings(ECollectiveModeForSettings settingCollectiveMode)
void ActionHelicopterLightsLandingToggle(float value, EActionTrigger trigger)
SCR_HelicopterControllerComponentClass gameplaySettings
void ActionHelicopterLightsTaxiToggle(float value, EActionTrigger trigger)
event void OnPrepareControls()
PilotCompartmentSlot GetPilotCompartmentSlot()
Get primary pilot compartment slot.
Definition Vehicle.c:104
static IEntity GetLocalControlledEntity()
EActionTrigger
CollectiveMode