Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PowerPole.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Power", description: "This is the power pole entity.", color: "0 255 0 255", visible: false, dynamicBox: true)]
3 {
4 }
5 
6 class SCR_PowerPole : PowerPoleEntity
7 {
8  [Attribute(desc: "Slots for connecting with other power poles", category: "Power Cable Slots")]
9  protected ref array<ref SCR_PowerPoleSlotBase> m_aSlots;
10 
11  [Attribute(desc: "Draw debug shapes?", category: "Debug")]
12  protected bool m_bDrawDebugShapes;
13 
14  protected ref array<ref Shape> m_aDebugShapes = {};
15  protected IEntitySource m_Source;
16 
17  //------------------------------------------------------------------------------------------------
19  int GetSlotsCount(bool sameLine = true)
20  {
21  return m_aSlots.Count();
22  }
23 
24  //------------------------------------------------------------------------------------------------
26  vector GetSlot(int index, bool sameLine)
27  {
28  if (!m_aSlots.IsIndexValid(index))
29  return vector.Zero;
30 
31  return m_aSlots[index].m_vSlotA;
32  }
33 
34  //------------------------------------------------------------------------------------------------
40  vector TryGetSlot(int index, vector otherSlot, bool sameLine)
41  {
42  if (index < 0)
43  return vector.Zero;
44 
45  if (index >= m_aSlots.Count())
46  return m_aSlots[index % m_aSlots.Count()].m_vSlotA;
47 
49  if (dualSlot)
50  {
51  if (vector.Distance(otherSlot, CoordToParent(dualSlot.m_vSlotA)) > vector.Distance(otherSlot, CoordToParent(dualSlot.m_vSlotB)))
52  return CoordToParent(dualSlot.m_vSlotB);
53  else
54  return CoordToParent(dualSlot.m_vSlotA);
55  }
56 
57  SCR_PowerPoleSlotSingle singleSlot = SCR_PowerPoleSlotSingle.Cast(m_aSlots[index]);
58  if (singleSlot)
59  return CoordToParent(singleSlot.m_vSlotA);
60 
61  return vector.Zero;
62  }
63 
64  #ifdef WORKBENCH
65  //------------------------------------------------------------------------------------------------
66  override bool _WB_OnKeyChanged(BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent)
67  {
69  return false;
70  }
71  #endif
72 
73  //------------------------------------------------------------------------------------------------
74  protected void DrawDebugShapes()
75  {
76  m_aDebugShapes.Clear();
77  if (!m_bDrawDebugShapes)
78  return;
79 
80  foreach (SCR_PowerPoleSlotBase slot : m_aSlots)
81  {
82  slot.DrawDebugShapes(m_aDebugShapes, this);
83  }
84  }
85 
86  //------------------------------------------------------------------------------------------------
87  void SCR_PowerPole(IEntitySource src, IEntity parent)
88  {
90 
91  m_Source = src;
92  SetEventMask(EntityEvent.INIT);
93  }
94 }
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
Attribute
SCR_PowerPoleClass PowerPoleEntityClass Attribute(desc:"Slots for connecting with other power poles", category:"Power Cable Slots")
Definition: SCR_PowerPole.c:8
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
GetSlot
vector GetSlot(int index, bool sameLine)
Definition: SCR_PowerPole.c:26
GetSlotsCount
int GetSlotsCount(bool sameLine=true)
Definition: SCR_PowerPole.c:19
SCR_PowerPoleSlot
Definition: SCR_PowerPoleSlot.c:2
m_aSlots
protected ref array< SCR_WeaponRackSlotEntity > m_aSlots
Definition: SCR_ArsenalDisplayComponent.c:13
m_Source
protected IEntitySource m_Source
Definition: SCR_PowerPole.c:14
DrawDebugShapes
protected void DrawDebugShapes()
Definition: SCR_PowerPole.c:74
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
m_aDebugShapes
protected ref array< ref Shape > m_aDebugShapes
Definition: SCR_PowerlineGeneratorEntity.c:64
SCR_PowerPoleClass
Definition: SCR_PowerPole.c:2
TryGetSlot
vector TryGetSlot(int index, vector otherSlot, bool sameLine)
Definition: SCR_PowerPole.c:40
PowerPoleEntityClass
Definition: PowerPoleEntity.c:12
SCR_PowerPole
void SCR_PowerPole(IEntitySource src, IEntity parent)
Definition: SCR_PowerPole.c:87
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180