DayZ 1.24
Loading...
Searching...
No Matches
UndergroundAreaLoader.c
Go to the documentation of this file.
13
17 float Radius;
18}
19
45
46
48{
49 private static string m_Path = "$mission:cfgundergroundtriggers.json";
50
52
53
55 {
56 if (!FileExist(m_Path))
57 {
58 // We fallback to check in data and notify user file was not found in mission
59 PrintToRPT("[WARNING] :: [UndergroundAreaLoader GetData()] :: file not found in MISSION folder, your path is " + m_Path + " Attempting DATA folder");
60
61 string worldName;
62 GetGame().GetWorldName(worldName);
63 m_Path = string.Format("dz/worlds/%1/ce/cfgundergroundtriggers.json", worldName);
64
65 if (!FileExist(m_Path))
66 {
67 PrintToRPT("[WARNING] :: [UndergroundAreaLoader GetData()] ::file not found in DATA folder, your path is " + m_Path);
68 return null; // Nothing could be read, just end here
69 }
70 }
71
72 string errorMessage;
76
77 return data;
78 }
79
80
82 {
83 if (!m_JsonData)
85
86 if (!m_JsonData || !m_JsonData.Triggers)
87 return;
88
89 foreach (int i, auto data: m_JsonData.Triggers)
91 }
92
94 {
95
96 UndergroundTriggerCarrierBase carrier = UndergroundTriggerCarrierBase.Cast(GetGame().CreateObjectEx("UndergroundTriggerCarrier", data.GetPosition(), ECE_NONE));
97 //Print("spawning trigger carrier at pos :" +data.GetPosition());
98 if (carrier)
99 {
100 carrier.SetIndex(index);
101 carrier.SetOrientation(data.GetOrientation());
102 }
103 }
104
105 //---------------------------------------------------------------------------------------
107 {
108 GetGame().RPCSingleParam(null, ERPCs.RPC_UNDERGROUND_SYNC, new Param1<JsonUndergroundTriggers>(m_JsonData), true, identity);
109 }
110
111 //---------------------------------------------------------------------------------------
112
114 {
116
117 if (ctx.Read(data))
118 m_JsonData = data.param1;
119 else
120 ErrorEx("UndergroundAreaLoader datasynced - failed to read");
121 }
122
123}
const int ECE_NONE
ERPCs
Definition ERPCs.c:2
float EyeAccommodation
float Radius
bool UseRaycast
class JsonUndergroundAreaTriggerData GetPosition
ref array< float > Position
ref array< ref JsonUndergroundAreaBreadcrumb > Breadcrumbs
ref array< ref JsonUndergroundAreaTriggerData > Triggers
The class that will be instanced (moddable)
Definition gameplay.c:376
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
static void SpawnTriggerCarrier(int index, JsonUndergroundAreaTriggerData data)
static ref JsonUndergroundTriggers m_JsonData
static void SyncDataSend(PlayerIdentity identity)
static void OnRPC(ParamsReadContext ctx)
static void SpawnAllTriggerCarriers()
static JsonUndergroundTriggers GetData()
proto native CGame GetGame()
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
enum ShapeType ErrorEx
proto bool FileExist(string name)
Check existence of file.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.