Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VehicleInventoryStorageManagerComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/UI/Inventory")]
5
6class SCR_VehicleInventoryStorageManagerComponent : ScriptedInventoryStorageManagerComponent
7{
8 //------------------------------------------------------------------------------------------------
9 protected override void FillInitialStorages(out array<BaseInventoryStorageComponent> storagesToAdd)
10 {
11 super.FillInitialStorages(storagesToAdd);
12
13 if (!GetGame().InPlayMode())
14 return;
15
16 SlotManagerComponent slotManager = SlotManagerComponent.Cast(GetOwner().FindComponent(SlotManagerComponent));
17 if (!slotManager)
18 return;
19
20 array<EntitySlotInfo> slots = {};
21 slotManager.GetSlotInfos(slots);
22
23 foreach (EntitySlotInfo info : slots)
24 {
25 info.GetAttachedEntityInvoker().Insert(OnEntityAttached);
26
27 IEntity ent = info.GetAttachedEntity();
28 if (!ent)
29 continue;
30
31 BaseInventoryStorageComponent invComp = BaseInventoryStorageComponent.Cast(ent.FindComponent(BaseInventoryStorageComponent));
32 if (invComp)
33 {
34 storagesToAdd.Insert(invComp);
35 }
36 }
37 }
38
39 protected void OnEntityAttached(IEntity ent)
40 {
41 BaseInventoryStorageComponent invComp = BaseInventoryStorageComponent.Cast(ent.FindComponent(BaseInventoryStorageComponent));
42 if (invComp)
43 {
44 AddStorage(invComp);
45 }
46 }
47
48 protected override void OnDelete(IEntity owner)
49 {
50 super.OnDelete(owner);
51
52 SlotManagerComponent slotManager = SlotManagerComponent.Cast(owner.FindComponent(SlotManagerComponent));
53 if (!slotManager)
54 return;
55
56 array<EntitySlotInfo> slots = {};
57 slotManager.GetSlotInfos(slots);
58
59 foreach (EntitySlotInfo info : slots)
60 {
61 info.GetAttachedEntityInvoker().Remove(OnEntityAttached);
62 }
63 }
64}
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_TurretInventoryStorageManagerComponentClass SCR_InventoryStorageManagerComponentClass FillInitialStorages(out array< BaseInventoryStorageComponent > storagesToAdd)
void OnEntityAttached(IEntity ent)
enum EVehicleType IEntity
Adds ability to attach an object to a slot.
proto external Managed FindComponent(typename typeName)
IEntity GetOwner()
Owner entity of the fuel tank.