1 [
EntityEditorProps(
category:
"GameScripted/Power", description:
"This is the power pole entity.", color:
"0 255 0 255", visible:
false, dynamicBox:
true)]
8 [
Attribute(
desc:
"Slots for connecting with other power poles in a junction",
category:
"Power Cable Slots")]
9 protected ref array<ref SCR_PowerPoleSlotBase> m_aJunctionSlots;
14 super.DrawDebugShapes();
16 if (!m_bDrawDebugShapes)
19 foreach (SCR_PowerPoleSlotBase slot : m_aJunctionSlots)
29 return super.GetSlot(
index, sameLine);
31 return m_aJunctionSlots[
index].m_vSlotA;
40 return m_aJunctionSlots.Count();
47 return super.TryGetSlot(
index, otherSlot, sameLine);
49 int junctionCount = m_aJunctionSlots.Count();
50 if (
index >= junctionCount)
59 for (
int i; i < junctionCount; i++)
61 avgSideA += m_aJunctionSlots[i].m_vSlotA;
63 if (powerPoleJunction)
64 avgSideB += powerPoleJunction.m_vSlotB;
67 avgSideA /= (float)junctionCount;
68 avgSideB /= (float)junctionCount;
70 if (avgSideB == vector.Zero || vector.Distance(otherSlot, CoordToParent(avgSideA)) <= vector.Distance(otherSlot, CoordToParent(avgSideB)))
71 return CoordToParent(dualSlot.m_vSlotA);
73 return CoordToParent(dualSlot.m_vSlotB);
76 SCR_PowerPoleSlotSingle singleSlot = SCR_PowerPoleSlotSingle.Cast(m_aJunctionSlots[
index]);
78 return CoordToParent(singleSlot.m_vSlotA);