Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SwitchLightUserAction.c
Go to the documentation of this file.
1//simple script for control lights
2
4{
5 [Attribute("", UIWidgets.EditBox, "Description for action menu (light up)", "")]
7 [Attribute("", UIWidgets.EditBox, "Description for action menu (extinguish)", "")]
9
10 protected SCR_BaseInteractiveLightComponent m_LightComp;
11 //------------------------------------------------------------------------------------------------
12 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
13 {
14 m_LightComp = SCR_BaseInteractiveLightComponent.Cast(pOwnerEntity.FindComponent(SCR_BaseInteractiveLightComponent));
15 }
16
17 //------------------------------------------------------------------------------------------------
18 override bool CanBeShownScript(IEntity user)
19 {
20 if (!m_LightComp)
21 return false;
22
23 return true;
24 }
25
26 //------------------------------------------------------------------------------------------------
27 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
28 {
29 if (m_LightComp)
30 m_LightComp.ToggleLight(!m_LightComp.IsOn());
31 }
32
33 //------------------------------------------------------------------------------------------------
34 override bool GetActionNameScript(out string outName)
35 {
36 if (!m_LightComp)
37 return false;
38
39 if (m_LightComp.IsOn())
41 else
42 outName = m_sLightDescription;
43
44 return true;
45 }
46};
proto external Managed FindComponent(typename typeName)
override bool CanBeShownScript(IEntity user)
override bool GetActionNameScript(out string outName)
SCR_BaseInteractiveLightComponent m_LightComp
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
SCR_FieldOfViewSettings Attribute