Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit d7900ad

Browse files
committed
Added compatibility for datablocks for uiNames
Made types case insensitive. Added warning for nonexistent uiName.
1 parent 66949d3 commit d7900ad

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

server.cs

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function EventScriptServer_save(%brick)
4949
{
5050
%paramField = getField(%paramList, %n);
5151
%param = %brick.eventOutputParameter[%i, %n+1];
52-
52+
5353
// Translate parameter
5454
switch$ (getWord(%paramField, 0))
5555
{
@@ -65,9 +65,9 @@ function EventScriptServer_save(%brick)
6565
%param = %param;
6666
case "datablock":
6767
if (isObject(%param))
68-
%param = %param.getName();
68+
%param = %param.uiName;
6969
else
70-
%param = -1;
70+
%param = "";
7171
case "vector":
7272
%param = %param;
7373
case "list":
@@ -193,11 +193,11 @@ function EventScriptServer_load(%brick, %script)
193193
%param = getField(%params, %n);
194194

195195
// Translate parameter
196-
switch$ (getWord(%paramField, 0))
196+
switch$ (strlwr(getWord(%paramField, 0)))
197197
{
198198
case "int":
199199
%param = atoi(%param);
200-
case "intList":
200+
case "intlist":
201201
%count = getWordcount(%paramField);
202202
for (%m = 0; %m < %count; %m++)
203203
{
@@ -215,10 +215,45 @@ function EventScriptServer_load(%brick, %script)
215215
case "string":
216216
%param = %param;
217217
case "datablock":
218+
%uiName = %param;
219+
%type = getWord(%paramField, 1);
220+
221+
switch$ (strlwr(%type))
222+
{
223+
case "fxbrickdata":
224+
%param = $uiNameTable[%param];
225+
case "fxlightdata":
226+
%param = $uiNameTable_Lights[%param];
227+
case "particleemitterdata":
228+
%param = $uiNameTable_Emitters[%param];
229+
case "itemdata":
230+
%param = $uiNameTable_Items[%param];
231+
case "audioprofile":
232+
%param = $uiNameTable_Music[%param];
233+
if (!isObject(%param))
234+
%param = $uiNameTable_Sounds[%param];
235+
case "playerdata":
236+
%param = $uiNameTable_Vehicle[%param];
237+
if (!isObject(%param))
238+
%param = $uiNameTable_Player[%param];
239+
case "wheeledvehicledata":
240+
%param = $uiNameTable_Vehicle[%param];
241+
case "flyingvehicledata":
242+
%param = $uiNameTable_Vehicle[%param];
243+
case "hovervehicledata":
244+
%param = $uiNameTable_Vehicle[%param];
245+
default:
246+
// Apparently this is also legal
247+
%param = $uiNameTable_[%type @ %param];
248+
}
249+
218250
if (isObject(%param))
219251
%param = %param.getID();
220252
else
253+
{
254+
warn("EventScriptServer_load :: Datablock uiName \"" @ %uiName @ "\" does not exist on line " @ %line);
221255
%param = -1;
256+
}
222257
case "vector":
223258
%param = %param;
224259
case "list":
@@ -231,7 +266,7 @@ function EventScriptServer_load(%brick, %script)
231266
break;
232267
}
233268
}
234-
case "paintColor":
269+
case "paintcolor":
235270
// Locate the closest color
236271
%dist = 2;
237272
%closest = 0;

0 commit comments

Comments
 (0)