18 if (
GetGame().ServerConfigGetInt(
"enableCfgGameplayFile" ))
33 string errorMessage,
path;
35 path =
string.Format(
"$mission:%1", filename);
36 if (!JsonFileLoader<PlayerRestrictedAreaInstance>.LoadFile(
path, area, errorMessage))
39 path =
string.Format(
"dz/worlds/%1/ce/%2", worldName, filename);
41 if (!JsonFileLoader<PlayerRestrictedAreaInstance>.LoadFile(
path, area, errorMessage))
49 m_Data.m_Areas.Insert(area);
72 Param1<CfgPlayerRestrictedAreaJsonData> data =
new Param1<CfgPlayerRestrictedAreaJsonData>(null);
81 ErrorEx(
"CfgPlayerRestrictedAreaHandler - client failed to read incoming data");
125 float closestDist =
float.MAX;
131 if (currentDist < closestDist)
134 closestDist = currentDist;
144 foreach (PRAShapeBoxData boxData : area.m_PRABoxDataTranslated)
148 matPlayer4[3] = point;
161 translatedDta.Clear();
165 translatedDta.Insert(vertexPos[0]);
166 translatedDta.Insert(vertexPos[1]);
169 if (
Math2D.IsPointInPolygon(translatedDta,point[0],point[2]))
197 shp.SetMatrix(boxData.m_Mat4);
234 polygonVectors.Insert(
Vector(vertexPos[0],
GetGame().SurfaceY(vertexPos[0],vertexPos[1]) + 2,vertexPos[1]));
237 int count = polygonVectors.Count();
238 for (
int i = 0; i < count; ++i)
240 current = polygonVectors[i];
243 first = polygonVectors[i];
252 polygonVectors.Clear();
proto void GetWorldName(out string world_name)
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
static TStringArray GetPlayerRestrictedAreaFiles()
static bool IsInitialized()
static void DrawBoxesDebug(bool draw)
static void DrawPolygonLinesDebug(bool draw)
static bool IsPointInPlayerRestrictedArea(vector point, out PlayerRestrictedAreaInstance hitArea)
static ref CfgPlayerRestrictedAreaJsonData m_Data
static void SyncDataSend(notnull PlayerIdentity identity)
static void OnRPC(ParamsReadContext ctx)
static ref TStringArray m_PRAFiles
static bool IsPointInPlayerRestrictedAreaClosest(vector point, out PlayerRestrictedAreaInstance hitArea)
static bool m_Initialized
ref array< Shape > m_DbgShapesBoxes
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
ref array< Shape > m_DbgShapesPolygonLines
static bool IsPointInAreaPolygon(notnull PlayerRestrictedAreaInstance area, vector point)
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
The class that will be instanced (moddable)
ref array< ref PRAShapeBoxData > m_PRABoxDataTranslated
ref array< ref array< ref array< float > > > PRAPolygons
3D, not used directly!
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Serializer ParamsReadContext
proto native CGame GetGame()
array< string > TStringArray
proto bool FileExist(string name)
Check existence of file.
enum WindingOrder Math2D()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
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.