diff --git a/binaries/data/mods/_test.sim/simulation/components/test-param.js b/binaries/data/mods/_test.sim/simulation/components/test-param.js index de3bb1e2ca..ec3e0173ae 100644 --- a/binaries/data/mods/_test.sim/simulation/components/test-param.js +++ b/binaries/data/mods/_test.sim/simulation/components/test-param.js @@ -20,9 +20,9 @@ Engine.RegisterComponentType(IID_Test1, "TestScript1_Init", TestScript1_Init); function TestScript1_readonly() {} TestScript1_readonly.prototype.GetX = function() { - this.template = null; - delete this.template; - try { this.template.x += 1000; } catch(e) { } + try { this.template = null; } catch(e) { } + try { delete this.template; } catch(e) { } + try { this.template.x += 1000; } catch(e) { } try { delete this.template.x; } catch(e) { } try { this.template.y = 2000; } catch(e) { } return +(this.template.x || 1) + +(this.template.y || 2); diff --git a/binaries/data/mods/_test.sim/simulation/templates/special/pathfinder.xml b/binaries/data/mods/_test.sim/simulation/data/pathfinder.xml similarity index 100% rename from binaries/data/mods/_test.sim/simulation/templates/special/pathfinder.xml rename to binaries/data/mods/_test.sim/simulation/data/pathfinder.xml diff --git a/binaries/data/mods/public/gui/aiconfig/aiconfig.js b/binaries/data/mods/public/gui/aiconfig/aiconfig.js new file mode 100644 index 0000000000..a6a063e255 --- /dev/null +++ b/binaries/data/mods/public/gui/aiconfig/aiconfig.js @@ -0,0 +1,43 @@ +var g_AIs; // [ {"id": ..., "data": {"name": ..., "description": ..., ...} }, ... ] +var g_Callback; // for the OK button + +function init(settings) +{ + g_Callback = settings.callback; + + g_AIs = [ + {id: "", data: {name: "None", description: "AI will be disabled for this player."}} + ].concat(settings.ais); + + var aiSelection = getGUIObjectByName("aiSelection"); + aiSelection.list = [ ai.data.name for each (ai in g_AIs) ]; + + var selected = 0; + for (var i = 0; i < g_AIs.length; ++i) + { + if (g_AIs[i].id == settings.id) + { + selected = i; + break; + } + } + aiSelection.selected = selected; +} + +function selectAI(idx) +{ + var id = g_AIs[idx].id; + var name = g_AIs[idx].data.name; + var description = g_AIs[idx].data.description; + + getGUIObjectByName("aiDescription").caption = description; +} + +function returnAI() +{ + var aiSelection = getGUIObjectByName("aiSelection"); + var idx = aiSelection.selected; + var id = g_AIs[idx].id; + var name = g_AIs[idx].data.name; + g_Callback({"id": id, "name": name}); +} diff --git a/binaries/data/mods/public/gui/aiconfig/aiconfig.xml b/binaries/data/mods/public/gui/aiconfig/aiconfig.xml new file mode 100644 index 0000000000..7c54e3fc62 --- /dev/null +++ b/binaries/data/mods/public/gui/aiconfig/aiconfig.xml @@ -0,0 +1,59 @@ + + + + +