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

Закрытые члены

void Initialize ()
 
bool ValidatePlayerRestrictedAreaPositions ()
 
bool TranslateSafePositions ()
 
bool IsValid ()
 
vector GetCenterPos2D ()
 
vector GetClosestSafePos3D (vector targetPos)
 
vector GetRandomSafePos3D (vector targetPos)
 

Закрытые данные

bool m_IsValid = false
 
int m_LastUsedSafePosIdx = -1
 
ref array< vectorm_TranslatedSafePositions3D
 
ref array< vectorm_RandomizedSafePositions3D
 
vector m_CenterPos2D
 
string areaName = ""
 
ref array< ref array< ref array< float > > > PRABoxes = new array<ref array<ref array<float>>>
 
ref array< ref array< ref array< float > > > PRAPolygons = new array<ref array<ref array<float>>>
 3D, not used directly!
 
ref array< ref array< float > > safePositions2D = new array<ref array<float>>
 
ref array< ref array< float > > safePositions3D = new array<ref array<float>>
 
ref array< ref PRAShapeBoxDatam_PRABoxDataTranslated = new array<ref PRAShapeBoxData>
 

Подробное описание

Методы

◆ GetCenterPos2D()

vector GetCenterPos2D ( )
inlineprivate
203 {
204 return m_CenterPos2D;
205 }
vector m_CenterPos2D
Definition CfgPlayerRestrictedAreaJsonData.c:68

Перекрестные ссылки m_CenterPos2D.

◆ GetClosestSafePos3D()

vector GetClosestSafePos3D ( vector targetPos)
inlineprivate
211 {
213 float smallestDist = float.MAX;
214 float dist;
215
216 foreach (vector pos : m_TranslatedSafePositions3D)
217 {
219 if (dist < smallestDist)
220 {
222 closestPos = pos;
223 }
224 }
225 return closestPos;
226 }
Definition EntityAI.c:95
ref array< vector > m_TranslatedSafePositions3D
Definition CfgPlayerRestrictedAreaJsonData.c:65
Definition EnConvert.c:106
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.

Перекрестные ссылки vector::DistanceSq() и m_TranslatedSafePositions3D.

◆ GetRandomSafePos3D()

vector GetRandomSafePos3D ( vector targetPos)
inlineprivate
229 {
231 {
235 }
236
239
241 {
242 m_RandomizedSafePositions3D.ShuffleArray();
244 }
245
247 }
int m_LastUsedSafePosIdx
Definition CfgPlayerRestrictedAreaJsonData.c:64
ref array< vector > m_RandomizedSafePositions3D
Definition CfgPlayerRestrictedAreaJsonData.c:66

Перекрестные ссылки m_LastUsedSafePosIdx, m_RandomizedSafePositions3D и m_TranslatedSafePositions3D.

◆ Initialize()

void Initialize ( )
inlineprivate
80 {
81 if (m_IsValid)
82 return;
83
84 m_IsValid = false;
87 }
bool TranslateSafePositions()
Definition CfgPlayerRestrictedAreaJsonData.c:174
bool ValidatePlayerRestrictedAreaPositions()
Definition CfgPlayerRestrictedAreaJsonData.c:89
bool m_IsValid
Definition CfgPlayerRestrictedAreaJsonData.c:63

Перекрестные ссылки m_IsValid, TranslateSafePositions() и ValidatePlayerRestrictedAreaPositions().

◆ IsValid()

bool IsValid ( )
inlineprivate
198 {
199 return m_IsValid;
200 }

Перекрестные ссылки m_IsValid.

◆ TranslateSafePositions()

bool TranslateSafePositions ( )
inlineprivate
175 {
176 if (safePositions2D.Count() == 0 && safePositions3D.Count() == 0)
177 {
178 Debug.Log("Undefined safe positions for area: " + areaName,"n/a","n/a","","PlayerRestrictedAreaInstance");
179 return false;
180 }
181
183
185 {
186 m_TranslatedSafePositions3D.Insert(Vector(arr2d[0],GetGame().SurfaceY(arr2d[0],arr2d[1]),arr2d[1]));
187 }
188
190 {
192 }
193
194 return true;
195 }
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:136
ref array< ref array< float > > safePositions3D
Definition CfgPlayerRestrictedAreaJsonData.c:75
ref array< ref array< float > > safePositions2D
Definition CfgPlayerRestrictedAreaJsonData.c:74
string areaName
Definition CfgPlayerRestrictedAreaJsonData.c:71
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

Перекрестные ссылки areaName, GetGame(), Debug::Log(), m_TranslatedSafePositions3D, safePositions2D, safePositions3D и Vector().

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

◆ ValidatePlayerRestrictedAreaPositions()

bool ValidatePlayerRestrictedAreaPositions ( )
inlineprivate
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
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
109 //sizes
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
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
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
135 if (dta)
136 {
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
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
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
166 }
167 }
168
169 m_CenterPos2D = Vector(((xMin + xMax) / 2), 0, ((zMin + zMax) / 2));
170
171 return true;
172 }
Definition EnMath.c:7
ref array< ref array< ref array< float > > > PRABoxes
Definition CfgPlayerRestrictedAreaJsonData.c:72
ref array< ref PRAShapeBoxData > m_PRABoxDataTranslated
Definition CfgPlayerRestrictedAreaJsonData.c:77
ref array< ref array< ref array< float > > > PRAPolygons
3D, not used directly!
Definition CfgPlayerRestrictedAreaJsonData.c:73
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:28
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.

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

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

Поля

◆ areaName

string areaName = ""
private

◆ m_CenterPos2D

vector m_CenterPos2D
private

◆ m_IsValid

bool m_IsValid = false
private

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

◆ m_LastUsedSafePosIdx

int m_LastUsedSafePosIdx = -1
private

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

◆ m_PRABoxDataTranslated

ref array<ref PRAShapeBoxData> m_PRABoxDataTranslated = new array<ref PRAShapeBoxData>
private

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

◆ m_RandomizedSafePositions3D

ref array<vector> m_RandomizedSafePositions3D
private

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

◆ m_TranslatedSafePositions3D

ref array<vector> m_TranslatedSafePositions3D
private

◆ PRABoxes

ref array<ref array<ref array<float> > > PRABoxes = new array<ref array<ref array<float>>>
private

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

◆ PRAPolygons

ref array<ref array<ref array<float> > > PRAPolygons = new array<ref array<ref array<float>>>
private

3D, not used directly!

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

◆ safePositions2D

ref array<ref array<float> > safePositions2D = new array<ref array<float>>
private

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

◆ safePositions3D

ref array<ref array<float> > safePositions3D = new array<ref array<float>>
private

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


Объявления и описания членов класса находятся в файле: