Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TrackedControllerComponent.c
Go to the documentation of this file.
2{
3}
4
9class SCR_TrackedControllerComponent : TrackedControllerComponent
10{
11 //------------------------------------------------------------------------------------------------
12 override void OnCompartmentEntered(IEntity vehicle, BaseCompartmentManagerComponent mgr, IEntity occupant, int managerId, int slotID)
13 {
14 super.OnCompartmentEntered(vehicle, mgr, occupant, managerId, slotID);
15
16 if (mgr.FindCompartment(slotID, managerId) == GetPilotCompartmentSlot())
17 {
18 GetGame().GetInputManager().AddActionListener("VehicleLightsToggle", EActionTrigger.DOWN, ActionVehicleLightsToggle);
19 GetGame().GetInputManager().AddActionListener("TrackedLightsHiBeamToggle", EActionTrigger.DOWN, ActionTrackedLightsHiBeamToggle);
20 }
21 }
22
23 //------------------------------------------------------------------------------------------------
24 override void OnCompartmentLeft(IEntity vehicle, BaseCompartmentManagerComponent mgr, IEntity occupant, int managerId, int slotID)
25 {
26 super.OnCompartmentLeft(vehicle, mgr, occupant, managerId, slotID);
27
28 if (mgr.FindCompartment(slotID, managerId) == GetPilotCompartmentSlot())
29 {
30 GetGame().GetInputManager().RemoveActionListener("VehicleLightsToggle", EActionTrigger.DOWN, ActionVehicleLightsToggle);
31 GetGame().GetInputManager().RemoveActionListener("TrackedLightsHiBeamToggle", EActionTrigger.DOWN, ActionTrackedLightsHiBeamToggle);
32 }
33 }
34
35 //------------------------------------------------------------------------------------------------
36 protected void ActionTrackedLightsHiBeamToggle(float value, EActionTrigger trigger)
37 {
39 if (!pilotSlot || pilotSlot.GetOccupant() != SCR_PlayerController.GetLocalControlledEntity())
40 return;
41
42 BaseLightManagerComponent lightManager = GetLightManager();
43 if (lightManager)
44 lightManager.SetLightsState(ELightType.HiBeam, !lightManager.GetLightsState(ELightType.HiBeam));
45 }
46
47 //------------------------------------------------------------------------------------------------
48 protected void ActionVehicleLightsToggle(float value, EActionTrigger trigger)
49 {
51 if (!pilotSlot || pilotSlot.GetOccupant() != SCR_PlayerController.GetLocalControlledEntity())
52 return;
53
54 BaseLightManagerComponent lightManager = GetLightManager();
55 if (lightManager)
56 lightManager.SetLightsState(ELightType.Presence, !lightManager.GetLightsState(ELightType.Presence));
57 }
58}
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)
void ActionVehicleLightsToggle(float value, EActionTrigger trigger)
void ActionTrackedLightsHiBeamToggle(float value, EActionTrigger trigger)
PilotCompartmentSlot GetPilotCompartmentSlot()
Get primary pilot compartment slot.
Definition Vehicle.c:104
static IEntity GetLocalControlledEntity()
EActionTrigger