Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BuildingDestructionManagerComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Destruction", description: "Building destruction manager, stores data for destroyed buildings.")]
5
6class SCR_BuildingDestructionData
7{
22 ref array<IEntity> m_aQueriedEntities;
24 ref array<IEntity> m_aExcludeList;
25 ref array<ref Tuple2<vector, vector>> m_aNavmeshAreas;
26 ref array<bool> m_aRedoRoads;
27 ref SCR_BuildingDestructionCameraShakeProgress m_CameraShake = InitCameraShake();
31
32 //------------------------------------------------------------------------------------------------
34 void Reset()
35 {
38 Math3D.MatrixIdentity4(m_vStartMatrix);
44 m_iPauseTime = 0;
49 m_aQueriedEntities = null;
51 m_aExcludeList = null;
52 m_aNavmeshAreas = null;
53 m_aRedoRoads = null;
54 m_CameraShake = InitCameraShake();
55 m_AudioSource = null;
57 }
58
59 static SCR_BuildingDestructionCameraShakeProgress InitCameraShake()
60 {
61 // No camera shake for headless
62 if (System.IsConsoleApp())
63 return null;
64
65 return new SCR_BuildingDestructionCameraShakeProgress();
66 }
67}
68
69class SCR_BuildingDestructionManagerComponent : ScriptComponent
70{
71 [Attribute()]
73
74 private int m_iFirstFreeData = -1;
75 private ref array<ref SCR_BuildingDestructionData> m_aBuildingDestructionData = {};
76
77 protected ref array<SCR_DestructibleBuildingComponent> m_aDestroyedBuildings = {};
78 protected static int s_iHighestId;
80
81 //------------------------------------------------------------------------------------------------
84 notnull SCR_BuildingDestructionData GetData(inout int index)
85 {
86 if (index == -1)
87 index = AllocateData();
88
89 return m_aBuildingDestructionData[index];
90 }
91
92 //------------------------------------------------------------------------------------------------
95 private int AllocateData()
96 {
97 if (m_iFirstFreeData == -1)
98 return m_aBuildingDestructionData.Insert(new SCR_BuildingDestructionData());
99
100 int returnIndex = m_iFirstFreeData;
101 SCR_BuildingDestructionData data = m_aBuildingDestructionData[returnIndex];
102 m_iFirstFreeData = data.m_iNextFreeIndex;
103 data.m_iNextFreeIndex = -1;
104 return returnIndex;
105 }
106
107 //------------------------------------------------------------------------------------------------
110 void FreeData(int index)
111 {
112 // If you got a VME here, please report it only if you didn't touch the array/index
113 // Otherwise no guarantees
114 m_aBuildingDestructionData[index].Reset();
115 m_aBuildingDestructionData[index].m_iNextFreeIndex = m_iFirstFreeData;
116 m_iFirstFreeData = index;
117 }
118
119 //------------------------------------------------------------------------------------------------
121 array<typename> GetExcludedQueryTypes()
122 {
123 array<typename> outArray = {};
125 return outArray;
126 else
127 outArray.Copy(m_BuildingDestructionConfig.m_aExcludedEntityQueryTypenames);
128
129 return outArray;
130 }
131
132 //------------------------------------------------------------------------------------------------
133 void SCR_BuildingDestructionManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
134 {
135 GetGame().RegisterBuildingDestructionManager(this);
136 }
137
138 //------------------------------------------------------------------------------------------------
139 // destructor
140 void ~SCR_BuildingDestructionManagerComponent()
141 {
142 GetGame().UnregisterBuildingDestructionManager(this);
143 }
144}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_AudioSource(SCR_AudioSourceConfiguration audioSourceConfiguration, vector mat[4])
ref array< IEntity > m_aExcludeList
SCR_AudioSource m_AudioSource
ref SCR_BuildingDestructionCameraShakeProgress m_CameraShake
ref array< ref Tuple2< vector, vector > > m_aNavmeshAreas
ref set< int > m_aExecutedEffectIndices
ref array< bool > m_aRedoRoads
SCR_BuildingDestructionManagerComponentClass m_iNextFreeIndex
ref RandomGenerator m_RandomGenerator
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
ref array< IEntity > m_aQueriedEntities
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Get all prefabs that have the spawner data
enum EVehicleType IEntity
ref array< SCR_DestructibleBuildingComponent > m_aDestroyedBuildings
static ref map< int, SCR_DestructibleBuildingComponent > s_mBuildingIds
notnull SCR_BuildingDestructionData GetData(inout int index)
Definition Types.c:486
SCR_FieldOfViewSettings Attribute
void Reset()