2010-01-09 11:20:14 -08:00
|
|
|
function TestScript1_Init() {}
|
|
|
|
|
|
2025-12-30 00:57:37 -08:00
|
|
|
TestScript1_Init.prototype.Init = function()
|
|
|
|
|
{
|
2010-01-09 11:20:14 -08:00
|
|
|
var param = this.template;
|
2025-05-03 00:37:00 -07:00
|
|
|
// print("# ",uneval(param),"\n");
|
2010-01-09 11:20:14 -08:00
|
|
|
if (param)
|
|
|
|
|
this.x = (+param.x) + (+param.y._string) + (+param.y.z['@w']) + (+param.y.z.a);
|
|
|
|
|
else
|
|
|
|
|
this.x = 100;
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-30 00:57:37 -08:00
|
|
|
TestScript1_Init.prototype.GetX = function()
|
|
|
|
|
{
|
2010-01-09 11:20:14 -08:00
|
|
|
return this.x;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Engine.RegisterComponentType(IID_Test1, "TestScript1_Init", TestScript1_Init);
|
|
|
|
|
|
|
|
|
|
// -------- //
|
|
|
|
|
|
|
|
|
|
function TestScript1_readonly() {}
|
|
|
|
|
|
2025-12-30 00:57:37 -08:00
|
|
|
TestScript1_readonly.prototype.GetX = function()
|
|
|
|
|
{
|
|
|
|
|
try { this.template = null; }
|
|
|
|
|
catch(e) { /* noop */ }
|
|
|
|
|
try { delete this.template; }
|
|
|
|
|
catch(e) { /* noop */ }
|
|
|
|
|
try { this.template.x += 1000; }
|
|
|
|
|
catch(e) { /* noop */ }
|
|
|
|
|
try { delete this.template.x; }
|
|
|
|
|
catch(e) { /* noop */ }
|
|
|
|
|
try { this.template.y = 2000; }
|
|
|
|
|
catch(e) { /* noop */ }
|
2010-01-09 11:20:14 -08:00
|
|
|
return +(this.template.x || 1) + +(this.template.y || 2);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Engine.RegisterComponentType(IID_Test1, "TestScript1_readonly", TestScript1_readonly);
|