7 {
8 JsonDataContaminatedAreas effectAreaData;
9
10
12 {
13
14 PrintToRPT(
"[WARNING] :: [EffectAreaLoader CreateZones] :: No contaminated area file found in MISSION folder, your path is " +
m_Path +
" Attempting DATA folder");
15
18 m_Path =
string.Format(
"dz/worlds/%1/ce/cfgeffectarea.json",
m_Path);
19
21 {
22 PrintToRPT(
"[WARNING] :: [EffectAreaLoader CreateZones] :: No contaminated area file found in DATA folder, your path is " +
m_Path);
23 return;
24 }
25 }
26
27
28 effectAreaData = EffectAreaLoader.GetData();
29 if (effectAreaData)
30 {
31
32
33
34 for (
int i = 0; i < effectAreaData.
Areas.Count(); ++i)
35 {
36 EffectAreaParams params = new EffectAreaParams();
37
38
39 params.m_ParamName = effectAreaData.
Areas.Get( i ).AreaName;
40 string areaType = effectAreaData.
Areas.Get( i ).Type;
41 params.m_ParamTriggerType = effectAreaData.
Areas.Get( i ).TriggerType;
42 JsonDataAreaData data = effectAreaData.
Areas.Get( i ).Data;
43
44
47 {
48 ErrorEx(
string.Format(
"Radius cannot be <= 0. Fix [%1] area definition in cfgeffectarea.json", params.m_ParamName));
49 continue;
50 }
51
52 params.m_ParamRadius = data.
Radius;
53
56
68
69
70 JsonDataPlayerData playerData = effectAreaData.
Areas.Get( i ).PlayerData;
74
75
76 if (particleName != "")
77 params.m_ParamPartId = ParticleList.GetParticleID( particleName );
78
79 if (aroundPartName != "")
80 params.m_ParamAroundPartId = ParticleList.GetParticleID(aroundPartName);
81
82 if (tinyPartName != "")
83 params.m_ParamTinyPartId = ParticleList.GetParticleID(tinyPartName);
84
85 params.m_ParamPpeRequesterType = ppeRequesterType;
86
87 EffectArea newZone;
88
89
90 if (pos[1] == 0)
91 {
94 }
95 else
96 newZone = EffectArea.Cast(
GetGame().CreateObjectEx(areaType, pos,
ECE_NONE));
97
98
99 if (newZone)
100 newZone.SetupZoneData(params);
101 else
102 Error(
"[WARNING] :: [EffectAreaLoader CreateZones] :: Cast failed, are you sure your class ( 'Type:' ) inherits from EffectArea and that there are no Typos?");
103 }
104 }
105 else
106 Error(
"[WARNING] :: [EffectAreaLoader CreateZones] :: Data could not be read, please check data and syntax");
107 }
const int ECE_PLACE_ON_SURFACE
proto void GetWorldName(out string world_name)
proto native float SurfaceRoadY(float x, float z, RoadSurfaceDetection rsd=RoadSurfaceDetection.LEGACY)
ref array< ref JsonDataContaminatedArea > Areas
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
proto bool FileExist(string name)
Check existence of file.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.