From 9f47ed536dc5d9c714c13e43c23869fff5e0d95f Mon Sep 17 00:00:00 2001 From: sanderd17 Date: Mon, 23 Jun 2014 13:42:59 +0000 Subject: [PATCH] Add engine support to triggers + a component to provide an easy interface and to be extended by triggers. Thanks to SpahBod for the biggest part of the code, and Yves for the review. This was SVN commit r15421. --- .../data/mods/public/globalscripts/utility.js | 24 ++ .../simulation/components/Foundation.js | 4 + .../simulation/components/ProductionQueue.js | 8 + .../components/TechnologyManager.js | 4 + .../public/simulation/components/Trigger.js | 268 ++++++++++++++++++ .../simulation/components/TriggerPoint.js | 88 ++++++ .../components/interfaces/Trigger.js | 1 + .../components/interfaces/TriggerPoint.js | 2 + .../public/simulation/helpers/Commands.js | 5 + .../templates/special/trigger_point_A.xml | 3 + .../templates/special/trigger_point_B.xml | 3 + .../templates/special/trigger_point_C.xml | 3 + .../templates/special/trigger_point_D.xml | 3 + .../templates/special/trigger_point_E.xml | 3 + .../templates/special/trigger_point_F.xml | 3 + .../templates/special/trigger_point_G.xml | 3 + .../templates/special/trigger_point_H.xml | 3 + .../templates/special/trigger_point_I.xml | 3 + .../templates/special/trigger_point_J.xml | 3 + .../templates/special/trigger_point_K.xml | 3 + source/simulation2/Simulation2.cpp | 13 + 21 files changed, 450 insertions(+) create mode 100644 binaries/data/mods/public/globalscripts/utility.js create mode 100644 binaries/data/mods/public/simulation/components/Trigger.js create mode 100644 binaries/data/mods/public/simulation/components/TriggerPoint.js create mode 100644 binaries/data/mods/public/simulation/components/interfaces/Trigger.js create mode 100644 binaries/data/mods/public/simulation/components/interfaces/TriggerPoint.js diff --git a/binaries/data/mods/public/globalscripts/utility.js b/binaries/data/mods/public/globalscripts/utility.js new file mode 100644 index 0000000000..3dadbac3bb --- /dev/null +++ b/binaries/data/mods/public/globalscripts/utility.js @@ -0,0 +1,24 @@ +/** + * returns a clone of a simple object or array + * Only valid JSON objects are accepted + * So no recursion, and only plain obects or arrays + */ +function clone(o) +{ + if (o instanceof Array) + var r = []; + else if (o instanceof Object) + var r = {}; + else // native data type + return o; + for (var key in o) + r[key] = clone(o[key]); + return r; +} + +var data = { "sub1": { "sub1prop1":"original" }, "prop1": "original", "prop2": [1,2,3] }; +var newData = clone(data); +newData["sub1"]["sub1prop1"] = "modified"; + +print("data" + uneval(data)); +print("newData" + uneval(newData)); diff --git a/binaries/data/mods/public/simulation/components/Foundation.js b/binaries/data/mods/public/simulation/components/Foundation.js index 6b22881b65..47fa694925 100644 --- a/binaries/data/mods/public/simulation/components/Foundation.js +++ b/binaries/data/mods/public/simulation/components/Foundation.js @@ -202,6 +202,10 @@ Foundation.prototype.Build = function(builderEnt, work) // (via CCmpTemplateManager). Now we need to remove that temporary // blocker-disabling, so that we'll perform standard unit blocking instead. cmpObstruction.SetDisableBlockMovementPathfinding(false, false, -1); + + // Call the related trigger event + var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); + cmpTrigger.CallEvent("ConstructionStarted", {"foundation": this.entity, "template": this.finalTemplateName}); } // Switch foundation to scaffold variant diff --git a/binaries/data/mods/public/simulation/components/ProductionQueue.js b/binaries/data/mods/public/simulation/components/ProductionQueue.js index c20be504af..dd6851304a 100644 --- a/binaries/data/mods/public/simulation/components/ProductionQueue.js +++ b/binaries/data/mods/public/simulation/components/ProductionQueue.js @@ -288,6 +288,10 @@ ProductionQueue.prototype.AddBatch = function(templateName, type, count, metadat "timeTotal": time*1000, "timeRemaining": time*1000, }); + + // Call the related trigger event + var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); + cmpTrigger.CallEvent("TrainingQueued", {"playerid": cmpPlayer.GetPlayerID(), "unitTemplate": templateName, "count": count, "metadata": metadata, "trainerEntity": this.entity}); } else if (type == "technology") { @@ -324,6 +328,10 @@ ProductionQueue.prototype.AddBatch = function(templateName, type, count, metadat "timeTotal": time*1000, "timeRemaining": time*1000, }); + + // Call the related trigger event + var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); + cmpTrigger.CallEvent("ResearchQueued", {"playerid": cmpPlayer.GetPlayerID(), "technologyTemplate": templateName, "researcherEntity": this.entity}); } else { diff --git a/binaries/data/mods/public/simulation/components/TechnologyManager.js b/binaries/data/mods/public/simulation/components/TechnologyManager.js index f3adf70ea7..fedd70fb72 100644 --- a/binaries/data/mods/public/simulation/components/TechnologyManager.js +++ b/binaries/data/mods/public/simulation/components/TechnologyManager.js @@ -348,6 +348,10 @@ TechnologyManager.prototype.ResearchTechnology = function (tech) var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); var ents = cmpRangeManager.GetEntitiesByPlayer(playerID); + // Call the related trigger event + var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); + cmpTrigger.CallEvent("ResearchFinished", {"player": playerID, "tech": tech}); + for (var component in modifiedComponents) { Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); diff --git a/binaries/data/mods/public/simulation/components/Trigger.js b/binaries/data/mods/public/simulation/components/Trigger.js new file mode 100644 index 0000000000..678d4ade2f --- /dev/null +++ b/binaries/data/mods/public/simulation/components/Trigger.js @@ -0,0 +1,268 @@ +function Trigger() {}; + +Trigger.prototype.Schema = + ""; + +/** + * Events we're able to receive and call handlers for + */ +Trigger.prototype.eventNames = +[ + "StructureBuilt", + "ConstructionStarted", + "TrainingFinished", + "TrainingQueued", + "ResearchFinished", + "ResearchQueued", + "PlayerCommand", + "Interval", + "Range", +]; + +Trigger.prototype.Init = function() +{ + this.triggerPoints = {}; + + // Each event has its own set of actions determined by the map maker. + for each (var eventName in this.eventNames) + this["On" + eventName + "Actions"] = {}; + + // To prevent the lose of trigger variables after a save, they "should" be defined in "InitTriggers" function, which is the starting point of a trigger script + this.DoAfterDelay(0, "InitGame", {}); +}; + +/** + * This method may be overwritten by triggers + */ +Trigger.prototype.InitGame = function() +{ +}; + +Trigger.prototype.RegisterTriggerPoint = function(ref, ent) +{ + if (!this.triggerPoints[ref]) + this.triggerPoints[ref] = []; + this.triggerPoints[ref].push(ent); +}; + +Trigger.prototype.RemoveRegisteredTriggerPoint = function(ref, ent) +{ + if (!this.triggerPoints[ref]) + { + warn("no trigger points found with ref "+ref); + return; + } + var i = this.triggerPoints[ref].indexOf(ent); + if (i == -1) + { + warn("entity " + ent + " wasn't found under the trigger points with ref "+ref); + return; + } + this.triggerPoints[ref].splice(i, 1); +}; + +Trigger.prototype.GetTriggerPoints = function(ref) +{ + return this.triggerPoints[ref] || []; +}; + +/** Binds the "action" function to one of the implemented events. + * + * @param event Name of the event (see the list in init) + * @param action Functionname of a function available under this object + * @param Extra Data for the trigger (enabled or not, delay for timers, range for range triggers ...) + * + * Interval triggers example: + * data = {enabled: true, interval: 1000, delay: 500} + * + * Range trigger: + * data.entities = [id1, id2] * Ids of the source + * data.players = [1,2,3,...] * list of player ids + * data.minRange = 0 * Minimum range for the query + * data.maxRange = -1 * Maximum range for the query (-1 = no maximum) + * data.requiredComponent = 0 * Required component id the entities will have + * data.enabled = false * If the query is enabled by default + */ +Trigger.prototype.RegisterTrigger = function(event, action, data) +{ + var eventString = event + "Actions"; + if (!this[eventString]) + { + warn("Trigger.js: Invalid trigger event \"" + event + "\".") + return; + } + if (this[eventString][action]) + { + warn("Trigger.js: Trigger has been registered before. Aborting..."); + return; + } + // clone the data to be sure it's only modified locally + // We could run into triggers overwriting each other's data otherwise. + // F.e. getting the wrong timer tag + data = clone(data) || {"enabled": false}; + + this[eventString][action] = data; + + // setup range query + if (event == "OnRange") + { + if (!data.entities) + { + warn("Trigger.js: Range triggers should carry extra data"); + return; + } + data.queries = []; + for (var ent of data.entities) + { + var cmpTriggerPoint = Engine.QueryInterface(ent, IID_TriggerPoint); + if (!cmpTriggerPoint) + { + warn("Trigger.js: Range triggers must be defined on trigger points"); + continue; + } + data.queries.push(cmpTriggerPoint.RegisterRangeTrigger(action, data)); + } + } + + if (data.enabled) + this.EnableTrigger(event, action); +}; + +// Disable trigger +Trigger.prototype.DisableTrigger = function(event, action) +{ + var eventString = event + "Actions"; + if (!this[eventString][action]) + { + warn("Trigger.js: Disabling unknown trigger"); + return; + } + var data = this[eventString][action]; + // special casing interval and range triggers for performance + if (event == "OnInterval") + { + if (!data.timer) // don't disable it a second time + return; + var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); + cmpTimer.CancelTimer(data.timer); + data.timer = null; + } + else if (event == "OnRange") + { + if (!data.queries) + { + warn("Trigger.js: Range query wasn't set up before trying to disable it."); + return; + } + var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); + for (var query of data.queries) + cmpRangeManager.DisableActiveQuery(query); + } + + data.enabled = false; +}; + +// Enable trigger +Trigger.prototype.EnableTrigger = function(event, action) +{ + var eventString = event + "Actions"; + if (!this[eventString][action]) + { + warn("Trigger.js: Enabling unknown trigger"); + return; + } + var data = this[eventString][action]; + // special casing interval and range triggers for performance + if (event == "OnInterval") + { + if (data.timer) // don't enable it a second time + return; + if (!data.interval) + { + warn("Trigger.js: An interval trigger should have an intervel in its data") + return; + } + var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); + var timer = cmpTimer.SetInterval(this.entity, IID_Trigger, "DoAction", data.delay || 0, data.interval, {"action" : action}); + data.timer = timer; + } + else if (event == "OnRange") + { + if (!data.queries) + { + warn("Trigger.js: Range query wasn't set up before"); + return; + } + var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); + for (var query of data.queries) + cmpRangeManager.EnableActiveQuery(query); + } + + data.enabled = true; +}; + +/** + * This function executes the actions bound to the events + * It's either called directlty from other simulation scripts, + * or from message listeners in this file + * + * @param event Name of the event (see the list in init) + * @param data Data object that will be passed to the actions + */ +Trigger.prototype.CallEvent = function(event, data) +{ + var eventString = "On" + event + "Actions"; + + if (!this[eventString]) + { + warn("Trigger.js: Unknown trigger event called:\"" + event + "\"."); + return; + } + + for (var action in this[eventString]) + { + if (this[eventString][action].enabled) + this.DoAction({"action": action, "data":data}); + } +}; + +// Handles "OnStructureBuilt" event. +Trigger.prototype.OnGlobalConstructionFinished = function(msg) +{ + this.CallEvent("StructureBuilt", {"building": msg.newentity}); // The data for this one is {"building": constructedBuilding} +}; + +// Handles "OnTrainingFinished" event. +Trigger.prototype.OnGlobalTrainingFinished = function(msg) +{ + this.CallEvent("TrainingFinished", msg); + // The data for this one is {"entities": createdEnts, + // "owner": cmpOwnership.GetOwner(), + // "metadata": metadata} + // See function "SpawnUnits" in ProductionQueue for more details +}; + +/** + * Execute a function after a certain delay + * @param time The delay expressed in milleseconds + * @param action Name of the action function + * @param data Data object that will be passed to the action function + */ +Trigger.prototype.DoAfterDelay = function(miliseconds, action, data) +{ + var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); + return cmpTimer.SetTimeout(SYSTEM_ENTITY, IID_Trigger, "DoAction", miliseconds, {"action": action, "data": data}); +}; + +/** + * Called by the trigger listeners to exucute the actual action. Including sanity checks. + */ +Trigger.prototype.DoAction = function(msg) +{ + if (this[msg.action]) + this[msg.action](msg.data || null); + else + warn("Trigger.js: called a trigger action '" + msg.action + "' that wasn't found"); +}; + +Engine.RegisterSystemComponentType(IID_Trigger, "Trigger", Trigger); diff --git a/binaries/data/mods/public/simulation/components/TriggerPoint.js b/binaries/data/mods/public/simulation/components/TriggerPoint.js new file mode 100644 index 0000000000..46cfe2219e --- /dev/null +++ b/binaries/data/mods/public/simulation/components/TriggerPoint.js @@ -0,0 +1,88 @@ +function TriggerPoint() {}; + +TriggerPoint.prototype.Schema = + "" + + "" + + "" + + "" + + ""; + +TriggerPoint.prototype.Init = function() +{ + if (this.template && this.template.Reference) + { + var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); + cmpTrigger.RegisterTriggerPoint(this.template.Reference, this.entity); + } + this.currentCollections = {}; + this.actions = {}; +}; + +TriggerPoint.prototype.OnDestroy = function() +{ + if (this.template && this.template.EntityReference) + { + var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); + cmpTrigger.RemoveRegisteredTriggerPoint(this.template.Reference, this.entity); + } +}; + +/** + * @param action Name of the action function defined under Trigger + * @param data The data is an object containing information for the range query + * Some of the data has sendible defaults (mentionned next to the object) + * data.players = [1,2,3,...] * list of player ids + * data.minRange = 0 * Minimum range for the query + * data.maxRange = -1 * Maximum range for the query (-1 = no maximum) + * data.requiredComponent = -1 * Required component id the entities will have + * data.enabled = false * If the query is enabled by default + */ +TriggerPoint.prototype.RegisterRangeTrigger = function(action, data) +{ + + if (data.players) + var players = data.players; + else + { + var numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers(); + var players = []; + for (var i = 0; i < numPlayers; i++) + players.push(i); + } + var minRange = data.minRange || 0; + var maxRange = data.maxRange || -1; + var cid = data.requiredComponent || -1; + + var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); + var tag = cmpRangeManager.CreateActiveQuery(this.entity, minRange, maxRange, players, cid, cmpRangeManager.GetEntityFlagMask("normal")); + + this.currentCollections[tag] = []; + this.actions[tag] = action; + return tag; +}; + +TriggerPoint.prototype.OnRangeUpdate = function(msg) +{ + var collection = this.currentCollections[msg.tag]; + if (!collection) + return; + + for (var ent of msg.removed) + { + var index = collection.indexOf(ent); + if (index > -1) + collection.splice(index, 1); + } + + for each (var entity in msg.added) + collection.push(entity); + + var r = {"currentCollection": collection.slice()}; + r.added = msg.added; + r.removed = msg.removed; + var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); + cmpTrigger.DoAction({"action":this.actions[msg.tag], "data": r}); +}; + + +Engine.RegisterComponentType(IID_TriggerPoint, "TriggerPoint", TriggerPoint); diff --git a/binaries/data/mods/public/simulation/components/interfaces/Trigger.js b/binaries/data/mods/public/simulation/components/interfaces/Trigger.js new file mode 100644 index 0000000000..a8b21083cf --- /dev/null +++ b/binaries/data/mods/public/simulation/components/interfaces/Trigger.js @@ -0,0 +1 @@ +Engine.RegisterInterface("Trigger"); diff --git a/binaries/data/mods/public/simulation/components/interfaces/TriggerPoint.js b/binaries/data/mods/public/simulation/components/interfaces/TriggerPoint.js new file mode 100644 index 0000000000..1d0fb6d7ab --- /dev/null +++ b/binaries/data/mods/public/simulation/components/interfaces/TriggerPoint.js @@ -0,0 +1,2 @@ +Engine.RegisterInterface("TriggerPoint"); + diff --git a/binaries/data/mods/public/simulation/helpers/Commands.js b/binaries/data/mods/public/simulation/helpers/Commands.js index ca84f0e588..2f9f5c97de 100644 --- a/binaries/data/mods/public/simulation/helpers/Commands.js +++ b/binaries/data/mods/public/simulation/helpers/Commands.js @@ -31,7 +31,12 @@ function ProcessCommand(player, cmd) // Now handle various commands if (commands[cmd.type]) + { + var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); + if (cmpTrigger) + cmpTrigger.CallEvent("PlayerCommand", {"player": player, "cmd": cmd}); commands[cmd.type](player, cmd, data); + } else error("Invalid command: unknown command type: "+uneval(cmd)); } diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_A.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_A.xml index a42a0b6f53..034a4fe448 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_A.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_A.xml @@ -1,5 +1,8 @@ + + A + props/special/common/marker_object_char_a.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_B.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_B.xml index 5f2e80dfbe..f7c22ceb70 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_B.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_B.xml @@ -1,5 +1,8 @@ + + B + props/special/common/marker_object_char_b.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_C.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_C.xml index 9171b47a85..6ea8861e00 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_C.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_C.xml @@ -1,5 +1,8 @@ + + C + props/special/common/marker_object_char_c.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_D.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_D.xml index 8006b15965..eaf0dbcf4d 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_D.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_D.xml @@ -1,5 +1,8 @@ + + D + props/special/common/marker_object_char_d.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_E.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_E.xml index e548fc0280..c81f87862d 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_E.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_E.xml @@ -1,5 +1,8 @@ + + E + props/special/common/marker_object_char_e.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_F.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_F.xml index ede9d2ce34..a25f577725 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_F.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_F.xml @@ -1,5 +1,8 @@ + + F + props/special/common/marker_object_char_f.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_G.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_G.xml index bdf9fa4e67..ec91d96174 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_G.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_G.xml @@ -1,5 +1,8 @@ + + G + props/special/common/marker_object_char_g.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_H.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_H.xml index f053e8835a..e6753bddaa 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_H.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_H.xml @@ -1,5 +1,8 @@ + + H + props/special/common/marker_object_char_h.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_I.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_I.xml index 39a4a5f7cc..d410bf27e1 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_I.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_I.xml @@ -1,5 +1,8 @@ + + I + props/special/common/marker_object_char_i.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_J.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_J.xml index 5523ad569b..7161f2b5f3 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_J.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_J.xml @@ -1,5 +1,8 @@ + + J + props/special/common/marker_object_char_j.xml diff --git a/binaries/data/mods/public/simulation/templates/special/trigger_point_K.xml b/binaries/data/mods/public/simulation/templates/special/trigger_point_K.xml index e19e926a09..ab0ff3c11b 100644 --- a/binaries/data/mods/public/simulation/templates/special/trigger_point_K.xml +++ b/binaries/data/mods/public/simulation/templates/special/trigger_point_K.xml @@ -1,5 +1,8 @@ + + K + props/special/common/marker_object_char_k.xml diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp index 75976cb298..a62a38f210 100644 --- a/source/simulation2/Simulation2.cpp +++ b/source/simulation2/Simulation2.cpp @@ -702,6 +702,19 @@ void CSimulation2::LoadMapSettings() if (!m->m_StartupScript.empty()) GetScriptInterface().LoadScript(L"map startup script", m->m_StartupScript); + + // Load the trigger script after we have loaded the simulation and the map. + if (GetScriptInterface().HasProperty(m->m_MapSettings.get(), "TriggerScripts")) + { + std::vector scriptNames; + GetScriptInterface().GetProperty(m->m_MapSettings.get(), "TriggerScripts", scriptNames); + for (u32 i = 0; i < scriptNames.size(); i++) + { + std::string scriptName = "maps/" + scriptNames[i]; + LOGMESSAGE(L"Loading trigger script '%hs'", scriptName.c_str()); + m->m_ComponentManager.LoadScript(scriptName.data()); + } + } } int CSimulation2::ProgressiveLoad()