Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WeaponChangeSwitchOpticsCondition.c
Go to the documentation of this file.
3 {
4  //------------------------------------------------------------------------------------------------
6  override bool IsAvailable(SCR_AvailableActionsConditionData data)
7  {
8  if (!data)
9  return false;
10 
11  IEntity controlledEntity = SCR_PlayerController.GetLocalControlledEntity();
12  if (!controlledEntity)
13  return null;
14 
15  ChimeraCharacter character = ChimeraCharacter.Cast(controlledEntity);
16  if (!character)
17  return null;
18 
19  BaseWeaponManagerComponent weaponManager = character.GetCharacterController().GetWeaponManagerComponent();
20  if (!weaponManager)
21  return null;
22 
23  BaseWeaponComponent currentSights = weaponManager.GetCurrentWeapon();
24  if (!currentSights)
25  return null;
26 
27  bool canSwitchOptics;
28 
29  if (currentSights.FindAvailableSights() == 0)
30  canSwitchOptics = currentSights.CanSetSights(1);
31  else if(currentSights.FindAvailableSights() == 1)
32  canSwitchOptics = currentSights.CanSetSights(0);
33 
34  return canSwitchOptics;
35  }
36 };
SCR_PlayerController
Definition: SCR_PlayerController.c:31
SCR_AvailableActionsConditionData
Definition: SCR_AvailableActionsConditionData.c:5
SCR_AvailableActionCondition
A single available action condition representation.
Definition: SCR_AvailableActionsCondition.c:3
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12
SCR_WeaponChangeSwitchOpticsCondition
Definition: SCR_WeaponChangeSwitchOpticsCondition.c:2
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