Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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)", "")]
6  protected LocalizedString m_sLightDescription;
7  [Attribute("", UIWidgets.EditBox, "Description for action menu (extinguish)", "")]
8  protected LocalizedString m_sExtinguishDescription;
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())
40  outName = m_sExtinguishDescription;
41  else
42  outName = m_sLightDescription;
43 
44  return true;
45  }
46 };
ScriptedUserAction
Definition: ScriptedUserAction.c:12
SCR_SwitchLightUserAction
Definition: SCR_SwitchLightUserAction.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
LocalizedString
Definition: LocalizedString.c:21