diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index ebf23972..9ebbbdf7 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -30,8 +30,6 @@ local NOT_INTERACTABLE = { "975c39", -- vertical border right } -local guidHandler, DATA_HELPER - -- global variable for access chaosTokens = {} local chaosTokensLastMat = nil @@ -150,7 +148,6 @@ function onLoad(savedData) if obj ~= nil then obj.interactable = false end end - DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper") resetChaosTokenStatTracker() getModVersion() math.randomseed(os.time()) @@ -469,6 +466,7 @@ function fillContainer(args) end function getDataValue(storage, key) + local DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType("Mythos", "DataHelper") local data = DATA_HELPER.getTable(storage) if data ~= nil then local value = data[key] @@ -1005,7 +1003,7 @@ function applyOptionPanelChange(id, state) optionPanel[id] = state -- update master clue counter - local counter = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "MasterClueCounter" }) + local counter = guidReferenceApi.getObjectByOwnerAndType("Mythos", "MasterClueCounter") counter.setVar("useClickableCounters", state) -- option: Play area snap tags @@ -1077,7 +1075,7 @@ end ---@param position Table Desired position of the object ---@param rotation Table Desired rotation of the object (defaults to object's rotation) function spawnHelperObject(name, position, rotation) - local sourceBag = guidHandler.call("getObjectByOwnerAndType", { owner = "Mythos", type = "OptionPanelSource" }) + local sourceBag = guidReferenceApi.getObjectByOwnerAndType("Mythos","OptionPanelSource") -- error handling for missing sourceBag if not sourceBag then