DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ValidatePlayerRestrictedAreaPositions()

bool PlayerRestrictedAreaInstance::ValidatePlayerRestrictedAreaPositions ( )
inlineprivate

См. определение в файле CfgPlayerRestrictedAreaJsonData.c строка 89

90 {
91 if (PRABoxes.Count() == 0 && PRAPolygons.Count() == 0)
92 {
93 Debug.Log("No valid coordinates in 'PRABoxes' or 'PRAPolygons' for area: " + areaName,"n/a","n/a","","PlayerRestrictedAreaInstance");
94 return false;
95 }
96
97 float xMin,zMin = float.MAX;
98 float xMax,zMax = float.MIN;
99
100 foreach (array<ref array<float>> boxFloatsData : PRABoxes)
101 {
102 if (boxFloatsData.Count() != 3)
103 {
104 Debug.Log("Invalid box defined in " + areaName + ". Box needs to have sizes, rotation, and position defined!","n/a","n/a","","PlayerRestrictedAreaInstance");
105 return false;
106 }
107
108 array<float> boxVectors;
109 //sizes
110 boxVectors = boxFloatsData[0];
111 if (boxVectors.Count() != 3)
112 {
113 Debug.Log("Invalid box defined in " + areaName + ". Box size needs to be in an XYZ format!","n/a","n/a","","PlayerRestrictedAreaInstance");
114 return false;
115 }
116
117 //rotation
118 boxVectors = boxFloatsData[1];
119 if (boxVectors.Count() != 3)
120 {
121 Debug.Log("Invalid box defined in " + areaName + ". Box rotation needs to be in an XYZ format!","n/a","n/a","","PlayerRestrictedAreaInstance");
122 return false;
123 }
124
125 //position
126 boxVectors = boxFloatsData[2];
127 if (boxVectors.Count() != 3)
128 {
129 Debug.Log("Invalid box defined in " + areaName + ". Box position needs to be in an XYZ format!","n/a","n/a","","PlayerRestrictedAreaInstance");
130 return false;
131 }
132
133 //translate to data
134 PRAShapeBoxData dta = new PRAShapeBoxData(boxFloatsData);
135 if (dta)
136 {
137 m_PRABoxDataTranslated.Insert(dta);
138
139 xMin = Math.Min(xMin,dta.m_Mins[0]);
140 zMin = Math.Min(zMin,dta.m_Mins[2]);
141 xMax = Math.Max(xMax,dta.m_Maxs[0]);
142 zMax = Math.Max(zMax,dta.m_Maxs[2]);
143 }
144 }
145
146 foreach (array<ref array<float>> polygonData : PRAPolygons)
147 {
148 if (polygonData.Count() < 3)
149 {
150 Debug.Log("Invalid polygon defined in " + areaName + ". At least 3 points necessary!","n/a","n/a","","PlayerRestrictedAreaInstance");
151 return false;
152 }
153
154 foreach (array<float> polygonCoords : polygonData)
155 {
156 if (polygonCoords.Count() != 2)
157 {
158 Debug.Log("Invalid polygon defined in " + areaName + ". Polygon coordinates need to be in a XZ format!","n/a","n/a","","PlayerRestrictedAreaInstance");
159 return false;
160 }
161
162 xMin = Math.Min(xMin,polygonCoords[0]);
163 zMin = Math.Min(zMin,polygonCoords[1]);
164 xMax = Math.Max(xMax,polygonCoords[0]);
165 zMax = Math.Max(zMax,polygonCoords[1]);
166 }
167 }
168
169 m_CenterPos2D = Vector(((xMin + xMax) / 2), 0, ((zMin + zMax) / 2));
170
171 return true;
172 }
void Debug()
Определения UniversalTemperatureSource.c:349
ref array< ref array< ref array< float > > > PRABoxes
ref array< ref PRAShapeBoxData > m_PRABoxDataTranslated
ref array< ref array< ref array< float > > > PRAPolygons
3D, not used directly!
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

Перекрестные ссылки areaName, Debug::Log(), m_CenterPos2D, m_PRABoxDataTranslated, Math::Max(), Math::Min(), PRABoxes, PRAPolygons и Vector().

Используется в Initialize().