Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_LightsHazardUserAction.c
Go to the documentation of this file.
1 class SCR_LightsHazardUserAction : LightUserAction
2 {
3  //------------------------------------------------------------------------------------------------
4  override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
5  {
6  if (!pOwnerEntity || !pUserEntity)
7  return;
8 
9  BaseLightManagerComponent lightManager = GetLightManager();
10  if (!lightManager)
11  return;
12 
13  bool lightsState;
14 
15  lightsState = lightManager.GetLightsState(ELightType.Hazard);
16 
17  if (RplSession.Mode() != RplMode.Client)
18  lightsState = !lightsState;
19 
20  lightManager.SetLightsState(ELightType.Hazard, lightsState);
21 
22  // Sound
23  PlaySound(pOwnerEntity, lightsState);
24  }
25 
26  //------------------------------------------------------------------------------------------------
27  override bool GetActionNameScript(out string outName)
28  {
29  BaseLightManagerComponent lightManager = GetLightManager();
30 
31  auto prefix = "";
32  UIInfo actionInfo = GetUIInfo();
33  if(actionInfo)
34  prefix = actionInfo.GetName() + " ";
35 
36  if (lightManager && lightManager.GetLightsState(ELightType.Hazard))
37  outName = prefix + "#AR-UserAction_State_Off";
38  else
39  outName = prefix + "#AR-UserAction_State_On";
40 
41  return true;
42  }
43 };
PlaySound
SCR_ParticleContactComponentClass ScriptComponentClass PlaySound(IEntity owner, SCR_ParticleContactComponentClass prefabData, Contact contact)
Definition: SCR_ParticleContactComponent.c:38
GetLightManager
proto external BaseLightManagerComponent GetLightManager()
Returns the light manager associated with this controller.
UIInfo
UIInfo - declare object, allows to define UI elements.
Definition: UIInfo.c:13
GetUIInfo
SCR_UIInfo GetUIInfo()
Definition: SCR_EditableEntityCampaignBuildingModeLabelSetting.c:27
ELightType
ELightType
Definition: ELightType.c:7
SCR_LightsHazardUserAction
Definition: SCR_LightsHazardUserAction.c:1