Index: binaries/data/mods/public/globalscripts/Templates.js =================================================================== --- binaries/data/mods/public/globalscripts/Templates.js +++ binaries/data/mods/public/globalscripts/Templates.js @@ -24,9 +24,12 @@ continue; const template = Engine.GetTemplate("special/players/" + data.Code); - data.Name = template.Identity.GenericName; - data.Emblem = "session/portraits/" + template.Identity.Icon; - data.History = template.Identity.History; + if (template.Identity) + { + data.Name = template.Identity.GenericName; + data.Emblem = "session/portraits/" + template.Identity.Icon; + data.History = template.Identity.History; + } civData[data.Code] = data; } @@ -41,6 +44,7 @@ { let classString = ""; + warn(uneval(template)) if (template.Classes && template.Classes._string) classString += " " + template.Classes._string; Index: binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js =================================================================== --- binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js +++ binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js @@ -137,10 +137,7 @@ Trigger.prototype.SetDisableTemplates = function() { for (let i = 1; i < TriggerHelper.GetNumberOfPlayers(); ++i) - { - let cmpPlayer = QueryPlayerIDInterface(i); - cmpPlayer.SetDisabledTemplates(disabledTemplates(cmpPlayer.GetCiv())); - } + QueryPlayerIDInterface(i).SetDisabledTemplates(disabledTemplates(QueryPlayerIDInterface(i, IID_Identity).GetCiv())); }; /** Index: binaries/data/mods/public/maps/random/tests/test_Constraint.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_Constraint.js +++ binaries/data/mods/public/maps/random/tests/test_Constraint.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js +++ binaries/data/mods/public/maps/random/tests/test_DiskPlacer.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); { Index: binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js +++ binaries/data/mods/public/maps/random/tests/test_LayeredPainter.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/random/tests/test_RectPlacer.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_RectPlacer.js +++ binaries/data/mods/public/maps/random/tests/test_RectPlacer.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js +++ binaries/data/mods/public/maps/random/tests/test_SmoothingPainter.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/random/tests/test_TileClass.js =================================================================== --- binaries/data/mods/public/maps/random/tests/test_TileClass.js +++ binaries/data/mods/public/maps/random/tests/test_TileClass.js @@ -1,13 +1,3 @@ -Engine.GetTemplate = (path) => { - return { - "Identity": { - "GenericName": null, - "Icon": null, - "History": null - } - }; -}; - Engine.LoadLibrary("rmgen"); var g_MapSettings = { "Size": 512 }; Index: binaries/data/mods/public/maps/scripts/Regicide.js =================================================================== --- binaries/data/mods/public/maps/scripts/Regicide.js +++ binaries/data/mods/public/maps/scripts/Regicide.js @@ -5,7 +5,7 @@ let playersCivs = []; for (let playerID = 1; playerID < TriggerHelper.GetNumberOfPlayers(); ++playerID) - playersCivs[playerID] = QueryPlayerIDInterface(playerID).GetCiv(); + playersCivs[playerID] = QueryPlayerIDInterface(playerID, IID_Identity).GetCiv(); // Get all hero templates of these civs let heroTemplates = {}; Index: binaries/data/mods/public/simulation/ai/common-api/shared.js =================================================================== --- binaries/data/mods/public/simulation/ai/common-api/shared.js +++ binaries/data/mods/public/simulation/ai/common-api/shared.js @@ -52,7 +52,7 @@ m.SharedScript.prototype.GetTemplate = function(name) { if (this._templates[name] === undefined) - this._templates[name] = Engine.GetTemplate(name) || null; + this._templates[name] = SimEngine.GetTemplate(name) || null; return this._templates[name]; }; Index: source/graphics/MapGenerator.h =================================================================== --- source/graphics/MapGenerator.h +++ source/graphics/MapGenerator.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2022 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -20,7 +20,6 @@ #include "ps/FileIo.h" #include "ps/Future.h" -#include "ps/TemplateLoader.h" #include "scriptinterface/StructuredClone.h" #include @@ -157,16 +156,6 @@ double GetMicroseconds(); /** - * Return the template data of the given template name. - */ - CParamNode GetTemplate(const std::string& templateName); - - /** - * Check whether the given template exists. - */ - bool TemplateExists(const std::string& templateName); - - /** * Returns all template names of simulation entity templates. */ std::vector FindTemplates(const std::string& path, bool includeSubdirectories); @@ -217,11 +206,6 @@ std::string m_Settings; /** - * Backend to loading template data. - */ - CTemplateLoader m_TemplateLoader; - - /** * Holds the completion result of the asynchronous map generation. * TODO: this whole class could really be a future on its own. */ Index: source/graphics/MapGenerator.cpp =================================================================== --- source/graphics/MapGenerator.cpp +++ source/graphics/MapGenerator.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2022 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -31,6 +31,8 @@ #include "ps/FileIo.h" #include "ps/Profile.h" #include "ps/TaskManager.h" +#include "ps/TemplateLoader.h" +#include "ps/scripting/JSInterface_Templates.h" #include "ps/scripting/JSInterface_VFS.h" #include "scriptinterface/FunctionWrapper.h" #include "scriptinterface/ScriptContext.h" @@ -169,7 +171,7 @@ m_ScriptInterface->ReplaceNondeterministicRNG(m_MapGenRNG); m_MapGenRNG.seed(seed); - // VFS + JSI_Templates::RegisterScriptFunctions_Maps(*m_ScriptInterface); JSI_VFS::RegisterScriptFunctions_Maps(*m_ScriptInterface); // Globalscripts may use VFS script functions @@ -196,8 +198,6 @@ ScriptRequest rq(m_ScriptInterface); // Template functions - REGISTER_MAPGEN_FUNC(GetTemplate); - REGISTER_MAPGEN_FUNC(TemplateExists); REGISTER_MAPGEN_FUNC(FindTemplates); REGISTER_MAPGEN_FUNC(FindActorTemplates); @@ -246,28 +246,14 @@ LOGWARNING("The random map script tried to reduce the loading progress from %d to %d", m_Progress, progress); } -CParamNode CMapGeneratorWorker::GetTemplate(const std::string& templateName) -{ - const CParamNode& templateRoot = m_TemplateLoader.GetTemplateFileData(templateName).GetChild("Entity"); - if (!templateRoot.IsOk()) - LOGERROR("Invalid template found for '%s'", templateName.c_str()); - - return templateRoot; -} - -bool CMapGeneratorWorker::TemplateExists(const std::string& templateName) -{ - return m_TemplateLoader.TemplateExists(templateName); -} - std::vector CMapGeneratorWorker::FindTemplates(const std::string& path, bool includeSubdirectories) { - return m_TemplateLoader.FindTemplates(path, includeSubdirectories, SIMULATION_TEMPLATES); + return g_TemplateLoader.FindTemplates(path, includeSubdirectories, SIMULATION_TEMPLATES); } std::vector CMapGeneratorWorker::FindActorTemplates(const std::string& path, bool includeSubdirectories) { - return m_TemplateLoader.FindTemplates(path, includeSubdirectories, ACTOR_TEMPLATES); + return g_TemplateLoader.FindTemplates(path, includeSubdirectories, ACTOR_TEMPLATES); } bool CMapGeneratorWorker::LoadScripts(const VfsPath& libraryName) Index: source/gui/GUIManager.h =================================================================== --- source/gui/GUIManager.h +++ source/gui/GUIManager.h @@ -21,7 +21,6 @@ #include "lib/file/vfs/vfs_path.h" #include "lib/input.h" #include "ps/CStr.h" -#include "ps/TemplateLoader.h" #include "scriptinterface/StructuredClone.h" #include @@ -115,16 +114,6 @@ void UpdateResolution(); /** - * Check if a template with this name exists - */ - bool TemplateExists(const std::string& templateName) const; - - /** - * Retrieve the requested template, used for displaying faction specificities. - */ - const CParamNode& GetTemplate(const std::string& templateName); - - /** * Display progress / description in loading screen. */ void DisplayLoadProgress(int percent, const wchar_t* pending_task); @@ -179,8 +168,6 @@ */ using PageStackType = std::deque; PageStackType m_PageStack; - - CTemplateLoader m_TemplateLoader; }; extern CGUIManager* g_GUI; Index: source/gui/GUIManager.cpp =================================================================== --- source/gui/GUIManager.cpp +++ source/gui/GUIManager.cpp @@ -408,20 +408,6 @@ } } -bool CGUIManager::TemplateExists(const std::string& templateName) const -{ - return m_TemplateLoader.TemplateExists(templateName); -} - -const CParamNode& CGUIManager::GetTemplate(const std::string& templateName) -{ - const CParamNode& templateRoot = m_TemplateLoader.GetTemplateFileData(templateName).GetChild("Entity"); - if (!templateRoot.IsOk()) - LOGERROR("Invalid template found for '%s'", templateName.c_str()); - - return templateRoot; -} - void CGUIManager::DisplayLoadProgress(int percent, const wchar_t* pending_task) { const ScriptInterface& scriptInterface = *(GetActiveGUI()->GetScriptInterface()); Index: source/gui/Scripting/JSInterface_GUIManager.cpp =================================================================== --- source/gui/Scripting/JSInterface_GUIManager.cpp +++ source/gui/Scripting/JSInterface_GUIManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2022 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -63,16 +63,6 @@ g_VideoMode.ResetCursor(); } -bool TemplateExists(const std::string& templateName) -{ - return g_GUI->TemplateExists(templateName); -} - -CParamNode GetTemplate(const std::string& templateName) -{ - return g_GUI->GetTemplate(templateName); -} - void RegisterScriptFunctions(const ScriptRequest& rq) { @@ -81,8 +71,6 @@ ScriptFunction::Register<&PopGuiPage>(rq, "PopGuiPage"); ScriptFunction::Register<&SetCursor>(rq, "SetCursor"); ScriptFunction::Register<&ResetCursor>(rq, "ResetCursor"); - ScriptFunction::Register<&TemplateExists>(rq, "TemplateExists"); - ScriptFunction::Register<&GetTemplate>(rq, "GetTemplate"); ScriptFunction::Register<&CGUI::FindObjectByName, &ScriptInterface::ObjectFromCBData>(rq, "GetGUIObjectByName"); ScriptFunction::Register<&CGUI::SetGlobalHotkey, &ScriptInterface::ObjectFromCBData>(rq, "SetGlobalHotkey"); Index: source/gui/Scripting/ScriptFunctions.cpp =================================================================== --- source/gui/Scripting/ScriptFunctions.cpp +++ source/gui/Scripting/ScriptFunctions.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2022 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -34,6 +34,7 @@ #include "ps/scripting/JSInterface_Mod.h" #include "ps/scripting/JSInterface_ModIo.h" #include "ps/scripting/JSInterface_SavedGame.h" +#include "ps/scripting/JSInterface_Templates.h" #include "ps/scripting/JSInterface_UserReport.h" #include "ps/scripting/JSInterface_VFS.h" #include "ps/scripting/JSInterface_VisualReplay.h" @@ -70,6 +71,7 @@ JSI_SavedGame::RegisterScriptFunctions(rq); JSI_Simulation::RegisterScriptFunctions(rq); JSI_Sound::RegisterScriptFunctions(rq); + JSI_Templates::RegisterScriptFunctions_GUI(rq); JSI_UserReport::RegisterScriptFunctions(rq); JSI_VFS::RegisterScriptFunctions_GUI(rq); JSI_VisualReplay::RegisterScriptFunctions(rq); Index: source/ps/TemplateLoader.h =================================================================== --- source/ps/TemplateLoader.h +++ source/ps/TemplateLoader.h @@ -18,6 +18,7 @@ #ifndef INCLUDED_TEMPLATELOADER #define INCLUDED_TEMPLATELOADER +#include "ps/Singleton.h" #include "simulation2/system/ParamNode.h" #include @@ -44,7 +45,7 @@ * * TODO: Find a way to validate templates outside of the simulation. */ -class CTemplateLoader +class CTemplateLoader : public Singleton { public: CTemplateLoader() @@ -98,4 +99,6 @@ std::unordered_map m_TemplateFileData; }; +#define g_TemplateLoader CTemplateLoader::GetSingleton() + #endif // INCLUDED_TEMPLATELOADER Index: source/ps/XML/Xeromyces.cpp =================================================================== --- source/ps/XML/Xeromyces.cpp +++ source/ps/XML/Xeromyces.cpp @@ -28,6 +28,7 @@ #include "ps/CacheLoader.h" #include "ps/CLogger.h" #include "ps/Filesystem.h" +#include "ps/TemplateLoader.h" #include "RelaxNG.h" #include "Xeromyces.h" @@ -60,11 +61,13 @@ std::lock_guard lock(g_ValidatorCacheLock); g_ValidatorCache.insert(std::make_pair(std::string(), RelaxNGValidator())); g_XeromycesStarted = true; + new CTemplateLoader(); } void CXeromyces::Terminate() { ENSURE(g_XeromycesStarted); + delete& g_TemplateLoader; g_XeromycesStarted = false; ClearSchemaCache(); std::lock_guard lock(g_ValidatorCacheLock); Index: source/ps/scripting/JSInterface_Templates.h =================================================================== --- source/ps/scripting/JSInterface_Templates.h +++ source/ps/scripting/JSInterface_Templates.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2022 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * 0 A.D. is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with 0 A.D. If not, see . + */ + +#ifndef INCLUDED_JSI_Templates +#define INCLUDED_JSI_Templates + +class ScriptRequest; + +namespace JSI_Templates +{ + void RegisterScriptFunctions_GUI(const ScriptRequest& rq); + void RegisterScriptFunctions_Simulation(const ScriptRequest& rq); + void RegisterScriptFunctions_Maps(const ScriptRequest& rq); +} + +#endif // INCLUDED_JSI_Templates Index: source/ps/scripting/JSInterface_Templates.cpp =================================================================== --- source/ps/scripting/JSInterface_Templates.cpp +++ source/ps/scripting/JSInterface_Templates.cpp @@ -0,0 +1,77 @@ +/* Copyright (C) 2022 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * 0 A.D. is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with 0 A.D. If not, see . + */ + +#include "precompiled.h" + +#include "JSInterface_Templates.h" + +#include "ps/Game.h" +#include "ps/TemplateLoader.h" +#include "scriptinterface/FunctionWrapper.h" +#include "simulation2/components/ICmpTemplateManager.h" +#include "simulation2/Simulation2.h" +#include "simulation2/system/ParamNode.h" + +namespace JSI_Templates +{ + +bool TemplateExists(const std::string& templateName) +{ + return g_TemplateLoader.TemplateExists(templateName); +} + +CParamNode GetTemplateFromFile(const std::string& templateName) +{ + if (!g_TemplateLoader.TemplateExists(templateName)) + return CParamNode(false); + const CParamNode& templateRoot = g_TemplateLoader.GetTemplateFileData(templateName).GetChild("Entity"); + if (!templateRoot.IsOk()) + LOGERROR("Invalid template found for '%s'", templateName.c_str()); + return templateRoot; +} + +const CParamNode GetTemplateFromManager(const std::string& templateName) +{ + if (!g_Game) + return CParamNode(false); + + CmpPtr cmpTemplateManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY); + if (!cmpTemplateManager || !cmpTemplateManager->TemplateExists(templateName)) + return CParamNode(false); + + const CParamNode& entityTemplate = *cmpTemplateManager->GetTemplate(templateName); + return entityTemplate; +} + +void RegisterScriptFunctions_GUI(const ScriptRequest& rq) +{ + ScriptFunction::Register<&TemplateExists>(rq, "TemplateExists"); + ScriptFunction::Register<&GetTemplateFromFile>(rq, "GetTemplate"); +} + +void RegisterScriptFunctions_Simulation(const ScriptRequest& rq) +{ + ScriptFunction::Register<&TemplateExists>(rq, "TemplateExists"); + ScriptFunction::Register<&GetTemplateFromManager>(rq, "GetTemplate"); +} + +void RegisterScriptFunctions_Maps(const ScriptRequest& rq) +{ + ScriptFunction::Register<&TemplateExists>(rq, "TemplateExists"); + ScriptFunction::Register<&GetTemplateFromFile>(rq, "GetTemplate"); +} +} Index: source/rlinterface/RLInterface.cpp =================================================================== --- source/rlinterface/RLInterface.cpp +++ source/rlinterface/RLInterface.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2022 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -33,6 +33,7 @@ #include "simulation2/components/ICmpAIInterface.h" #include "simulation2/components/ICmpTemplateManager.h" #include "simulation2/system/LocalTurnManager.h" +#include "simulation2/system/ParamNode.h" #include #include Index: source/simulation2/components/CCmpAIManager.cpp =================================================================== --- source/simulation2/components/CCmpAIManager.cpp +++ source/simulation2/components/CCmpAIManager.cpp @@ -30,7 +30,6 @@ #include "ps/Filesystem.h" #include "ps/Profile.h" #include "ps/scripting/JSInterface_VFS.h" -#include "ps/TemplateLoader.h" #include "ps/Util.h" #include "scriptinterface/FunctionWrapper.h" #include "scriptinterface/ScriptContext.h" @@ -266,7 +265,6 @@ REGISTER_FUNC_NAME(ComputePathScript, "ComputePath"); REGISTER_FUNC_NAME(DumpImage, "DumpImage"); - REGISTER_FUNC_NAME(GetTemplate, "GetTemplate"); #undef REGISTER_FUNC_NAME @@ -350,13 +348,6 @@ waypoints.emplace_back(wp.x, wp.z); } - CParamNode GetTemplate(const std::string& name) - { - if (!m_TemplateLoader.TemplateExists(name)) - return CParamNode(false); - return m_TemplateLoader.GetTemplateFileData(name).GetChild("Entity"); - } - /** * Debug function for AI scripts to dump 2D array data (e.g. terrain tile weights). */ @@ -859,8 +850,6 @@ LongPathfinder m_LongPathfinder; bool m_CommandsComputed; - - CTemplateLoader m_TemplateLoader; }; Index: source/simulation2/components/CCmpTemplateManager.cpp =================================================================== --- source/simulation2/components/CCmpTemplateManager.cpp +++ source/simulation2/components/CCmpTemplateManager.cpp @@ -120,9 +120,6 @@ std::vector GetEntitiesUsingTemplate(const std::string& templateName) const override; private: - // Template loader - CTemplateLoader m_templateLoader; - // Entity template XML validator RelaxNGValidator m_Validator; @@ -150,9 +147,12 @@ const CParamNode* CCmpTemplateManager::GetTemplate(const std::string& templateName) { - const CParamNode& fileData = m_templateLoader.GetTemplateFileData(templateName); + const CParamNode& fileData = g_TemplateLoader.GetTemplateFileData(templateName); if (!fileData.IsOk()) + { + LOGERROR("Invalid file data for template '%s'.", templateName.c_str()); return NULL; + } if (!m_DisableValidation) { @@ -183,7 +183,7 @@ const CParamNode* CCmpTemplateManager::GetTemplateWithoutValidation(const std::string& templateName) { - const CParamNode& templateRoot = m_templateLoader.GetTemplateFileData(templateName).GetChild("Entity"); + const CParamNode& templateRoot = g_TemplateLoader.GetTemplateFileData(templateName).GetChild("Entity"); if (!templateRoot.IsOk()) return NULL; @@ -192,7 +192,7 @@ bool CCmpTemplateManager::TemplateExists(const std::string& templateName) const { - return m_templateLoader.TemplateExists(templateName); + return g_TemplateLoader.TemplateExists(templateName); } const CParamNode* CCmpTemplateManager::LoadLatestTemplate(entity_id_t ent) @@ -214,14 +214,14 @@ std::vector CCmpTemplateManager::FindAllTemplates(bool includeActors) const { ETemplatesType templatesType = includeActors ? ALL_TEMPLATES : SIMULATION_TEMPLATES; - return m_templateLoader.FindTemplates("", true, templatesType); + return g_TemplateLoader.FindTemplates("", true, templatesType); } std::vector> CCmpTemplateManager::GetCivData() { std::vector> data; - std::vector names = m_templateLoader.FindTemplatesUnrestricted("special/players/", false); + std::vector names = g_TemplateLoader.FindTemplatesUnrestricted("special/players/", false); data.reserve(names.size()); for (const std::string& name : names) { Index: source/simulation2/system/ComponentManager.cpp =================================================================== --- source/simulation2/system/ComponentManager.cpp +++ source/simulation2/system/ComponentManager.cpp @@ -23,6 +23,7 @@ #include "ps/CLogger.h" #include "ps/Filesystem.h" #include "ps/Profile.h" +#include "ps/scripting/JSInterface_Templates.h" #include "ps/scripting/JSInterface_VFS.h" #include "scriptinterface/FunctionWrapper.h" #include "simulation2/components/ICmpTemplateManager.h" @@ -68,6 +69,7 @@ // these functions, so we skip registering them here in those cases if (!skipScriptFunctions) { + JSI_Templates::RegisterScriptFunctions_Simulation(m_ScriptInterface); JSI_VFS::RegisterScriptFunctions_Simulation(m_ScriptInterface); ScriptRequest rq(m_ScriptInterface); constexpr ScriptFunction::ObjectGetter Getter = &ScriptInterface::ObjectFromCBData;