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

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

static bool LoadData ()
 
static bool IsInitialized ()
 
static void SyncDataSend (notnull PlayerIdentity identity)
 
static void OnRPC (ParamsReadContext ctx)
 
static bool IsPointInPlayerRestrictedAreaClosest (vector point, out PlayerRestrictedAreaInstance hitArea)
 
static bool IsPointInPlayerRestrictedArea (vector point, out PlayerRestrictedAreaInstance hitArea)
 
static PlayerRestrictedAreaInstance GetClosestArea (vector point)
 
static bool IsCylinderInAreaBox (notnull PlayerRestrictedAreaInstance area, vector point, float cylinderRadius=0.25, float cylinderHeight=1)
 default cylinder values sufficient for player detection
 
static bool IsPointInAreaPolygon (notnull PlayerRestrictedAreaInstance area, vector point)
 
static void DrawBoxesDebug (bool draw)
 
static void DrawPolygonLinesDebug (bool draw)
 

Закрытые статические данные

static bool m_Initialized
 
static ref TStringArray m_PRAFiles = new TStringArray()
 
static ref CfgPlayerRestrictedAreaJsonData m_Data = new CfgPlayerRestrictedAreaJsonData()
 
ref array< Shapem_DbgShapesBoxes
 
ref array< Shapem_DbgShapesPolygonLines
 

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

Методы

◆ DrawBoxesDebug()

static void DrawBoxesDebug ( bool draw)
inlinestaticprivate
183 {
184 if (!IsInitialized())
185 return;
186
187 if (!m_DbgShapesBoxes)
188 m_DbgShapesBoxes = {};
189
190 if (draw && m_DbgShapesBoxes.Count() == 0)
191 {
192 foreach (PlayerRestrictedAreaInstance area : m_Data.m_ValidatedAreas)
193 {
194 foreach (PRAShapeBoxData boxData : area.m_PRABoxDataTranslated)
195 {
196 Shape shp = Debug.DrawBox(boxData.m_Mins,boxData.m_Maxs);
197 shp.SetMatrix(boxData.m_Mat4);
198 m_DbgShapesBoxes.Insert(shp);
199 }
200 }
201 }
202 else if (!draw && m_DbgShapesBoxes.Count() > 0)
203 {
204 foreach (Shape box : m_DbgShapesBoxes)
205 {
206 box.Destroy();
207 }
208
209 m_DbgShapesBoxes.Clear();
210 }
211 }
static bool IsInitialized()
Definition CfgPlayerRestrictedAreaHandler.c:57
static ref CfgPlayerRestrictedAreaJsonData m_Data
Definition CfgPlayerRestrictedAreaHandler.c:6
ref array< Shape > m_DbgShapesBoxes
Definition CfgPlayerRestrictedAreaHandler.c:179
Definition Debug.c:14
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Definition Debug.c:300
Definition EntityAI.c:95
Definition CfgPlayerRestrictedAreaJsonData.c:61
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead

Перекрестные ссылки Debug::DrawBox(), IsInitialized(), m_Data, m_DbgShapesBoxes и Shape.

◆ DrawPolygonLinesDebug()

static void DrawPolygonLinesDebug ( bool draw)
inlinestaticprivate
214 {
215 if (!IsInitialized())
216 return;
217
220
221 if (draw && m_DbgShapesPolygonLines.Count() == 0)
222 {
224 foreach (PlayerRestrictedAreaInstance area : m_Data.m_ValidatedAreas)
225 {
226 foreach (array<ref array<float>> polygonData : area.PRAPolygons)
227 {
230 vector last;
231
233 {
234 polygonVectors.Insert(Vector(vertexPos[0],GetGame().SurfaceY(vertexPos[0],vertexPos[1]) + 2,vertexPos[1]));
235 }
236
237 int count = polygonVectors.Count();
238 for (int i = 0; i < count; ++i)
239 {
241
242 if (i == 0)
244 else
246
247 last = current;
248 }
249
251
252 polygonVectors.Clear();
253 }
254 }
255 }
256 else if (!draw && m_DbgShapesPolygonLines.Count() > 0)
257 {
259 {
260 item.Destroy();
261 }
262
264 }
265 }
ref array< Shape > m_DbgShapesPolygonLines
Definition CfgPlayerRestrictedAreaHandler.c:180
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
Definition Debug.c:388
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:28
Definition EnConvert.c:106
proto native CGame GetGame()
const int COLOR_RED
Definition constants.c:64
const int COLOR_WHITE
Definition constants.c:63
ShapeFlags
Definition EnDebug.c:126
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

Перекрестные ссылки COLOR_RED, COLOR_WHITE, Debug::DrawLine(), GetGame(), IsInitialized(), m_Data, m_DbgShapesPolygonLines, Shape и Vector().

◆ GetClosestArea()

static PlayerRestrictedAreaInstance GetClosestArea ( vector point)
inlinestaticprivate
123 {
125 float closestDist = float.MAX;
126 float currentDist;
127
128 foreach (PlayerRestrictedAreaInstance area : m_Data.m_ValidatedAreas)
129 {
130 currentDist = vector.DistanceSq(point,area.GetCenterPos2D());
132 {
133 ret = area;
135 }
136 }
137
138 return ret;
139 }
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.

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

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

◆ IsCylinderInAreaBox()

static bool IsCylinderInAreaBox ( notnull PlayerRestrictedAreaInstance area,
vector point,
float cylinderRadius = 0.25,
float cylinderHeight = 1 )
inlinestaticprivate

default cylinder values sufficient for player detection

143 {
144 foreach (PRAShapeBoxData boxData : area.m_PRABoxDataTranslated)
145 {
148 matPlayer4[3] = point;
150 return true;
151 }
152
153 return false;
154 }
Definition EnMath3D.c:28
static proto bool IntersectCylinderOBB(vector mins, vector maxs, vector obbMat[4], vector cylMat[4], float cylinderRadius, float cylinderHeight)
Tests whether cylinder is intersecting oriented box.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Definition EnMath3D.c:256

Перекрестные ссылки Math3D::IntersectCylinderOBB() и Math3D::MatrixIdentity4().

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

◆ IsInitialized()

static bool IsInitialized ( )
inlinestaticprivate
58 {
59 return m_Initialized;
60 }
static bool m_Initialized
Definition CfgPlayerRestrictedAreaHandler.c:3

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

Используется в ManBase::AfterStoreLoad(), DrawBoxesDebug(), DrawPolygonLinesDebug(), IsPointInPlayerRestrictedArea() и IsPointInPlayerRestrictedAreaClosest().

◆ IsPointInAreaPolygon()

static bool IsPointInAreaPolygon ( notnull PlayerRestrictedAreaInstance area,
vector point )
inlinestaticprivate
157 {
159 foreach (array<ref array<float>> polygonData : area.PRAPolygons)
160 {
161 translatedDta.Clear();
162
164 {
165 translatedDta.Insert(vertexPos[0]);
166 translatedDta.Insert(vertexPos[1]);
167 }
168
169 if (Math2D.IsPointInPolygon(translatedDta,point[0],point[2]))
170 return true;
171 }
172
173 return false;
174 }
enum WindingOrder Math2D()

Перекрестные ссылки Math2D().

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

◆ IsPointInPlayerRestrictedArea()

static bool IsPointInPlayerRestrictedArea ( vector point,
out PlayerRestrictedAreaInstance hitArea )
inlinestaticprivate
103 {
104 if (!IsInitialized())
105 return false;
106
107 foreach (PlayerRestrictedAreaInstance area : m_Data.m_ValidatedAreas)
108 {
110 {
111 hitArea = area;
112 return true;
113 }
114 }
115
116 return false;
117 }
static bool IsPointInAreaPolygon(notnull PlayerRestrictedAreaInstance area, vector point)
Definition CfgPlayerRestrictedAreaHandler.c:156
static bool IsCylinderInAreaBox(notnull PlayerRestrictedAreaInstance area, vector point, float cylinderRadius=0.25, float cylinderHeight=1)
default cylinder values sufficient for player detection
Definition CfgPlayerRestrictedAreaHandler.c:142

Перекрестные ссылки IsCylinderInAreaBox(), IsInitialized(), IsPointInAreaPolygon() и m_Data.

Используется в ManBase::AfterStoreLoad().

◆ IsPointInPlayerRestrictedAreaClosest()

static bool IsPointInPlayerRestrictedAreaClosest ( vector point,
out PlayerRestrictedAreaInstance hitArea )
inlinestaticprivate
89 {
90 if (!IsInitialized())
91 return false;
92
95 {
96 hitArea = area;
97 return true;
98 }
99 return false;
100 }
static PlayerRestrictedAreaInstance GetClosestArea(vector point)
Definition CfgPlayerRestrictedAreaHandler.c:122

Перекрестные ссылки GetClosestArea(), IsCylinderInAreaBox(), IsInitialized() и IsPointInAreaPolygon().

◆ LoadData()

static bool LoadData ( )
inlinestaticprivate
12 {
13 if (m_Initialized)
14 return true;
15
16 m_Initialized = false;
17
18 if (GetGame().ServerConfigGetInt( "enableCfgGameplayFile" )) //only reach into the CfgGameplayHandler if properly loaded!
20 else
21 m_PRAFiles = g_Game.GetMission().GetWorldData().GetDefaultPRAPaths();
22
23 if (!m_PRAFiles)
24 return true;
25
26 string worldName;
27 GetGame().GetWorldName(worldName);
28
29 foreach (string filename : m_PRAFiles)
30 {
32
33 string errorMessage, path;
34
35 path = string.Format("$mission:%1", filename);
37 {
38 if (!FileExist(filename))
39 path = string.Format("dz/worlds/%1/ce/%2", worldName, filename);
40
42 {
44 continue;
45 }
46 }
47
48 if (area != null)
49 m_Data.m_Areas.Insert(area);
50 }
51
52 m_Initialized = m_Data.InitializeAreas();
53
54 return true;
55 }
DayZGame g_Game
Definition DayZGame.c:3815
string path
Definition OptionSelectorMultistate.c:142
Definition CfgGameplayHandler.c:2
static TStringArray GetPlayerRestrictedAreaFiles()
Definition CfgGameplayHandler.c:443
static ref TStringArray m_PRAFiles
Definition CfgPlayerRestrictedAreaHandler.c:5
enum ShapeType ErrorEx
proto bool FileExist(string name)
Check existence of file.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.

Перекрестные ссылки ErrorEx, FileExist(), string::Format(), g_Game, GetGame(), CfgGameplayHandler::GetPlayerRestrictedAreaFiles(), m_Data, m_Initialized, m_PRAFiles и path.

Используется в MissionBase::OnInit().

◆ OnRPC()

static void OnRPC ( ParamsReadContext ctx)
inlinestaticprivate
71 {
73
74 if (ctx.Read(data))
75 {
76 m_Data = data.param1;
77 m_Initialized = m_Data.m_ValidatedAreas.Count() > 0;
78 }
79 else
80 {
81 ErrorEx("CfgPlayerRestrictedAreaHandler - client failed to read incoming data");
82 }
83 }

Перекрестные ссылки ErrorEx, m_Data и m_Initialized.

Используется в CGame::OnRPC().

◆ SyncDataSend()

static void SyncDataSend ( notnull PlayerIdentity identity)
inlinestaticprivate
66 {
67 GetGame().RPCSingleParam(null, ERPCs.RPC_PLAYERRESTRICTEDAREAS_SYNC, new Param1<CfgPlayerRestrictedAreaJsonData>(m_Data), true, identity);
68 }
ERPCs
Definition ERPCs.c:2

Перекрестные ссылки GetGame() и m_Data.

Используется в MissionBase::OnEvent().

Поля

◆ m_Data

◆ m_DbgShapesBoxes

ref array<Shape> m_DbgShapesBoxes
staticprivate

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

◆ m_DbgShapesPolygonLines

ref array<Shape> m_DbgShapesPolygonLines
staticprivate

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

◆ m_Initialized

bool m_Initialized
staticprivate

Используется в IsInitialized(), LoadData() и OnRPC().

◆ m_PRAFiles

ref TStringArray m_PRAFiles = new TStringArray()
staticprivate

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


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