forked from DevilboxGames/ReincarnationTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCRVolumeZone.ms
More file actions
186 lines (164 loc) · 4.26 KB
/
Copy pathCRVolumeZone.ms
File metadata and controls
186 lines (164 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
struct ZoneSphereShape (
Position,
Radius
)
struct ZoneTictacShape (
Start,
End,
Radius
)
struct ZoneCubeShape (
Min,
Max,
Transform
)
struct ZoneLua (
ZoneName,
ZoneType,
ShapeData,
Children = #(),
UserData,
fn Load name f = (
ZoneName = name
lineNum=0
isZoneModule = false
zoneObject = ZoneLua()
inZone = true
while inZone and not (eof f) do (
lineNum += 1
curline = trimLeft (trimRight (readline f))
if curline != "" and (findString curline "=") != undefined then (
splitLine = FilterString " ="
case splitLine[1] of (
"type": (
ZoneType = splitLine[2]
ShapeData = case ZoneType of (
"cube": ZoneCubeShape()
"sphere": ZoneSphereShape()
"tictac": ZoneTictacShape()
)
)
"userdata":Userdata = splitLine[2]
"children": (
inChildren = true
while inChildren and not (eof f) do (
curline = trimLeft (trimRight (readline f))
if curline != "" and (findString curline "=") != undefined then (
splitLine = FilterString " ="
childZone = ZoneLua()
lineNume += zone.Load splitLine[1] f
append Children childZone
)
if curline[1] == "}" then (
inChildren = false
)
)
)
"corners": (
inCorners = true
while inCorners abd not (eof f) do (
curline = trimLeft (trimRight (readline f))
if curline != "" and (findString curline "min") != undefined (
splitLine = FilterString " ={},"
ShapeData.Min = [splitLine[2],splitLine[3],splitLine[4]]
)
else if curline != "" and (findString curline "max") != undefined (
splitLine = FilterString " ={},"
ShapeData.Max = [splitLine[2],splitLine[3],splitLine[4]]
)
if curline[1] == "}" then (
inCorners = false
)
)
)
"transform": (
inTransform = true
ShapeData.Transform = #()
while inTransform abd not (eof f) do (
curline = trimLeft (trimRight (readline f))
if curline != "" and curline[1] == "{" and curline[curline.length-1]=="}" (
splitLine = FilterString " ={},"
append ShapeData.Transform [splitLine[2],splitLine[3],splitLine[4]]
)
if curline[1] == "}" then (
inTransform = false
)
)
)
"ends":(
splitLine = FilterString " ={},"
ShapeData.Start = [splitLine[2],splitLine[3],splitLine[4]]
ShapeData.Start = [splitLine[5],splitLine[6],splitLine[7]]
)
)
else if splitLine[1] == "userdata" then UserDate = splitLine[2]
zoneG = ZoneLua()
lineNume += zone.Load splitLine[1] f
)
if curline[1] == "}" then (
inZone = false
)
)
lineNum
)
)
struct ZoneGroupLua (
GroupName,
Zones=#(),
fn Load name f = (
GroupName = name
lineNum=0
isZoneModule = false
zoneObject = ZoneLua()
inGroup = true
while inGroup and not (eof f) do (
lineNum += 1
curline = trimLeft (trimRight (readline f))
if curline != "" and (findString curline "=") != undefined then (
splitLine = FilterString " ="
zone = ZoneLua()
lineNume += zone.Load splitLine[1] f
)
if curline[1] == "}" then (
inGroup = false
)
)
lineNum
)
)
struct ZoneLua (
Filename,
Groups=#(),
fn Load luafilename = (
if ((dotnetclass "System.IO.File").exists txtFileName) then
(
f = openfile luaFileName mode:"r"
lineNum=0
isZoneModule = false
zoneObject = ZoneLua()
while not (eof f) do (
lineNum += 1
curline = trimLeft (trimRight (readline f))
if not isZoneModule then (
if (substring curline 1 6) == "module" and (findString curline "static_volumes") != undefined then isZoneModule = true
)
else if curline != "" and (findString curline "=") != undefined then (
splitLine = FilterString " ="
zoneGroup = ZoneGroupLua()
lineNume += zoneGroup.Load splitLine[1] f
)
)
)
)
)
VolumeZoneAttribute = attributes VolumeZoneCustomAttribute attribid:#(0x7304a5be, 0x43eecc39) version:1
(
parameters mainparams rollout:mainzonerollout (
ZoneGroup type:#string ui:txt_ZoneGroup default:""
Userdata type:#string ui:txt_Userdata default:""
)
rollout mainzonerollout "Zone Details" (
edittext txt_ZoneGroup "Zone Group" labelontop:true
edittext txt_Userdata "User data" labelontop:true
)
)