DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ConstructionManagerStatic.c
См. документацию.
1
4{
5 protected static const int UPDATE_QUEUE_BATCH_SIZE_DEFAULT = 15; //parts processed in a single simulation step
6
7 protected static bool m_Initialized;
8 protected static bool m_IsServerBatchProcessing; //is server?
9 protected static ScriptInvoker m_UpdateQueue;
12
13 static void Init()
14 {
15 if (!m_Initialized)
16 {
18 m_IsServerBatchProcessing = g_Game.IsServer() || !g_Game.IsMultiplayer();
21 m_Initialized = true;
22 }
23 }
24
25 //============================================
26 // Batching and processing
27 //============================================
28
30 //API
31
33 {
34 if (!m_Initialized)
35 Init();
36
38 if (!m_QueueConstructionMap.Find(con, tmp))
39 tmp = new array<ConstructionPart>();
40
41 if (tmp.Find(part) == -1)
42 tmp.Insert(part);
43
44 m_QueueConstructionMap.Set(con, tmp);
45
46 if (m_UpdateQueue.Count(ProcessUpdateQueues) == 0)
48 }
49
52 {
53 if (m_QueueConstructionMap.Contains(con))
54 m_QueueConstructionMap.Remove(con);
55 }
56
58 //Internals
59
60 protected static void ProcessUpdateQueues()
61 {
62 int batchCounter = UPDATE_QUEUE_BATCH_SIZE_DEFAULT;
63 int count;
64
66 {
67 if (batchCounter == 0)
68 break;
69
70 count = updatePartsArray.Count();
71 for (int i = count - 1; i > -1; --i)
72 {
73 if (batchCounter == 0)
74 break;
75
76 ConstructionPart part = updatePartsArray[i];
77 con.UpdateSpecificPartPhysics(part);
79 con.UpdateSpecificPartVisuals(part);
80
81 updatePartsArray.Remove(i);
82 --batchCounter;
83
84 if (updatePartsArray.Count() == 0)
85 {
86 m_CleanupQueue.Insert(con);
87 break;
88 }
89 }
90 }
91
92 foreach (ConstructionBase cleanupCon : m_CleanupQueue)
93 {
95 cleanupCon.UpdateNavmesh();
96 m_QueueConstructionMap.Remove(cleanupCon);
97 }
98
99 m_CleanupQueue.Clear();
100
101 if (m_QueueConstructionMap.Count() == 0 && m_UpdateQueue.Count(ProcessUpdateQueues) > 0)
102 {
105 }
106 }
107}
void ConstructionBase(EntityAI parent)
Определения ConstructionBase.c:58
DayZGame g_Game
Определения DayZGame.c:4074
static ref map< ConstructionBase, ref array< ConstructionPart > > m_QueueConstructionMap
Определения ConstructionManagerStatic.c:10
static bool m_Initialized
Определения ConstructionManagerStatic.c:7
static void Init()
Определения ConstructionManagerStatic.c:13
static void ProcessUpdateQueues()
Определения ConstructionManagerStatic.c:60
static bool m_IsServerBatchProcessing
Определения ConstructionManagerStatic.c:8
static const int UPDATE_QUEUE_BATCH_SIZE_DEFAULT
Определения ConstructionManagerStatic.c:5
static void AddPartToProcess(ConstructionBase con, ConstructionPart part)
Определения ConstructionManagerStatic.c:32
static ScriptInvoker m_UpdateQueue
Определения ConstructionManagerStatic.c:9
static void RemoveFromProcessing(ConstructionBase con)
Unremoved objects can become NULL.
Определения ConstructionManagerStatic.c:51
static ref array< ConstructionBase > m_CleanupQueue
Определения ConstructionManagerStatic.c:11
Static part of the construction system, for global handling mostly.
Определения ConstructionManagerStatic.c:4
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Определения ConstructionPart.c:4
ScriptInvoker Class provide list of callbacks usage:
Определения 2_GameLib/DayZ/tools.c:116
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения Transport.c:70
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8