Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_LightManagerInfo.c
Go to the documentation of this file.
2{
3 [Attribute(SCR_Enum.GetDefault(ELightType.NoLight), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(ELightType))]
5
6 [Attribute(SCR_Enum.GetDefault(ELightType.NoLight), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(ELightType))]
8
9 [Attribute("-1", uiwidget: UIWidgets.ComboBox, enums: { ParamEnum("Either", "-1"), ParamEnum("Left", "0"), ParamEnum("Right", "1")})]
10 protected int m_iLightSide;
11
15
16 protected bool m_bIsLit = true;
17
18 //------------------------------------------------------------------------------------------------
21 {
22 // Light manager does not have events yet
23 bool isSuppressed;
24 if (m_eSuppressedBy != ELightType.NoLight)
25 isSuppressed = m_LightManager && m_LightManager.GetLightsState(m_eSuppressedBy, m_iLightSide);
26
27 // TODO: Beam lights should be dark blue!
28 if (m_bIsLit && !isSuppressed && m_LightManager && m_LightManager.GetLightsState(m_eLightType, m_iLightSide))
29 return EVehicleInfoState.ENABLED;
30 else
31 return EVehicleInfoState.DISABLED;
32 }
33
34 //------------------------------------------------------------------------------------------------
35 override bool DisplayStartDrawInit(IEntity owner)
36 {
37 // Terminate if there is no light manager
38 if (!m_LightManager)
39 return false;
40
41 array<BaseLightSlot> outLights = new array<BaseLightSlot>;
42 int iLights = m_LightManager.GetLights(outLights);
43
44 BaseLightSlot lightSlot;
45 ELightType lightType;
46 int lightSide;
47
48 for (int i = 0; i < iLights; i++)
49 {
50 lightSlot = outLights.Get(i);
51
52 lightType = lightSlot.GetLightType();
53 lightSide = lightSlot.GetLightSide();
54
55 if ((m_eLightType == lightType) && (m_iLightSide == -1 || m_iLightSide == lightSide))
56 {
57 #ifdef DEBUG_VEHICLE_UI
58 PrintFormat("[%1] BaseLightSlot detected %2 | type: %3 | side: %4", i, lightSlot, lightType, lightSide);
59 #endif
60
61 m_LightSlot = lightSlot;
62
63 if (SCR_LightSlot.Cast(m_LightSlot))
65
66 break;
67 };
68 }
69
70 // Terminate if there is no light slot associated with the setup
71 if (!m_LightSlot)
72 return false;
73
74 // Add monitoring of light states changes
77
78 return super.DisplayStartDrawInit(owner);
79 }
80
81 //------------------------------------------------------------------------------------------------
82 override void DisplayStopDraw(IEntity owner)
83 {
84 // Remove monitoring of light states changes
87
88 super.DisplayStopDraw(owner);
89 }
90
91 //------------------------------------------------------------------------------------------------
93 void OnLightStateChanged(bool state)
94 {
95 m_bIsLit = state;
96
97 #ifdef DEBUG_VEHICLE_UI
98 PrintFormat("%1 OnLightStateChanged: %2", this, m_bIsLit);
99 #endif
100 }
101
102 //------------------------------------------------------------------------------------------------
104 override void DisplayInit(IEntity owner)
105 {
106 super.DisplayInit(owner);
107
109 }
110}
ELightType
Definition ELightType.c:8
EVehicleInfoState
UI indicator state, controlling colors and opacity.
proto external Managed FindComponent(typename typeName)
Base class for all vehicle UI state and damage indicators.
void OnLightStateChanged(bool state)
bool m_bIsLit
Used for directional/hazard lights that blink.
override EVehicleInfoState GetState()
Can be overridden to get state of actual system or linked to an event.
ref ScriptInvoker m_OnLightStateChanged
override void DisplayStopDraw(IEntity owner)
override bool DisplayStartDrawInit(IEntity owner)
BaseLightManagerComponent m_LightManager
override void DisplayInit(IEntity owner)
Init the UI, runs 1x at the start of the game.
ScriptInvoker GetOnLightStateChanged()
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134