Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CampaignMHQLockComponent.c
Go to the documentation of this file.
4
5class SCR_CampaignMHQLockComponent : SCR_BaseLockComponent
6{
7 protected SCR_CampaignMobileAssemblyComponent m_MHQComponent;
8
9 //------------------------------------------------------------------------------------------------
11 SCR_CampaignMobileAssemblyComponent GetMHQComponent()
12 {
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
37 break;
38 }
39
40 return m_MHQComponent;
41 }
42
43 //------------------------------------------------------------------------------------------------
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}
LocalizedString GetCannotPerformReason(IEntity user)
bool IsLocked(IEntity user, BaseCompartmentSlot compartmentSlot)
SCR_CampaignMobileAssemblyComponent GetMHQComponent()
SCR_CampaignMHQLockComponentClass m_MHQComponent
Adds ability to attach an object to a slot.
proto external Managed FindComponent(typename typeName)
IEntity GetOwner()
Owner entity of the fuel tank.