Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SightsHasIlluminationCondition.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  [Attribute("0", UIWidgets.CheckBox, desc: "True - find illumination of controlled turret | False - find current weapon in hand illumination")]
6  protected bool m_bCheckTurret;
7 
8  //------------------------------------------------------------------------------------------------
10  override bool IsAvailable(SCR_AvailableActionsConditionData data)
11  {
12  if (!data)
13  return false;
14 
15  SCR_2DOpticsComponent sights = null;
16 
17  if (m_bCheckTurret)
18  {
19  sights = CurrentTurretSight(data);
20  }
21  else
22  {
23  sights = CurrentWeaponSights(data);
24  }
25 
26  if (!sights)
27  return false;
28 
29  // Has illumination
30  return GetReturnResult(sights.HasIllumination());
31  }
32 
33  //------------------------------------------------------------------------------------------------
34  protected SCR_2DOpticsComponent CurrentWeaponSights(SCR_AvailableActionsConditionData data)
35  {
36  IEntity controlledEntity = SCR_PlayerController.GetLocalControlledEntity();
37  if (!controlledEntity)
38  return null;
39 
40  ChimeraCharacter character = ChimeraCharacter.Cast(controlledEntity);
41  if (!character)
42  return null;
43 
44  BaseWeaponManagerComponent weaponManager = character.GetCharacterController().GetWeaponManagerComponent();
45  if (!weaponManager)
46  return null;
47 
48  BaseSightsComponent currentSights = weaponManager.GetCurrentSights();
49  if (!currentSights)
50  return null;
51 
52  return SCR_2DOpticsComponent.Cast(currentSights);
53  }
54 
55  //------------------------------------------------------------------------------------------------
57  {
58  // Current vehicle controller
59  BaseControllerComponent controller = data.GetCurrentVehicleController();
60  if (!controller)
61  return null;
62 
63  // Turret
64  IEntity turretEntity = controller.GetOwner();
65  if (!turretEntity)
66  return null;
67 
68  TurretComponent turret = TurretComponent.Cast(turretEntity.FindComponent(TurretComponent));
69  if (!turret)
70  return null;
71 
72  // Sights
73  return SCR_2DOpticsComponent.Cast(turret.FindComponent(SCR_2DOpticsComponent));
74  }
75 };
SCR_PlayerController
Definition: SCR_PlayerController.c:31
SCR_SightsHasIlluminationCondition
Definition: SCR_SightsHasIlluminationCondition.c:3
SCR_AvailableActionsConditionData
Definition: SCR_AvailableActionsConditionData.c:5
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_2DOpticsComponent
Definition: SCR_2DOpticsComponent.c:12
SCR_AvailableActionCondition
A single available action condition representation.
Definition: SCR_AvailableActionsCondition.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468