Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
ExportTerrain.c
Go to the documentation of this file.
1class ExportTerrainRequest : JsonApiStruct
2{
3 int area;
4 string worldPath;
5 string path;
6 int count;
7
8 void ExportTerrainRequest()
9 {
10 RegV("area");
11 RegV("worldPath");
12 RegV("path");
13 RegV("count");
14 }
15}
16
18{
19 bool Output;
20
22 {
23 RegV("Output");
24 }
25}
26
27
28class ExportTerrain : NetApiHandler
29{
30 override JsonApiStruct GetRequest()
31 {
32 return new ExportTerrainRequest();
33 }
34
35 override JsonApiStruct GetResponse(JsonApiStruct request)
36 {
39
40 // getting WorldEditor API
41 WorldEditor wm = Workbench.GetModule(WorldEditor);
42 WorldEditorAPI api = wm.GetApi();
43 string openedWorldPath;
44
45 // if WorldEditor is not opened, open it and load correct map
46 if (!api)
47 {
48 Workbench.OpenModule(WorldEditor);
49 api = wm.GetApi();
50 wm.SetOpenedResource(req.worldPath);
51 }
52
53 // if WE is opened check if with a correct map if not open it
54 api.GetWorldPath(openedWorldPath);
55 if (openedWorldPath != req.worldPath)
56 {
57 wm.SetOpenedResource(req.worldPath);
58 }
59
60 FileHandle bin = FileIO.OpenFile(req.path, FileMode.READ);
61 for(int i = 0; i < req.count; i++)
62 {
63 array<float> coords = new array<float>;
64 array<int> indices = new array<int>;
65
66 bin.ReadArray(indices, 4, 2);
67 bin.ReadArray(coords, 4, req.area);
68
69 api.BeginTerrainAction(TerrainToolType.HEIGHT_EXACT);
70 api.SetTerrainSurfaceTile(0, indices[0], indices[1], coords);
71 api.EndTerrainAction();
72 }
73
74
75 bin.Close();
76 response.Output = true;
77 return response;
78 }
79
80}
void ExportTerrainResponse()
ExportTerrainRequest Output
ref array< string > coords
SCR_AICombatMoveRequestBase GetRequest()
base classes for filtering in server browser
FileMode
Mode for opening file. See FileSystem::Open.
Definition FileMode.c:14
TerrainToolType