Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
EntitySlotInfo.c
Go to the documentation of this file.
1 /*
2 ===========================================
3 Do not modify, this script is generated
4 ===========================================
5 */
6 
8 class EntitySlotInfo: PointInfo
9 {
10  private ref ScriptInvokerEntity AttachedEntityInvoker;
11  private ref ScriptInvokerEntity DetachedEntityInvoker;
12  ScriptInvokerEntity GetAttachedEntityInvoker()
13  {
14  if (!AttachedEntityInvoker)
15  AttachedEntityInvoker = new ScriptInvokerEntity();
16  return AttachedEntityInvoker;
17  }
18  ScriptInvokerEntity GetDetachedEntityInvoker()
19  {
20  if (!DetachedEntityInvoker)
21  DetachedEntityInvoker = new ScriptInvokerEntity();
22  return DetachedEntityInvoker;
23  }
24  //@TODO(Leo): find out why it is needed and refactor to cpp, everything is accessible here
28  static EntitySlotInfo GetSlotInfo(notnull IEntity entity)
29  {
30  IEntity parent = entity.GetParent();
31  if (!parent)
32  return null;
33 
34  // Check slot managers
35  array<Managed> slotManagers = {};
36  parent.FindComponents(SlotManagerComponent, slotManagers);
37  foreach (Managed managed : slotManagers)
38  {
39  SlotManagerComponent slotManager = SlotManagerComponent.Cast(managed);
40  array<EntitySlotInfo> managerSlotInfos = {};
41  slotManager.GetSlotInfos(managerSlotInfos);
42  foreach (EntitySlotInfo slotInfo : managerSlotInfos)
43  {
44  if (slotInfo && slotInfo.GetAttachedEntity() == entity)
45  return slotInfo;
46  }
47  }
48 
49  // Check individual slot components
50  array<Managed> slots = {};
51  parent.FindComponents(BaseSlotComponent, slots);
52  foreach (Managed managed : slots)
53  {
54  BaseSlotComponent slot = BaseSlotComponent.Cast(managed);
55  EntitySlotInfo slotInfo = slot.GetSlotInfo();
56  if (slotInfo && slotInfo.GetAttachedEntity() == entity)
57  return slotInfo;
58  }
59 
60  // Check weapon slot components
61  array<Managed> weaponSlots = {};
62  parent.FindComponents(WeaponSlotComponent, weaponSlots);
63  foreach (Managed managed : weaponSlots)
64  {
65  WeaponSlotComponent slot = WeaponSlotComponent.Cast(managed);
66  EntitySlotInfo slotInfo = slot.GetSlotInfo();
67  if (slotInfo && slotInfo.GetAttachedEntity() == entity)
68  return slotInfo;
69  }
70 
71  return null;
72  }
73 
74  //------------------------------------------------------------------------------------------------
79  static void GetSlotInfos(notnull IEntity entity, inout notnull array<EntitySlotInfo> slotInfos)
80  {
81  // Get slot infos of slot managers
82  array<Managed> slotManagers = {};
83  entity.FindComponents(SlotManagerComponent, slotManagers);
84  foreach (Managed managed : slotManagers)
85  {
86  SlotManagerComponent slotManager = SlotManagerComponent.Cast(managed);
87  array<EntitySlotInfo> managerSlotInfos = {};
88  slotManager.GetSlotInfos(managerSlotInfos);
89  foreach (EntitySlotInfo slotInfo : managerSlotInfos)
90  {
91  if (slotInfo)
92  slotInfos.Insert(slotInfo);
93  }
94  }
95 
96  // Get slot info of individual slot components
97  array<Managed> slotComponents = {};
98  entity.FindComponents(BaseSlotComponent, slotComponents);
99  foreach (Managed managed : slotComponents)
100  {
101  BaseSlotComponent slot = BaseSlotComponent.Cast(managed);
102  EntitySlotInfo slotInfo = slot.GetSlotInfo();
103  if (slotInfo)
104  slotInfos.Insert(slotInfo);
105  }
106 
107  // Get slot info of individual weapon slot components
108  array<Managed> weaponSlotComponents = {};
109  entity.FindComponents(WeaponSlotComponent, weaponSlotComponents);
110  foreach (Managed managed : weaponSlotComponents)
111  {
112  WeaponSlotComponent slot = WeaponSlotComponent.Cast(managed);
113  EntitySlotInfo slotInfo = slot.GetSlotInfo();
114  if (slotInfo)
115  slotInfos.Insert(slotInfo);
116  }
117  }
118 
119  proto external bool IsEnabled();
121  proto external IEntity GetAttachedEntity();
123  proto external string GetSourceName();
128  proto external void SetAdditiveTransformLS(vector matLS[4]);
133  proto external void OverrideTransformLS(vector matLS[4]);
138  proto external void DetachEntity(bool physicalChange = true);
144  proto external void AttachEntity(IEntity entity);
145 
146  // callbacks
147 
149  event void OnAttachedEntity(IEntity entity) { if (AttachedEntityInvoker) AttachedEntityInvoker.Invoke(entity); };
151  event void OnDetachedEntity(IEntity entity) { if (DetachedEntityInvoker) DetachedEntityInvoker.Invoke(entity); };
152 }
WeaponSlotComponent
Definition: WeaponSlotComponent.c:12
EntitySlotInfo
Adds ability to attach an object to a slot.
Definition: EntitySlotInfo.c:8
ScriptInvokerEntity
ScriptInvokerBase< ScriptInvokerEntityMethod > ScriptInvokerEntity
Definition: SCR_ScriptInvokerHelper.c:92