diff --git a/.building/lua-language-server-3.6.18-win32-x64/meta/3rd/Cocos4.0/library/cc/FileUtils.lua b/.building/lua-language-server-3.6.18-win32-x64/meta/3rd/Cocos4.0/library/cc/FileUtils.lua index 290756c30..d39798ecb 100644 --- a/.building/lua-language-server-3.6.18-win32-x64/meta/3rd/Cocos4.0/library/cc/FileUtils.lua +++ b/.building/lua-language-server-3.6.18-win32-x64/meta/3rd/Cocos4.0/library/cc/FileUtils.lua @@ -1,6 +1,5 @@ ----@meta - ----@class cc.FileUtils +---@meta cc.FileUtils +---@class cc.FileUtils local FileUtils={ } cc.FileUtils=FileUtils @@ -128,7 +127,7 @@ function FileUtils:loadFilenameLookupDictionaryFromFile (filename) end ---* return True if pop up a message box when failed to load an image, false if not. ---@return boolean function FileUtils:isPopupNotify () end ----* +---* ---@param filename string ---@return array_table function FileUtils:getValueVectorFromFile (filename) end @@ -340,4 +339,4 @@ function FileUtils:listFilesRecursively (dirPath,files) end function FileUtils:destroyInstance () end ---* Gets the instance of FileUtils. ---@return self -function FileUtils:getInstance () end \ No newline at end of file +function FileUtils:getInstance () end diff --git a/.vscode/settings.json b/.vscode/settings.json index f0cc52241..b6dcf752e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -73,5 +73,6 @@ "setmetatable", "winapi", "zstd" - ] + ], + "prettier.printWidth": 110 } diff --git a/mods/noita-mp/files/scripts/Gui.lua b/mods/noita-mp/files/scripts/Gui.lua index 3a6c82f67..4a31d4bb8 100644 --- a/mods/noita-mp/files/scripts/Gui.lua +++ b/mods/noita-mp/files/scripts/Gui.lua @@ -558,7 +558,7 @@ function Gui:drawSettings() end if self.showSettingsSaved then self.imGui.SameLine() - self.imGui.Text(("Saved into '%s'!"):format(self.fileUtils.GetRelativePathOfNoitaMpSettingsDirectory())) + self.imGui.Text(("Saved into '%s'!"):format(self.fileUtils:GetRelativePathOfNoitaMpSettingsDirectory())) if GameGetRealWorldTimeSinceStarted() >= self.showSettingsSavedTimer + 10 then self.showSettingsSaved = false self.showSettingsSavedTimer = GameGetRealWorldTimeSinceStarted() @@ -598,7 +598,7 @@ function Gui:drawAbout() self.shortcuts.bugReport .. ".") self.imGui.Separator() - self.imGui.Text("NoitaMP - Noita Multiplayer version " .. self.fileUtils.GetVersionByFile()) + self.imGui.Text("NoitaMP - Noita Multiplayer version " .. self.fileUtils:GetVersionByFile()) self.imGui.Text("Made by Ismoh#0815 and many other awesome contributers!") self.imGui.Text("Homepage: https://github.com/Ismoh/NoitaMP") self.imGui.SameLine() diff --git a/mods/noita-mp/files/scripts/NoitaMpSettings.lua b/mods/noita-mp/files/scripts/NoitaMpSettings.lua index 2d6476124..3c165d181 100644 --- a/mods/noita-mp/files/scripts/NoitaMpSettings.lua +++ b/mods/noita-mp/files/scripts/NoitaMpSettings.lua @@ -1,25 +1,6 @@ --- NoitaMpSettings: Replacement for Noita ModSettings. --- @class NoitaMpSettings local NoitaMpSettings = { - --[[ Imports ]] - - ---@type CustomProfiler - customProfiler = nil, - ---@type Gui - gui = nil, - ---@type FileUtils - fileUtils = nil, - ---@type json - json = nil, - ---@type LuaFileSystem - lfs = nil, - ---@type Logger - logger = nil, - ---@type Utils - utils = nil, - ---@type winapi - winapi = nil, - --[[ Attributes ]] ---Settings cache. Makes it possible to access settings without reading the file every time. @@ -62,17 +43,17 @@ local once = false ---@param self NoitaMpSettings required ---@return string path local getSettingsFilePath = function(self) - local path = ("%s%ssettings.json"):format(self.fileUtils.GetAbsolutePathOfNoitaMpSettingsDirectory(), pathSeparator) + local path = ("%s%ssettings.json"):format(self.fileUtils:GetAbsolutePathOfNoitaMpSettingsDirectory(), pathSeparator) if self:isMoreThanOneNoitaProcessRunning() then local defaultSettings = nil - if self.fileUtils.Exists(path) and not once then - defaultSettings = self.fileUtils.ReadFile(path) + if self.fileUtils:Exists(path) and not once then + defaultSettings = self.fileUtils:ReadFile(path) end path = ("%s%slocal%ssettings-%s.json") - :format(self.fileUtils.GetAbsolutePathOfNoitaMpSettingsDirectory(), pathSeparator, pathSeparator, self.winapi.get_current_pid()) + :format(self.fileUtils:GetAbsolutePathOfNoitaMpSettingsDirectory(), pathSeparator, pathSeparator, self.winapi.get_current_pid()) if defaultSettings then - self.fileUtils.WriteFile(path, defaultSettings) + self.fileUtils:WriteFile(path, defaultSettings) once = true end end @@ -100,9 +81,9 @@ end ---Removes all settings and creates a new settings file. function NoitaMpSettings:clearAndCreateSettings() local cpc = self.customProfiler:start("NoitaMpSettings.clearAndCreateSettings") - local settingsDir = ("%s%slocal"):format(self.fileUtils.GetAbsolutePathOfNoitaMpSettingsDirectory(), pathSeparator) --FileUtils.GetAbsolutePathOfNoitaMpSettingsDirectory() - if self.fileUtils.Exists(settingsDir) then - self.fileUtils.RemoveContentOfDirectory(settingsDir) + local settingsDir = ("%s%slocal"):format(self.fileUtils:GetAbsolutePathOfNoitaMpSettingsDirectory(), pathSeparator) --FileUtils.GetAbsolutePathOfNoitaMpSettingsDirectory() + if self.fileUtils:Exists(settingsDir) then + self.fileUtils:RemoveContentOfDirectory(settingsDir) self.logger:info(self.logger.channels.initialize, ("Removed old settings in '%s'!"):format(settingsDir)) else self.lfs.mkdir(settingsDir) @@ -122,7 +103,7 @@ function NoitaMpSettings:set(key, value) end local settingsFilePath = getSettingsFilePath(self) - if self.utils.IsEmpty(self.cachedSettings) or not self.fileUtils.Exists(settingsFilePath) then + if self.utils.IsEmpty(self.cachedSettings) or not self.fileUtils:Exists(settingsFilePath) then self:load() end @@ -140,7 +121,7 @@ function NoitaMpSettings:get(key, dataType) local cpc = self.customProfiler:start("NoitaMpSettings.get") local settingsFilePath = getSettingsFilePath(self) - if self.utils.IsEmpty(self.cachedSettings) or not self.fileUtils.Exists(settingsFilePath) then + if self.utils.IsEmpty(self.cachedSettings) or not self.fileUtils:Exists(settingsFilePath) then self:load() end @@ -157,11 +138,11 @@ end function NoitaMpSettings:load() local settingsFilePath = getSettingsFilePath(self) - if not self.fileUtils.Exists(settingsFilePath) then + if not self.fileUtils:Exists(settingsFilePath) then self:save() end - local contentString = self.fileUtils.ReadFile(settingsFilePath) + local contentString = self.fileUtils:ReadFile(settingsFilePath) self.cachedSettings = self.json.decode(contentString) end @@ -172,7 +153,7 @@ function NoitaMpSettings:save() self.cachedSettings["pid"] = self.winapi.get_current_pid() end - self.fileUtils.WriteFile(settingsFilePath, self.json.encode(self.cachedSettings)) + self.fileUtils:WriteFile(settingsFilePath, self.json.encode(self.cachedSettings)) if self.gui then self.gui.setShowSettingsSaved(true) end @@ -193,18 +174,24 @@ function NoitaMpSettings:new(noitaMpSettings, customProfiler, gui, fileUtils, js ---@class NoitaMpSettings noitaMpSettings = setmetatable(noitaMpSettings or self, NoitaMpSettings) - -- Initialize all imports to avoid recursive imports + --[[ Imports ]] + --Initialize all imports to avoid recursive imports + if not noitaMpSettings.customProfiler then - noitaMpSettings.customProfiler = customProfiler or require("CustomProfiler"):new(nil, nil, self, nil, nil, nil, nil) + ---@type CustomProfiler + ---@see CustomProfiler + noitaMpSettings.customProfiler = customProfiler or + require("CustomProfiler") + :new(nil, nil, noitaMpSettings, nil, nil, nil, nil) end local cpc = noitaMpSettings.customProfiler:start("NoitaMpSettings:new") if not noitaMpSettings.gui then - noitaMpSettings.gui = gui --or error("NoitaMpSettings:new requires a Gui object", 2) + noitaMpSettings.gui = gui or error("NoitaMpSettings:new requires a Gui object", 2) end if not noitaMpSettings.fileUtils then - noitaMpSettings.fileUtils = fileUtils or self.customProfiler.fileUtils or require("FileUtils") --:new() + noitaMpSettings.fileUtils = fileUtils or noitaMpSettings.customProfiler.fileUtils or require("FileUtils") --:new() end if not noitaMpSettings.json then @@ -216,15 +203,15 @@ function NoitaMpSettings:new(noitaMpSettings, customProfiler, gui, fileUtils, js end if not noitaMpSettings.logger then - noitaMpSettings.logger = logger or require("Logger"):new(nil, self.customProfiler) + noitaMpSettings.logger = logger or require("Logger"):new(nil, noitaMpSettings.customProfiler) end if not noitaMpSettings.utils then - noitaMpSettings.utils = utils or self.customProfiler.utils or require("Utils") --:new() + noitaMpSettings.utils = utils or noitaMpSettings.customProfiler.utils or require("Utils") --:new() end if not noitaMpSettings.winapi then - noitaMpSettings.winapi = winapi or self.customProfiler.winapi or require("winapi") + noitaMpSettings.winapi = winapi or noitaMpSettings.customProfiler.winapi or require("winapi") end noitaMpSettings.customProfiler:stop("ExampleClass:new", cpc) diff --git a/mods/noita-mp/files/scripts/init/init_.lua b/mods/noita-mp/files/scripts/init/init_.lua index a2f1aa559..cf1c52ffa 100644 --- a/mods/noita-mp/files/scripts/init/init_.lua +++ b/mods/noita-mp/files/scripts/init/init_.lua @@ -22,7 +22,7 @@ local checkMandatoryDependencyMods = function() ---@class NoitaMpSettings local noitaMpSettings = require("NoitaMpSettings") :new(nil, nil, gui, nil, nil, nil, nil) - ---@class FileUtils + ---@type FileUtils local fileUtils = require("FileUtils") :new(nil, noitaMpSettings.customProfiler, nil, noitaMpSettings, nil, nil) diff --git a/mods/noita-mp/files/scripts/init/init_package_loading.lua b/mods/noita-mp/files/scripts/init/init_package_loading.lua index 9ab65eee5..4759a411b 100644 --- a/mods/noita-mp/files/scripts/init/init_package_loading.lua +++ b/mods/noita-mp/files/scripts/init/init_package_loading.lua @@ -157,7 +157,7 @@ if current_clib_extension then ---@class NoitaMpSettings local noitaMpSettings = require("NoitaMpSettings") :new(nil, nil, gui, nil, nil, nil, nil) - ---@class FileUtils + ---@type FileUtils local fileUtils = require("FileUtils") :new(nil, noitaMpSettings.customProfiler, nil, noitaMpSettings, nil, nil) diff --git a/mods/noita-mp/files/scripts/net/Client.lua b/mods/noita-mp/files/scripts/net/Client.lua index f14854537..024e716a8 100644 --- a/mods/noita-mp/files/scripts/net/Client.lua +++ b/mods/noita-mp/files/scripts/net/Client.lua @@ -998,7 +998,7 @@ function Client:new(clientObject, serverOrAddress, port, maxChannels, server) local cpc = clientObject.customProfiler:start("Client:new") if not clientObject.globalUtils then - clientObject.globalUtils = server.globalUtils or require("GlobalUtils") + clientObject.globalUtils = server.globalsUtils or require("GlobalUtils") end if not clientObject.networkCache then clientObject.networkCache = server.networkCache or error("Client:new requires a server object!", 2) diff --git a/mods/noita-mp/files/scripts/net/Server.lua b/mods/noita-mp/files/scripts/net/Server.lua index 054b75c6f..799434e71 100644 --- a/mods/noita-mp/files/scripts/net/Server.lua +++ b/mods/noita-mp/files/scripts/net/Server.lua @@ -961,13 +961,13 @@ function Server:getAckCacheSize() end ---Server constructor. Inherits from SockServer sock.newServer. ----@param serverObject Server ----@param address string|nil ----@param port number|nil ----@param maxPeers number|nil ----@param maxChannels number|nil ----@param inBandwidth number|nil ----@param outBandwidth number|nil +---@param serverObject Server|nil optional +---@param address string|nil optional +---@param port number|nil optional +---@param maxPeers number|nil optional +---@param maxChannels number|nil optional +---@param inBandwidth number|nil optional +---@param outBandwidth number|nil optional ---@return Server function Server:new(serverObject, address, port, maxPeers, maxChannels, inBandwidth, outBandwidth) ---@class Server : SockServer @@ -979,70 +979,106 @@ function Server:new(serverObject, address, port, maxPeers, maxChannels, inBandwi --Initialize all imports to avoid recursive imports if not serverObject.noitaMpSettings then + ---@type NoitaMpSettings serverObject.noitaMpSettings = require("NoitaMpSettings") :new(nil, nil, nil, nil, nil, nil, nil, nil, nil) end + if not serverObject.customProfiler then - serverObject.customProfiler = serverObject.noitaMpSettings.customProfiler or require("CustomProfiler") + ---@type CustomProfiler + serverObject.customProfiler = serverObject.noitaMpSettings.customProfiler or + require("CustomProfiler") :new(nil, nil, serverObject.noitaMpSettings, nil, nil, nil, nil) end local cpc = serverObject.customProfiler:start("Server:new") + if not serverObject.logger or type(serverObject.logger) ~= "Logger" then + ---@type Logger + serverObject.logger = serverObject.noitaMpSettings.logger or + require("Logger") + :new(nil, serverObject.customProfiler) or + error("serverObject.logger must not be nil!", 2) + end + if not serverObject.utils then - serverObject.utils = serverObject.noitaMpSettings.utils or error("serverObject.noitaMpSettings.utils must not be nil!", 2) + ---@type Utils + serverObject.utils = serverObject.noitaMpSettings.utils or + error("serverObject.noitaMpSettings.utils must not be nil!", 2) end - if not serverObject.logger then - serverObject.logger = serverObject.noitaMpSettings.logger or error("serverObject.noitaMpSettings.logger must not be nil!", 2) + + if not serverObject.globalsUtils then + ---@type GlobalsUtils + ---@see GlobalsUtils + serverObject.globalsUtils = require("GlobalsUtils") + :new(nil, serverObject.customProfiler, serverObject.logger, nil, serverObject.utils) or + error("Unable to create GlobalsUtils!", 2) + end + + if not serverObject.networkVscUtils then + ---@type NetworkVscUtils + serverObject.networkVscUtils = require("NetworkVscUtils") --:new() end if not serverObject.minaUtils then + ---@type MinaUtils serverObject.minaUtils = require("MinaUtils") - --:new() + :new(nil, serverObject.customProfiler, serverObject.globalsUtils, serverObject.logger, + serverObject.networkVscUtils, serverObject.noitaMpSettings, serverObject.noitaMpSettings.utils) or + error("Unable to create MinaUtils!", 2) end if not serverObject.nuidUtils then - serverObject.nuidUtils = require("NuidUtils") - --:new() - end - - if not serverObject.networkVscUtils then - serverObject.networkVscUtils = require("NetworkVscUtils") - --:new() + ---@type NuidUtils + serverObject.nuidUtils = require("NuidUtils") --:new() end if not serverObject.networkUtils then - serverObject.networkUtils = require("NetworkUtils") - --:new() + ---@type NetworkUtils + serverObject.networkUtils = require("NetworkUtils") --:new() end if not serverObject.networkCache then - serverObject.networkCache = require("NetworkCache") - --:new() + ---@type NetworkCache + serverObject.networkCache = require("NetworkCache") --:new() end if not serverObject.networkCacheUtils then - serverObject.networkCacheUtils = require("NetworkCacheUtils") - --:new() + ---@type NetworkCacheUtils + serverObject.networkCacheUtils = require("NetworkCacheUtils") --:new() end if not serverObject.noitaComponentUtils then - serverObject.noitaComponentUtils = require("NoitaComponentUtils") - --:new() + ---@type NoitaComponentUtils + serverObject.noitaComponentUtils = require("NoitaComponentUtils") --:new() end - if not serverObject.globalsUtils then - serverObject.globalsUtils = require("GlobalsUtils") - --:new() + if not serverObject.entityCache then + ---@type EntityCache + serverObject.entityCache = require("EntityCache") + :new(nil, serverObject.customProfiler, nil, serverObject.noitaMpSettings.utils) + end + + if not serverObject.entityCacheUtils then + ---@type EntityCacheUtils + ---@see EntityCacheUtils + serverObject.entityCacheUtils = require("EntityCacheUtils") + :new(nil, serverObject.customProfiler, serverObject.entityCache, serverObject.noitaMpSettings.utils) end if not serverObject.entityUtils then serverObject.entityUtils = require("EntityUtils") - :new(nil, {}, serverObject.customProfiler, nil, nil, serverObject.globalsUtils, - serverObject.noitaMpSettings.logger, serverObject.minaUtils, serverObject.networkUtils, serverObject.networkVscUtils, - serverObject.noitaComponentUtils, serverObject.nuidUtils, serverObject, serverObject.noitaMpSettings.utils) + :new(nil, {}, serverObject.customProfiler, serverObject.entityCacheUtils, serverObject.entityCache, + serverObject.globalsUtils, serverObject.noitaMpSettings.logger, serverObject.minaUtils, + serverObject.networkUtils, serverObject.networkVscUtils, serverObject.noitaComponentUtils, + serverObject.nuidUtils, serverObject, serverObject.noitaMpSettings.utils) or + error("Unable to create EntityUtils!", 2) + + serverObject.entityCache.entityUtils = serverObject.entityUtils end if not serverObject.fileUtils then + ---@type FileUtils + ---@see FileUtils serverObject.fileUtils = require("FileUtils") :new(nil, serverObject.customProfiler, serverObject.logger, serverObject.noitaMpSettings, nil, serverObject.utils) end diff --git a/mods/noita-mp/files/scripts/util/EntityCache.lua b/mods/noita-mp/files/scripts/util/EntityCache.lua index b238eaf0e..fe5f148a7 100644 --- a/mods/noita-mp/files/scripts/util/EntityCache.lua +++ b/mods/noita-mp/files/scripts/util/EntityCache.lua @@ -141,8 +141,7 @@ function EntityCache:new(entityCacheObject, customProfiler, entityUtils, utils) if not entityCacheObject.entityUtils then ---@type EntityUtils - entityCacheObject.entityUtils = entityUtils or - error("EntityCache:new requires 'entityUtils' as parameter!") + entityCacheObject.entityUtils = entityUtils end if not entityCacheObject.utils then diff --git a/mods/noita-mp/files/scripts/util/EntityCacheUtils.lua b/mods/noita-mp/files/scripts/util/EntityCacheUtils.lua index b1753c2a6..445f66194 100644 --- a/mods/noita-mp/files/scripts/util/EntityCacheUtils.lua +++ b/mods/noita-mp/files/scripts/util/EntityCacheUtils.lua @@ -53,10 +53,9 @@ end ---@param entityCacheUtilsObject EntityCacheUtils|nil optional ---@param customProfiler CustomProfiler required ---@param entityCache EntityCache required ----@param entityUtils EntityUtils required ---@param utils Utils|nil optional ---@return EntityCacheUtils -function EntityCacheUtils:new(entityCacheUtilsObject, customProfiler, entityCache, entityUtils, utils) +function EntityCacheUtils:new(entityCacheUtilsObject, customProfiler, entityCache, utils) ---@class EntityCacheUtils entityCacheUtilsObject = setmetatable(entityCacheUtilsObject or self, EntityCacheUtils) @@ -74,8 +73,7 @@ function EntityCacheUtils:new(entityCacheUtilsObject, customProfiler, entityCach if not entityCacheUtilsObject.entityCache then ---@type EntityCache entityCacheUtilsObject.entityCache = entityCache or - require("EntityCache") - :new(nil, customProfiler, entityUtils, utils) + error("EntityCacheUtils:new requires 'entityCache' as parameter!") end if not entityCacheUtilsObject.utils then ---@type Utils diff --git a/mods/noita-mp/files/scripts/util/EntityUtils.lua b/mods/noita-mp/files/scripts/util/EntityUtils.lua index 3674376e8..b9358712b 100644 --- a/mods/noita-mp/files/scripts/util/EntityUtils.lua +++ b/mods/noita-mp/files/scripts/util/EntityUtils.lua @@ -237,8 +237,8 @@ function EntityUtils:syncEntities(startFrameTime) if not self.networkVscUtils:isNetworkEntityByNuidVsc(entityId) or not self.networkVscUtils:hasNetworkLuaComponents(entityId) then - local ownerName = self.minaUtils:getLocalMinaName() - local ownerGuid = self.minaUtils:getLocalMinaGuid() + local ownerName = self.minaUtils:getLocalMinaName() + local ownerGuid = self.minaUtils:getLocalMinaGuid() if who == self.server.iAm and not hasNuid then nuid = self.nuidUtils:getNextNuid() @@ -565,7 +565,7 @@ end ---@return EntityUtils function EntityUtils:new(entityUtilsObject, client, customProfiler, enitityCacheUtils, entityCache, globalsUtils, logger, minaUtils, networkUtils, networkVscUtils, noitaComponentUtils, nuidUtils, server, utils) - ---@class EntityUtils + ---@type EntityUtils entityUtilsObject = setmetatable(entityUtilsObject or self, EntityUtils) -- Load config.lua diff --git a/mods/noita-mp/files/scripts/util/FileUtils.lua b/mods/noita-mp/files/scripts/util/FileUtils.lua index b2bf5a5f6..06895d195 100644 --- a/mods/noita-mp/files/scripts/util/FileUtils.lua +++ b/mods/noita-mp/files/scripts/util/FileUtils.lua @@ -648,7 +648,7 @@ end ---@param utils Utils|nil can be nil ---@return FileUtils function FileUtils:new(fileUtilsObject, customProfiler, logger, noitaMpSettings, plotly, utils) - ---@class FileUtils + ---@type FileUtils fileUtilsObject = setmetatable(fileUtilsObject or self, FileUtils) --[[ Imports ]] diff --git a/mods/noita-mp/files/scripts/util/GlobalsUtils.lua b/mods/noita-mp/files/scripts/util/GlobalsUtils.lua index 09d8d6b67..96b9351f1 100644 --- a/mods/noita-mp/files/scripts/util/GlobalsUtils.lua +++ b/mods/noita-mp/files/scripts/util/GlobalsUtils.lua @@ -143,14 +143,17 @@ end ---Constructor of the class. This is mandatory! ---@param globalsUtilsObject GlobalsUtils|nil optional ---@param customProfiler CustomProfiler required ----@param logger Logger|nil optional ----@param client Client required ----@param utils Utils|nil optional +---@param logger Logger required +---@param client Client|nil optional +---@param utils Utils required ---@return GlobalsUtils function GlobalsUtils:new(globalsUtilsObject, customProfiler, logger, client, utils) ---@class GlobalsUtils globalsUtilsObject = setmetatable(globalsUtilsObject or self, GlobalsUtils) + if not customProfiler then + error("GlobalsUtils:new requires customProfiler as parameter!") + end local cpc = customProfiler:start("GlobalsUtils:new") --[[ Imports ]] @@ -162,15 +165,20 @@ function GlobalsUtils:new(globalsUtilsObject, customProfiler, logger, client, ut end if not globalsUtilsObject.logger then ---@type Logger - globalsUtilsObject.logger = logger or require("Logger"):new(nil, customProfiler) + globalsUtilsObject.logger = logger or + error("GlobalsUtils:new requires logger as parameter!") end if not globalsUtilsObject.client then ---@type Client - globalsUtilsObject.client = client or error("GlobalsUtils:new requires client as parameter!") + globalsUtilsObject.client = client + if not globalsUtilsObject.client then + globalsUtilsObject.logger:warn(globalsUtilsObject.logger.channels.initialize, "Make sure to set globalsUtilsObject.client later on!") + end end if not globalsUtilsObject.utils then ---@type Utils - globalsUtilsObject.utils = utils or require("Utils") --:new(nil, customProfiler) + globalsUtilsObject.utils = utils or + error("GlobalsUtils:new requires utils as parameter!") end globalsUtilsObject.customProfiler:stop("GlobalsUtils:new", cpc) diff --git a/mods/noita-mp/files/scripts/util/GuidUtils.lua b/mods/noita-mp/files/scripts/util/GuidUtils.lua index dc8237a60..d6bd497ec 100644 --- a/mods/noita-mp/files/scripts/util/GuidUtils.lua +++ b/mods/noita-mp/files/scripts/util/GuidUtils.lua @@ -23,6 +23,7 @@ end ---Generates a pseudo GUID. Does not fulfil RFC standard! Should generate unique GUIDs, but repeats if there is a duplicate. ---Based on https://github.com/Tieske/uuid ! +---Formerly known as 'getGuid()'. ---@param inUsedGuids table|nil list of already used GUIDs ---@return string guid function GuidUtils:generateNewGuid(inUsedGuids) diff --git a/mods/noita-mp/files/scripts/util/MinaUtils.lua b/mods/noita-mp/files/scripts/util/MinaUtils.lua index ac4a9e0cc..79fb87363 100644 --- a/mods/noita-mp/files/scripts/util/MinaUtils.lua +++ b/mods/noita-mp/files/scripts/util/MinaUtils.lua @@ -252,15 +252,13 @@ end ---Constructor for MinaUtils. ---@param minaUtils MinaUtils|nil optional ---@param customProfiler CustomProfiler required ----@param client Client required ----@param globalsUtils GlobalsUtils optional ----@param gui Gui required ----@param logger Logger|nil optional ----@param networkVscUtils NetworkVscUtils|nil optional +---@param globalsUtils GlobalsUtils required +---@param logger Logger required +---@param networkVscUtils NetworkVscUtils required ---@param noitaMpSettings NoitaMpSettings required ----@param utils Utils optional +---@param utils Utils required ---@return MinaUtils -function MinaUtils:new(minaUtils, customProfiler, client, globalsUtils, gui, logger, networkVscUtils, noitaMpSettings, utils) +function MinaUtils:new(minaUtils, customProfiler, globalsUtils, logger, networkVscUtils, noitaMpSettings, utils) ---@class MinaUtils minaUtils = setmetatable(minaUtils or self, MinaUtils) @@ -280,36 +278,31 @@ function MinaUtils:new(minaUtils, customProfiler, client, globalsUtils, gui, log if not minaUtils.globalsUtils then ---@type GlobalsUtils minaUtils.globalsUtils = globalsUtils or - require("GlobalsUtils") - :new(nil, customProfiler, logger, client, utils) + error("MinaUtils:new() requires a GlobalsUtils object!", 2) end if not minaUtils.logger then ---@type Logger minaUtils.logger = logger or - require("Logger") - :new(nil, customProfiler) + error("MinaUtils:new() requires a Logger object!", 2) end if not minaUtils.networkVscUtils then ---@type NetworkVscUtils minaUtils.networkVscUtils = networkVscUtils or - require("NetworkVscUtils") - --:new() + error("MinaUtils:new() requires a NetworkVscUtils object!", 2) end if not minaUtils.noitaMpSettings then ---@type NoitaMpSettings minaUtils.noitaMpSettings = noitaMpSettings or - require("NoitaMpSettings") - :new(nil, customProfiler, gui, nil, nil, nil, logger, utils, nil) + error("MinaUtils:new() requires a NoitaMpSettings object!", 2) end if not minaUtils.utils then ---@type Utils minaUtils.utils = utils or - require("Utils") - --:new() + error("MinaUtils:new() requires a Utils object!", 2) end --[[ Attributes ]] diff --git a/mods/noita-mp/init.lua b/mods/noita-mp/init.lua index 7a14d06f3..fedc8f3c2 100644 --- a/mods/noita-mp/init.lua +++ b/mods/noita-mp/init.lua @@ -5,69 +5,75 @@ end --- Imports by dofile, dofile_once and require dofile("mods/noita-mp/files/scripts/init/init_.lua") -local np = require("noitapatcher") -- Need to be initialized before everything else, otherwise Noita will crash +-- Need to be initialized before everything else, otherwise Noita will crash +local np = require("noitapatcher") + +-- Initialize default server local server = require("Server"):new(nil, nil, nil, nil, nil, nil, nil) +-- Initialize default client local client = require("Client"):new(nil, nil, nil, nil, server) - -local gui = require("Gui"):new(nil, client, client.customProfiler, nil, nil, client.noitaMpSettings) +-- Update client reference +server.entityUtils.client = client +server.globalsUtils.client = client + +-- Cache other classes +local customProfiler = server.customProfiler or error("customProfiler is nil!") +local entityUtils = server.entityUtils or error("entityUtils is nil!") +local entityCache = server.entityCache or error("entityCache is nil!") +local fileUtils = server.fileUtils or error("fileUtils is nil!") +local guidUtils = server.guidUtils or error("guidUtils is nil!") +local minaUtils = server.minaUtils or error("minaUtils is nil!") +local networkVscUtils = server.networkVscUtils or error("networkVscUtils is nil!") +local noitaComponentUtils = server.noitaComponentUtils or error("noitaComponentUtils is nil!") +local noitaMpSettings = server.noitaMpSettings or error("noitaMpSettings is nil!") +local noitaPatcherUtils = server.noitaPatcherUtils or error("noitaPatcherUtils is nil!") +local nuidUtils = server.nuidUtils or error("nuidUtils is nil!") +local logger = server.logger or error("logger is nil!") + +local gui = require("Gui"):new(nil, client, customProfiler, guidUtils, minaUtils, noitaMpSettings) +-- Update gui reference server.noitaMpSettings.gui = gui client.noitaMpSettings.gui = gui -local noitaMpSettings = client.noitaMpSettings or require("NoitaMpSettings") - :new(nil, nil, gui, nil, nil, nil, nil, nil, nil) - ----@class CustomProfiler -local customProfiler = client.customProfiler or require("CustomProfiler") - :new(noitaMpSettings.customProfiler, noitaMpSettings.fileUtils, noitaMpSettings, nil, nil, noitaMpSettings.utils, noitaMpSettings.winapi) -customProfiler.testNumber = 10 -customProfiler.testString = "reset" - -local entityUtils = require("EntityUtils"):new(nil, require("Client"):new(), customProfiler) -local FileUtils = require("FileUtils") -local Logger = require("Logger") -local MinaUtils = require("MinaUtils") -local NoitaComponentUtils = require("NoitaComponentUtils") -local noitaPatcherUtils = require("NoitaPatcherUtils"):new(np) -local Utils = require("Utils") -Logger.debug(Logger.channels.initialize, "Starting to load noita-mp init.lua..") +logger:debug(logger.channels.initialize, "Starting to load noita-mp init.lua..") --- Stuff needs to be executed before anything else -FileUtils.SetAbsolutePathOfNoitaRootDirectory() -NoitaMpSettings.clearAndCreateSettings() +fileUtils:SetAbsolutePathOfNoitaRootDirectory() +noitaMpSettings:clearAndCreateSettings() + -- Is used to stop Noita pausing game, when focus is gone (tab out game) ModMagicNumbersFileAdd("mods/noita-mp/files/data/magic_numbers.xml") ---FileUtils.Find7zipExecutable() -local saveSlotsLastModifiedBeforeWorldInit = FileUtils.GetLastModifiedSaveSlots() ---- NoitaMP functions +local saveSlotsLastModifiedBeforeWorldInit = fileUtils:GetLastModifiedSaveSlots() + if not EntitiesGetMaxID then -- TODO: REMOVE when Noita main branch was updated! EntitiesGetMaxID = function() - return EntityUtils.previousHighestAliveEntityId + 1024 + return entityUtils.previousHighestAliveEntityId + 1024 end end --local guesses = 1 --- Make sure this is only be executed once in OnWorldPREUpdate! local function OnEntityLoaded() - local cpc = customProfiler:start("EntityUtils.OnEntityLoaded") + local cpc = customProfiler:start("entityUtils:OnEntityLoaded") - --for guessEntityId = EntityUtils.previousHighestAliveEntityId, EntityUtils.previousHighestAliveEntityId + 1024, 1 do - for guessEntityId = EntityUtils.previousHighestAliveEntityId, EntitiesGetMaxID(), 1 do + --for guessEntityId = entityUtils:previousHighestAliveEntityId, entityUtils:previousHighestAliveEntityId + 1024, 1 do + for guessEntityId = entityUtils.previousHighestAliveEntityId, EntitiesGetMaxID(), 1 do local entityId = guessEntityId while EntityGetIsAlive(entityId) do - if entityId > EntityUtils.previousHighestAliveEntityId then - EntityUtils.previousHighestAliveEntityId = entityId + if entityId > entityUtils.previousHighestAliveEntityId then + entityUtils.previousHighestAliveEntityId = entityId end -- DEBUG ONLY - local debugEntityId = FileUtils.ReadFile(("%s%s%s"):format( - FileUtils.GetAbsoluteDirectoryPathOfNoitaMP(), pathSeparator, "debugOnEntityLoaded")) - if not Utils.IsEmpty(debugEntityId) then + local debugEntityId = fileUtils:ReadFile(("%s%s%s"):format( + fileUtils:GetAbsoluteDirectoryPathOfNoitaMP(), pathSeparator, "debugOnEntityLoaded")) + if not utils:IsEmpty(debugEntityId) then if entityId >= tonumber(debugEntityId) then local debug = true end @@ -76,13 +82,13 @@ local function OnEntityLoaded() local rootEntity = EntityGetRootEntity(entityId) or entityId if EntityGetIsAlive(rootEntity) then - if rootEntity > EntityUtils.previousHighestAliveEntityId then - EntityUtils.previousHighestAliveEntityId = rootEntity + if rootEntity > entityUtils.previousHighestAliveEntityId then + entityUtils.previousHighestAliveEntityId = rootEntity end - if not NoitaComponentUtils.hasInitialSerializedEntityString(rootEntity) then - local initialSerializedEntityString = noitaPatcherUtils.serializeEntity(rootEntity) - local success = NoitaComponentUtils.setInitialSerializedEntityString(rootEntity, initialSerializedEntityString) + if not noitaComponentUtils.hasInitialSerializedEntityString(rootEntity) then + local initialSerializedEntityString = noitaPatcherUtils:serializeEntity(rootEntity) + local success = noitaComponentUtils.setInitialSerializedEntityString(rootEntity, initialSerializedEntityString) if not success then error("Unable to add serialized string!", 2) @@ -94,96 +100,94 @@ local function OnEntityLoaded() -- Add NoitaMP Variable Storage Components local hasNuid, nuid = NetworkVscUtils.hasNuidSet(rootEntity) - if not hasNuid and Server.amIServer() then - nuid = NuidUtils.getNextNuid() + if not hasNuid and server:amIServer() then + nuid = nuidUtils:getNextNuid() end local spawnX, spawnY = EntityGetTransform(rootEntity) - NetworkVscUtils.addOrUpdateAllVscs(rootEntity, MinaUtils.getLocalMinaName(), MinaUtils.getLocalMinaGuid(), nuid, spawnX, spawnY) + networkVscUtils:addOrUpdateAllVscs(rootEntity, minaUtils:getLocalMinaName(), minaUtils:getLocalMinaGuid(), nuid, spawnX, spawnY) - NoitaComponentUtils.setNetworkSpriteIndicatorStatus(rootEntity, "processed") + noitaComponentUtils:setNetworkSpriteIndicatorStatus(rootEntity, "processed") end end - entityId = EntityUtils.previousHighestAliveEntityId + 1 + entityId = entityUtils.previousHighestAliveEntityId + 1 end end - customProfiler.stop("EntityUtils.OnEntityLoaded", cpc) + customProfiler:stop("entityUtils:OnEntityLoaded", cpc) end --- When connecting the first time to a server, the server will send the servers' seed to the client. --- Then the client restarts, empties his selected save slot, to be able to generate the correct world, --- with the servers seed. local function setSeedIfConnectedSecondTime() - local cpc = customProfiler.start("ModSettingGet") + local cpc = customProfiler:start("ModSettingGet") local seed = tonumber(ModSettingGet("noita-mp.connect_server_seed")) - customProfiler.stop("ModSettingGet", cpc) - Logger.debug(Logger.channels.initialize, ("Servers world seed = %s"):format(seed)) - if not seed and seed > 0 then + customProfiler:stop("ModSettingGet", cpc) + logger:debug(logger.channels.initialize, ("Servers world seed = %s"):format(seed)) + if seed and seed > 0 then if DebugGetIsDevBuild() then - Utils.Sleep(5) -- needed to be able to attach debugger again + utils.Sleep(5) -- needed to be able to attach debugger again end - local cpc1 = customProfiler.start("ModSettingGet") + local cpc1 = customProfiler:start("ModSettingGet") local saveSlotMetaDirectory = ModSettingGet("noita-mp.saveSlotMetaDirectory") - customProfiler.stop("ModSettingGet", cpc1) + customProfiler:stop("ModSettingGet", cpc1) if saveSlotMetaDirectory then - FileUtils.RemoveContentOfDirectory(saveSlotMetaDirectory) + fileUtils:RemoveContentOfDirectory(saveSlotMetaDirectory) else error("Unable to emptying selected save slot!", 2) end SetWorldSeed(seed) - _G.Client.connect(nil, nil, 1) + client:connect(nil, nil, 1) end end ---- Noita API callback functions - function OnModPreInit() setSeedIfConnectedSecondTime() - print(("NoitaMP %s"):format(FileUtils.GetVersionByFile())) + print(("NoitaMP %s"):format(fileUtils:GetVersionByFile())) OnEntityLoaded() end function OnWorldInitialized() - local cpc = customProfiler.start("init.OnWorldInitialized") - Logger.debug(Logger.channels.initialize, "OnWorldInitialized()") + local cpc = customProfiler:start("init.OnWorldInitialized") + logger:debug(logger.channels.initialize, "OnWorldInitialized()") OnEntityLoaded() - local cpc1 = customProfiler.start("ModSettingGet") + local cpc1 = customProfiler:start("ModSettingGet") local make_zip = ModSettingGet("noita-mp.server_start_7zip_savegame") - customProfiler.stop("ModSettingGet", cpc1) - Logger.debug(Logger.channels.initialize, "make_zip = " .. tostring(make_zip)) + customProfiler:stop("ModSettingGet", cpc1) + logger:debug(logger.channels.initialize, "make_zip = " .. tostring(make_zip)) if make_zip then local archive_name = "server_save06_" .. os.date("%Y-%m-%d_%H-%M-%S") - local destination = FileUtils.GetAbsoluteDirectoryPathOfNoitaMP() .. pathSeparator .. "_" - local archive_content = FileUtils.Create7zipArchive(archive_name .. "_from_server", - FileUtils.GetAbsoluteDirectoryPathOfSave06(), destination) + local destination = fileUtils:GetAbsoluteDirectoryPathOfNoitaMP() .. pathSeparator .. "_" + local archive_content = fileUtils:Create7zipArchive(archive_name .. "_from_server", + fileUtils:GetAbsoluteDirectoryPathOfSave06(), destination) local msg = ("init.lua | Server savegame [%s] was zipped with 7z to location [%s]."):format( archive_name, destination) - Logger.debug(Logger.channels.initialize, msg) + logger:debug(logger.channels.initialize, msg) GamePrint(msg) - local cpc1 = customProfiler.start("ModSettingSetNextValue") + local cpc2 = customProfiler:start("ModSettingSetNextValue") ModSettingSetNextValue("noita-mp.server_start_7zip_savegame", false, false) -- automatically start the server again - customProfiler.stop("ModSettingSetNextValue", cpc1) + customProfiler:stop("ModSettingSetNextValue", cpc2) end - customProfiler.stop("init.OnWorldInitialized", cpc) + customProfiler:stop("init.OnWorldInitialized", cpc) end function OnPlayerSpawned(player_entity) - local cpc = customProfiler.start("init.OnPlayerSpawned") - Logger.info(Logger.channels.initialize, ("Player spawned with entityId = %s!"):format(player_entity)) + local cpc = customProfiler:start("init.OnPlayerSpawned") + logger:info(logger.channels.initialize, ("Player spawned with entityId = %s!"):format(player_entity)) OnEntityLoaded() - if Utils.IsEmpty(MinaUtils.getLocalMinaGuid()) then - MinaUtils.setLocalMinaGuid(GuidUtils:getGuid()) + if utils:IsEmpty(minaUtils:getLocalMinaGuid()) then + minaUtils:setLocalMinaGuid(guidUtils:generateNewGuid()) end - MinaUtils.setLocalMinaName(NoitaMpSettings.get("noita-mp.nickname", "string")) - MinaUtils.setLocalMinaGuid(NoitaMpSettings.get("noita-mp.guid", "string")) + minaUtils:setLocalMinaName(tostring(noitaMpSettings:get("noita-mp.nickname", "string"))) + minaUtils:setLocalMinaGuid(tostring(noitaMpSettings:get("noita-mp.guid", "string"))) local spawnX, spawnY = EntityGetTransform(player_entity) - NetworkVscUtils.addOrUpdateAllVscs(player_entity, MinaUtils.getLocalMinaName(), MinaUtils.getLocalMinaGuid(), nil, spawnX, spawnY) + networkVscUtils:addOrUpdateAllVscs(player_entity, minaUtils:getLocalMinaName(), minaUtils:getLocalMinaGuid(), nil, spawnX, spawnY) if not GameHasFlagRun("nameTags_script_applied") then GameAddFlagRun("nameTags_script_applied") @@ -194,43 +198,39 @@ function OnPlayerSpawned(player_entity) execute_every_n_frame = 1, }) end - customProfiler.stop("init.OnPlayerSpawned", cpc) + customProfiler:stop("init.OnPlayerSpawned", cpc) end function OnPausePreUpdate() local startFrameTime = GameGetRealWorldTimeSinceStarted() - local cpc = customProfiler.start("init.OnPausePreUpdate") + local cpc = customProfiler:start("init.OnPausePreUpdate") OnEntityLoaded() - Server.update(startFrameTime) - Client.update(startFrameTime) - customProfiler.stop("init.OnPausePreUpdate", cpc) + server:update(startFrameTime) + client:update(startFrameTime) + customProfiler:stop("init.OnPausePreUpdate", cpc) end --- PreUpdate of world function OnWorldPreUpdate() local startFrameTime = GameGetRealWorldTimeSinceStarted() - local cpc = customProfiler.start("init.OnWorldPreUpdate") + local cpc = customProfiler:start("init.OnWorldPreUpdate") OnEntityLoaded() - if Utils.IsEmpty(MinaUtils.getLocalMinaName()) or Utils.IsEmpty(MinaUtils.getLocalMinaGuid()) then - guiI.setShowMissingSettings(true) + if utils:IsEmpty(minaUtils:getLocalMinaName()) or utils:IsEmpty(minaUtils:getLocalMinaGuid()) then + gui:setShowMissingSettings(true) end - guiI.update() - - --if profiler.isRunning() and os.clock() >= 120 then - -- FileUtils.createProfilerLog() - --end + gui:update() local localMinaEntityId = minaUtils:getLocalMinaEntityId() if not localMinaEntityId or localMinaEntityId <= 0 then return end - EntityUtils.addOrChangeDetectionRadiusDebug(localMinaEntityId) + entityUtils:addOrChangeDetectionRadiusDebug(localMinaEntityId) if not _G.saveSlotMeta then - local saveSlotsLastModifiedAfterWorldInit = FileUtils.GetLastModifiedSaveSlots() + local saveSlotsLastModifiedAfterWorldInit = fileUtils:GetLastModifiedSaveSlots() for i = 1, #saveSlotsLastModifiedBeforeWorldInit do for j = 1, #saveSlotsLastModifiedAfterWorldInit do local saveSlotMeta @@ -243,44 +243,40 @@ function OnWorldPreUpdate() if saveSlotMeta then --- Set modSettings as well when changing this: ModSettingSetNextValue("noita-mp.saveSlotMetaDirectory", _G.saveSlotMeta, false) _G.saveSlotMeta = saveSlotMeta - local cpc1 = customProfiler.start("ModSettingSetNextValue") + local cpc1 = customProfiler:start("ModSettingSetNextValue") ModSettingSetNextValue("noita-mp.saveSlotMetaDirectory", _G.saveSlotMeta.dir, false) - customProfiler.stop("ModSettingSetNextValue", cpc1) - Logger.info(Logger.channels.initialize, - ("Save slot found in '%s'"):format(Utils.pformat(_G.saveSlotMeta))) + customProfiler:stop("ModSettingSetNextValue", cpc1) + logger:info(logger.channels.initialize, ("Save slot found in '%s'"):format(utils.pformat(_G.saveSlotMeta))) end end end end - Server.update(startFrameTime) - Client.update(startFrameTime) - --ui.update() + server:update(startFrameTime) + client:update(startFrameTime) - local cpc1 = customProfiler.start("init.OnWorldPreUpdate.collectgarbage.count") + local cpc1 = customProfiler:start("init.OnWorldPreUpdate.collectgarbage.count") if collectgarbage("count") >= 250000 then - local cpc2 = customProfiler.start("init.OnWorldPreUpdate.collectgarbage.collect") + local cpc2 = customProfiler:start("init.OnWorldPreUpdate.collectgarbage.collect") -- if memory usage is above 250MB, force a garbage collection GamePrintImportant("Memory Usage", "Forcing garbage collection because memory usage is above 250MB.") - customProfiler.stopAll() - customProfiler.report() collectgarbage("collect") - customProfiler.stop("init.OnWorldPreUpdate.collectgarbage.collect", cpc2) + customProfiler:stop("init.OnWorldPreUpdate.collectgarbage.collect", cpc2) end - customProfiler.stop("init.OnWorldPreUpdate.collectgarbage.count", cpc1) - customProfiler.stop("init.OnWorldPreUpdate", cpc) + customProfiler:stop("init.OnWorldPreUpdate.collectgarbage.count", cpc1) + customProfiler:stop("init.OnWorldPreUpdate", cpc) end function OnWorldPostUpdate() - local cpc = customProfiler.start("init.OnWorldPostUpdate") + local cpc = customProfiler:start("init.OnWorldPostUpdate") OnEntityLoaded() - if EntityCache.size() >= 500 then + if entityCache:size() >= 500 then -- TODO: add distance check to minas --for i = 1, #EntityCache.cache do - EntityCache.delete(EntityCache.cache[1]) + entityCache:delete(entityCache.cache[1]) --end end - customProfiler.stop("init.OnWorldPostUpdate", cpc) + customProfiler:stop("init.OnWorldPostUpdate", cpc) end diff --git a/mods/noita-mp/lua_modules/share/lua/5.1/zstd.lua b/mods/noita-mp/lua_modules/share/lua/5.1/zstd.lua index 963af9d57..a06132f43 100644 --- a/mods/noita-mp/lua_modules/share/lua/5.1/zstd.lua +++ b/mods/noita-mp/lua_modules/share/lua/5.1/zstd.lua @@ -48,7 +48,7 @@ typedef struct ZSTD_CStream_s ZSTD_CStream; ZSTD_CStream* ZSTD_createCStream(void); size_t ZSTD_freeCStream(ZSTD_CStream* zcs); size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel); -size_t ZSTD_compressStream(ZSTD_CStream* zcs, +size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input); size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); size_t ZSTD_CStreamInSize(void); @@ -88,7 +88,12 @@ local arr_utint8_t = ffi_typeof "uint8_t[?]" local ptr_zstd_inbuffer_t = ffi_typeof "ZSTD_inBuffer[1]" local ptr_zstd_outbuffer_t = ffi_typeof "ZSTD_outBuffer[1]" -local zstd = ffi_load(FileUtils.GetAbsolutePathOfNoitaRootDirectory() .. "\\mods\\noita-mp\\lua_modules\\lib\\lua\\5.1\\libzstd") +local noitaMpSettings = require("NoitaMpSettings") + :new(nil, nil, {}, nil, nil, nil, nil, nil, nil) +local fileUtils = require("FileUtils") + :new(nil, nil, nil, noitaMpSettings, nil, nil) + +local zstd = ffi_load(fileUtils:GetAbsolutePathOfNoitaRootDirectory() .. "\\mods\\noita-mp\\lua_modules\\lib\\lua\\5.1\\libzstd") local file = assert(io.popen("zstd -vV", "r")) local zstdVersion = file:read("*a") print("zstd version = " .. zstdVersion) diff --git a/mods/noita-mp/tests/unitTestRunner.lua b/mods/noita-mp/tests/unitTestRunner.lua index 5d4dd7267..7ec48e438 100644 --- a/mods/noita-mp/tests/unitTestRunner.lua +++ b/mods/noita-mp/tests/unitTestRunner.lua @@ -30,6 +30,7 @@ if not ModSettingGet then --- DO NOT add ids, which are used in a test. Add those inside of the test itself! ---------------------------------------- ModSettingGet = function(id) + ---@type Utils utils = utils or require("Utils") --:new() minaUtils = minaUtils or require("MinaUtils") --:new() guidUtils = guidUtils or require("GuidUtils") --:new()