Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CampaignMHQLockComponent.c
Go to the documentation of this file.
2 {
3 }
4 
5 class SCR_CampaignMHQLockComponent : SCR_BaseLockComponent
6 {
7  protected SCR_CampaignMobileAssemblyComponent m_MHQComponent;
8 
9  //------------------------------------------------------------------------------------------------
11  SCR_CampaignMobileAssemblyComponent GetMHQComponent()
12  {
13  if (m_MHQComponent)
14  return m_MHQComponent;
15 
16  SlotManagerComponent slotManager = SlotManagerComponent.Cast(GetOwner().FindComponent(SlotManagerComponent));
17 
18  if (!slotManager)
19  return null;
20 
21  array<EntitySlotInfo> slots = {};
22  slotManager.GetSlotInfos(slots);
23 
24  foreach (EntitySlotInfo slot : slots)
25  {
26  if (!slot)
27  continue;
28 
29  IEntity truckBed = slot.GetAttachedEntity();
30 
31  if (!truckBed)
32  continue;
33 
34  m_MHQComponent = SCR_CampaignMobileAssemblyComponent.Cast(truckBed.FindComponent(SCR_CampaignMobileAssemblyComponent));
35 
36  if (m_MHQComponent)
37  break;
38  }
39 
40  return m_MHQComponent;
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  override LocalizedString GetCannotPerformReason(IEntity user)
45  {
46  SCR_CampaignMobileAssemblyComponent comp = GetMHQComponent();
47 
48  if (comp && comp.IsDeployed())
49  return "#AR-Campaign_MobileAssemblyDeployed-UC";
50  else
51  return super.GetCannotPerformReason(user);
52  }
53 
54  //------------------------------------------------------------------------------------------------
55  override bool IsLocked(IEntity user, BaseCompartmentSlot compartmentSlot)
56  {
57  if (super.IsLocked(user, compartmentSlot))
58  return true;
59 
60  SCR_CampaignMobileAssemblyComponent comp = GetMHQComponent();
61 
62  if (comp)
63  return comp.IsDeployed();
64 
65  return false;
66  }
67 }
SCR_BaseLockComponentClass
Definition: SCR_BaseLockComponent.c:2
SCR_CampaignMHQLockComponentClass
Definition: SCR_CampaignMHQLockComponent.c:1
EntitySlotInfo
Adds ability to attach an object to a slot.
Definition: EntitySlotInfo.c:8
m_MHQComponent
SCR_CampaignMHQLockComponentClass m_MHQComponent
GetMHQComponent
SCR_CampaignMobileAssemblyComponent GetMHQComponent()
Definition: SCR_CampaignMHQLockComponent.c:11
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
GetCannotPerformReason
override LocalizedString GetCannotPerformReason(IEntity user)
Definition: SCR_CampaignMHQLockComponent.c:44
IsLocked
override bool IsLocked(IEntity user, BaseCompartmentSlot compartmentSlot)
Definition: SCR_CampaignMHQLockComponent.c:55
LocalizedString
Definition: LocalizedString.c:21