Merge pull request #630 from argonui/onload-improvements
Performance improvements
This commit is contained in:
commit
3c2b5d5479
@ -10,27 +10,27 @@
|
||||
{
|
||||
"name": "Reflex Response",
|
||||
"xp": 1,
|
||||
"text": "Add the following play condition: “\u003d You take damage or horror.”"
|
||||
"text": "Add the following play condition: “- You take damage or horror.”"
|
||||
},
|
||||
{
|
||||
"name": "Situational Awareness",
|
||||
"xp": 1,
|
||||
"text": "Add the following play condition: “\u003d A location enters play or is revealed.”"
|
||||
"text": "Add the following play condition: “- A location enters play or is revealed.”"
|
||||
},
|
||||
{
|
||||
"name": "Killer Instinct",
|
||||
"xp": 1,
|
||||
"text": "Add the following play condition: “\u003d An enemy engages you.”"
|
||||
"text": "Add the following play condition: “- An enemy engages you.”"
|
||||
},
|
||||
{
|
||||
"name": "Gut Reaction",
|
||||
"xp": 1,
|
||||
"text": "Add the following play condition: “\u003d A treachery enters your threat area .”"
|
||||
"text": "Add the following play condition: “- A treachery enters your threat area .”"
|
||||
},
|
||||
{
|
||||
"name": "Muscle Memory",
|
||||
"xp": 1,
|
||||
"text": "Add the following play condition: “\u003d You play an asset.”"
|
||||
"text": "Add the following play condition: “- You play an asset.”"
|
||||
},
|
||||
{
|
||||
"name": "Sharpened Talent",
|
||||
|
@ -33,7 +33,7 @@
|
||||
{
|
||||
"name": "Inscription of the Elders",
|
||||
"xp": 1,
|
||||
"text": "Add this inscription: “⟐ Elders - If this attack succeeds by an amount equal to or grather than your location\u0027s shroud, discover 1 clue at your location.”"
|
||||
"text": "Add this inscription: “⟐ Elders - If this attack succeeds by an amount equal to or grather than your location's shroud, discover 1 clue at your location.”"
|
||||
},
|
||||
{
|
||||
"name": "Inscription of the Hunt",
|
||||
@ -53,7 +53,7 @@
|
||||
{
|
||||
"name": "Saga",
|
||||
"xp": 3,
|
||||
"text": "Replenish 2 of Runic Axe\u0027s charges at the start of each round, instead of only one",
|
||||
"text": "Replenish 2 of Runic Axe's charges at the start of each round, instead of only one",
|
||||
"replaces": {
|
||||
"uses": [
|
||||
{
|
||||
|
@ -11,6 +11,8 @@ local phaseImages = {
|
||||
"http://cloud-3.steamusercontent.com/ugc/982233321870237261/C287CAED2423970F33E72D6C7415CBEC6794C533/"
|
||||
}
|
||||
|
||||
local phaseId, broadcastChange
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({
|
||||
phaseId = phaseId,
|
||||
|
@ -55,9 +55,9 @@ function onSave()
|
||||
end
|
||||
|
||||
-- loading data, button creation and initial layouting
|
||||
function onLoad(saveState)
|
||||
if saveState ~= nil and saveState ~= "" then
|
||||
local loadedData = JSON.decode(saveState)
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
tokenPrecedence = loadedData.tokenPrecedence
|
||||
percentage = loadedData.percentage
|
||||
includeDrawnTokens = loadedData.includeDrawnTokens
|
||||
|
@ -15,7 +15,7 @@ val = 0
|
||||
function onSave() return JSON.encode({ val, options }) end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData ~= "" then
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
val = loadedData[1]
|
||||
options = loadedData[2]
|
||||
|
@ -5,21 +5,20 @@ val = 0
|
||||
function onSave() return JSON.encode(val) end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData ~= nil then
|
||||
if savedData and savedData ~= "" then
|
||||
val = JSON.decode(savedData)
|
||||
end
|
||||
|
||||
local name = self.getName()
|
||||
local position = {}
|
||||
local position = { 0, 0.06, 0 }
|
||||
|
||||
-- set position of label depending on object
|
||||
if name == "Damage" or name == "Resources" or name == "Resource Counter" then
|
||||
position = { 0, 0.06, 0.1 }
|
||||
elseif name == "Horror" then
|
||||
position = { -0.025, 0.06, -0.025 }
|
||||
elseif name == "Elder Sign Counter" or name == "Auto-fail Counter" then
|
||||
position = { 0, 0.1, 0 }
|
||||
else
|
||||
position = { 0, 0.06, 0 }
|
||||
end
|
||||
|
||||
self.createButton({
|
||||
@ -35,6 +34,7 @@ function onLoad(savedData)
|
||||
color = { 0, 0, 0, 0 }
|
||||
})
|
||||
|
||||
-- add context menu entries
|
||||
self.addContextMenuItem("Add 5", function() updateVal(val + 5) end)
|
||||
self.addContextMenuItem("Subtract 5", function() updateVal(val - 5) end)
|
||||
self.addContextMenuItem("Add 10", function() updateVal(val + 10) end)
|
||||
|
@ -127,19 +127,18 @@ function onSave()
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData then
|
||||
loadedData = JSON.decode(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
optionPanel = loadedData.optionPanel
|
||||
acknowledgedUpgradeVersions = loadedData.acknowledgedUpgradeVersions
|
||||
updateOptionPanelState()
|
||||
chaosTokensLastMatGUID = loadedData.chaosTokensLastMatGUID
|
||||
|
||||
-- restore saved state for drawn chaos tokens
|
||||
for _, guid in ipairs(loadedData.chaosTokensGUID or {}) do
|
||||
table.insert(chaosTokens, getObjectFromGUID(guid))
|
||||
end
|
||||
chaosTokensLastMatGUID = loadedData.chaosTokensLastMatGUID
|
||||
else
|
||||
print("Saved state could not be found!")
|
||||
|
||||
updateOptionPanelState()
|
||||
end
|
||||
|
||||
for _, guid in ipairs(NOT_INTERACTABLE) do
|
||||
|
@ -7,9 +7,10 @@ useClickableCounters = false
|
||||
function onSave() return JSON.encode(useClickableCounters) end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData ~= nil then
|
||||
if savedData and savedData ~= "" then
|
||||
useClickableCounters = JSON.decode(savedData)
|
||||
end
|
||||
|
||||
self.createButton({
|
||||
label = "0",
|
||||
click_function = "removeAllPlayerClues",
|
||||
@ -23,6 +24,7 @@ function onLoad(savedData)
|
||||
font_color = { 1, 1, 1, 100 },
|
||||
color = { 0, 0, 0, 0 }
|
||||
})
|
||||
|
||||
Wait.time(sumClues, 2, -1)
|
||||
end
|
||||
|
||||
|
@ -24,9 +24,9 @@ local collisionEnabled = false
|
||||
local currentScenario, useFrontData, tokenData
|
||||
local TRASH, DATA_HELPER
|
||||
|
||||
function onLoad(saveState)
|
||||
if saveState ~= nil then
|
||||
local loadedState = JSON.decode(saveState) or {}
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedState = JSON.decode(savedData) or {}
|
||||
currentScenario = loadedState.currentScenario or ""
|
||||
useFrontData = loadedState.useFrontData or true
|
||||
tokenData = loadedState.tokenData or {}
|
||||
|
@ -82,7 +82,7 @@ function onSave()
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData ~= "" then
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
visibility = loadedData.visibility
|
||||
claims = loadedData.claims
|
||||
|
@ -60,12 +60,16 @@ function onSave()
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
self.interactable = false -- this needs to be here since the playarea will be reloaded when the image changes
|
||||
local loadedData = JSON.decode(savedData) or {}
|
||||
locations = loadedData.trackedLocations or {}
|
||||
currentScenario = loadedData.currentScenario
|
||||
connectionColor = loadedData.connectionColor or { 0.4, 0.4, 0.4, 1 }
|
||||
connectionsEnabled = loadedData.connectionsEnabled or true
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData) or {}
|
||||
locations = loadedData.trackedLocations or {}
|
||||
currentScenario = loadedData.currentScenario
|
||||
connectionColor = loadedData.connectionColor or { 0.4, 0.4, 0.4, 1 }
|
||||
connectionsEnabled = loadedData.connectionsEnabled or true
|
||||
end
|
||||
|
||||
-- this needs to be here since the playarea will be reloaded when the image changes
|
||||
self.interactable = false
|
||||
|
||||
Wait.time(function() collisionEnabled = true end, 0.1)
|
||||
end
|
||||
|
@ -6,6 +6,12 @@ local typeIndex, selectionIndex, plainNameCache
|
||||
function onSave() return JSON.encode({ typeIndex = typeIndex, selectionIndex = selectionIndex }) end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData) or {}
|
||||
typeIndex = loadedData.typeIndex or 1
|
||||
selectionIndex = loadedData.selectionIndex or 1
|
||||
end
|
||||
|
||||
self.createButton({
|
||||
function_owner = self,
|
||||
click_function = "onClick_toggleGallery",
|
||||
@ -16,9 +22,6 @@ function onLoad(savedData)
|
||||
color = { 1, 1, 1, 0 }
|
||||
})
|
||||
|
||||
local loadedData = JSON.decode(savedData) or {}
|
||||
typeIndex = loadedData.typeIndex or 1
|
||||
selectionIndex = loadedData.selectionIndex or 1
|
||||
Wait.time(updatePlayAreaGallery, 0.5)
|
||||
math.randomseed(os.time())
|
||||
end
|
||||
|
@ -2,15 +2,13 @@ local spawnedCardGuids = {}
|
||||
|
||||
function onSave() return JSON.encode({ cards = spawnedCardGuids }) end
|
||||
|
||||
function onLoad(saveState)
|
||||
if saveState ~= nil then
|
||||
local saveTable = JSON.decode(saveState) or {}
|
||||
spawnedCardGuids = saveTable.cards or {}
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData) or {}
|
||||
spawnedCardGuids = loadedData.cards or {}
|
||||
end
|
||||
createResetMenuItems()
|
||||
end
|
||||
|
||||
function createResetMenuItems()
|
||||
-- context menu entries
|
||||
self.addContextMenuItem("Reset All", resetAll)
|
||||
self.addContextMenuItem("Reset Locations", resetAllLocations)
|
||||
self.addContextMenuItem("Reset Player Cards", resetAllAssetAndEvents)
|
||||
|
@ -57,73 +57,68 @@ function onObjectLeaveContainer(container, _)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create the card indexes by iterating all cards in the bag, parsing their
|
||||
-- metadata, and creating the keyed lookup tables for the cards. This is a
|
||||
-- coroutine which will spread the workload by processing 20 cards before
|
||||
-- yielding. Based on the current count of cards this will require
|
||||
-- approximately 60 frames to complete.
|
||||
-- Create the card indexes by iterating all cards in the bag, parsing their metadata
|
||||
-- and creating the keyed lookup tables for the cards. This is a coroutine which will
|
||||
-- spread the workload by processing 20 cards before yielding.
|
||||
function buildIndex()
|
||||
local cardCount = 0
|
||||
indexingDone = false
|
||||
if (self.getData().ContainedObjects == nil) then
|
||||
return 1
|
||||
end
|
||||
for i, cardData in ipairs(self.getData().ContainedObjects) do
|
||||
local cardMetadata = JSON.decode(cardData.GMNotes)
|
||||
if (cardMetadata ~= nil) then
|
||||
addCardToIndex(cardData, cardMetadata)
|
||||
cardCount = cardCount + 1
|
||||
if cardCount > 9 then
|
||||
cardCount = 0
|
||||
coroutine.yield(0)
|
||||
end
|
||||
|
||||
-- process the allcardsbag itself
|
||||
for _, cardData in ipairs(self.getData().ContainedObjects) do
|
||||
addCardToIndex(cardData)
|
||||
cardCount = cardCount + 1
|
||||
if cardCount > 19 then
|
||||
cardCount = 0
|
||||
coroutine.yield(0)
|
||||
end
|
||||
end
|
||||
local hotfixBags = getObjectsWithTag("AllCardsHotfix")
|
||||
for _, hotfixBag in ipairs(hotfixBags) do
|
||||
if (#hotfixBag.getObjects() > 0) then
|
||||
for i, cardData in ipairs(hotfixBag.getData().ContainedObjects) do
|
||||
if cardData.ContainedObjects then
|
||||
for j, deepCardData in ipairs(cardData.ContainedObjects) do
|
||||
local deepCardMetadata = JSON.decode(deepCardData.GMNotes)
|
||||
if deepCardMetadata ~= nil then
|
||||
addCardToIndex(deepCardData, deepCardMetadata)
|
||||
cardCount = cardCount + 1
|
||||
if cardCount > 9 then
|
||||
cardCount = 0
|
||||
coroutine.yield(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local cardMetadata = JSON.decode(cardData.GMNotes)
|
||||
if cardMetadata ~= nil then
|
||||
addCardToIndex(cardData, cardMetadata)
|
||||
cardCount = cardCount + 1
|
||||
if cardCount > 9 then
|
||||
cardCount = 0
|
||||
coroutine.yield(0)
|
||||
end
|
||||
|
||||
-- process hotfix bags (and the additional playercards bag)
|
||||
for _, hotfixBag in ipairs(getObjectsWithTag("AllCardsHotfix")) do
|
||||
local hotfixData = hotfixBag.getData()
|
||||
if not hotfixData.ContainedObjects then break end
|
||||
|
||||
for _, cardData in ipairs(hotfixData.ContainedObjects) do
|
||||
-- process containers
|
||||
if cardData.ContainedObjects then
|
||||
for _, deepCardData in ipairs(cardData.ContainedObjects) do
|
||||
addCardToIndex(deepCardData)
|
||||
cardCount = cardCount + 1
|
||||
if cardCount > 19 then
|
||||
cardCount = 0
|
||||
coroutine.yield(0)
|
||||
end
|
||||
end
|
||||
-- process single cards
|
||||
else
|
||||
addCardToIndex(cardData)
|
||||
cardCount = cardCount + 1
|
||||
if cardCount > 19 then
|
||||
cardCount = 0
|
||||
coroutine.yield(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
buildSupplementalIndexes()
|
||||
indexingDone = true
|
||||
return 1
|
||||
end
|
||||
|
||||
-- Adds a card to any indexes it should be a part of, based on its metadata.
|
||||
-- Adds a card to any indexes it should be a part of, based on its metadata
|
||||
---@param cardData table TTS object data for the card
|
||||
---@param cardMetadata table SCED metadata for the card
|
||||
function addCardToIndex(cardData, cardMetadata)
|
||||
function addCardToIndex(cardData)
|
||||
-- using the more efficient 'json.parse()' to speed this process up
|
||||
local cardMetadata = json.parse(cardData.GMNotes)
|
||||
if not cardMetadata then return end
|
||||
|
||||
-- use the ZoopGuid as fallback if no id present
|
||||
if cardMetadata.id == nil and cardMetadata.TtsZoopGuid then
|
||||
cardMetadata.id = cardMetadata.TtsZoopGuid
|
||||
end
|
||||
cardIdIndex[cardMetadata.id] = { data = cardData, metadata = cardMetadata }
|
||||
if (cardMetadata.alternate_ids ~= nil) then
|
||||
cardIdIndex[cardMetadata.id or cardMetadata.TtsZoopGuid] = { data = cardData, metadata = cardMetadata }
|
||||
|
||||
-- also add data for alternate ids
|
||||
if cardMetadata.alternate_ids ~= nil then
|
||||
for _, alternateId in ipairs(cardMetadata.alternate_ids) do
|
||||
cardIdIndex[alternateId] = { data = cardData, metadata = cardMetadata }
|
||||
end
|
||||
@ -133,11 +128,9 @@ end
|
||||
function buildSupplementalIndexes()
|
||||
for cardId, card in pairs(cardIdIndex) do
|
||||
local cardMetadata = card.metadata
|
||||
-- If the ID key and the metadata ID don't match this is a duplicate card created by an
|
||||
-- alternate_id, and we should skip it
|
||||
-- If the ID key and the metadata ID don't match this is a duplicate card created by an alternate_id, and we should skip it
|
||||
if cardId == cardMetadata.id then
|
||||
-- Add card to the basic weakness list, if appropriate. Some weaknesses have
|
||||
-- multiple copies, and are added multiple times
|
||||
-- Add card to the basic weakness list, if appropriate. Some weaknesses have multiple copies, and are added multiple times
|
||||
if cardMetadata.weakness then
|
||||
table.insert(uniqueWeaknessList, cardMetadata.id)
|
||||
if cardMetadata.basicWeaknessCount ~= nil then
|
||||
@ -147,56 +140,31 @@ function buildSupplementalIndexes()
|
||||
end
|
||||
end
|
||||
|
||||
-- Add the card to the appropriate class and level indexes
|
||||
local isGuardian = false
|
||||
local isSeeker = false
|
||||
local isMystic = false
|
||||
local isRogue = false
|
||||
local isSurvivor = false
|
||||
local isNeutral = false
|
||||
local upgradeKey
|
||||
-- Excludes signature cards (which have no class or level) and alternate
|
||||
-- ID entries
|
||||
if (cardMetadata.class ~= nil and cardMetadata.level ~= nil) then
|
||||
isGuardian = string.match(cardMetadata.class, "Guardian")
|
||||
isSeeker = string.match(cardMetadata.class, "Seeker")
|
||||
isMystic = string.match(cardMetadata.class, "Mystic")
|
||||
isRogue = string.match(cardMetadata.class, "Rogue")
|
||||
isSurvivor = string.match(cardMetadata.class, "Survivor")
|
||||
isNeutral = string.match(cardMetadata.class, "Neutral")
|
||||
if (cardMetadata.level > 0) then
|
||||
-- Excludes signature cards (which have no class or level)
|
||||
if cardMetadata.class ~= nil and cardMetadata.level ~= nil then
|
||||
local upgradeKey
|
||||
if cardMetadata.level > 0 then
|
||||
upgradeKey = "-upgrade"
|
||||
else
|
||||
upgradeKey = "-level0"
|
||||
end
|
||||
if (isGuardian) then
|
||||
table.insert(classAndLevelIndex["Guardian"..upgradeKey], cardMetadata.id)
|
||||
end
|
||||
if (isSeeker) then
|
||||
table.insert(classAndLevelIndex["Seeker"..upgradeKey], cardMetadata.id)
|
||||
end
|
||||
if (isMystic) then
|
||||
table.insert(classAndLevelIndex["Mystic"..upgradeKey], cardMetadata.id)
|
||||
end
|
||||
if (isRogue) then
|
||||
table.insert(classAndLevelIndex["Rogue"..upgradeKey], cardMetadata.id)
|
||||
end
|
||||
if (isSurvivor) then
|
||||
table.insert(classAndLevelIndex["Survivor"..upgradeKey], cardMetadata.id)
|
||||
end
|
||||
if (isNeutral) then
|
||||
table.insert(classAndLevelIndex["Neutral"..upgradeKey], cardMetadata.id)
|
||||
|
||||
-- parse classes (separated by "|") and add the card to the appropriate class and level indices
|
||||
for str in cardMetadata.class:gmatch("([^|]+)") do
|
||||
table.insert(classAndLevelIndex[str .. upgradeKey], cardMetadata.id)
|
||||
end
|
||||
|
||||
-- add to cycle index
|
||||
local cycleName = cardMetadata.cycle
|
||||
if cycleName ~= nil then
|
||||
cycleName = string.lower(cycleName)
|
||||
if string.match(cycleName, "return") then
|
||||
cycleName = string.sub(cycleName, 11)
|
||||
end
|
||||
if cycleName == "the night of the zealot" then
|
||||
cycleName = "core"
|
||||
end
|
||||
|
||||
-- remove "return to " from cycle names
|
||||
cycleName = cycleName:gsub("return to ", "")
|
||||
|
||||
-- override cycle name for night of the zealot
|
||||
cycleName = cycleName:gsub("the night of the zealot", "core")
|
||||
|
||||
if cycleIndex[cycleName] == nil then
|
||||
cycleIndex[cycleName] = { }
|
||||
end
|
||||
@ -205,29 +173,34 @@ function buildSupplementalIndexes()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- sort class and level indices
|
||||
for _, indexTable in pairs(classAndLevelIndex) do
|
||||
table.sort(indexTable, cardComparator)
|
||||
end
|
||||
|
||||
-- sort cycle indices
|
||||
for _, indexTable in pairs(cycleIndex) do
|
||||
table.sort(indexTable)
|
||||
end
|
||||
|
||||
-- sort weakness indices
|
||||
table.sort(basicWeaknessList, cardComparator)
|
||||
table.sort(uniqueWeaknessList, cardComparator)
|
||||
end
|
||||
|
||||
-- Comparison function used to sort the class card bag indexes. Sorts by card
|
||||
-- level, then name, then subname.
|
||||
-- Comparison function used to sort the class card bag indexes. Sorts by card level, then name, then subname.
|
||||
function cardComparator(id1, id2)
|
||||
local card1 = cardIdIndex[id1]
|
||||
local card2 = cardIdIndex[id2]
|
||||
|
||||
if (card1.metadata.level ~= card2.metadata.level) then
|
||||
if card1.metadata.level ~= card2.metadata.level then
|
||||
return card1.metadata.level < card2.metadata.level
|
||||
end
|
||||
if (card1.data.Nickname ~= card2.data.Nickname) then
|
||||
elseif card1.data.Nickname ~= card2.data.Nickname then
|
||||
return card1.data.Nickname < card2.data.Nickname
|
||||
else
|
||||
return card1.data.Description < card2.data.Description
|
||||
end
|
||||
return card1.data.Description < card2.data.Description
|
||||
end
|
||||
|
||||
function isIndexReady()
|
||||
|
@ -103,13 +103,13 @@ function onSave()
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
arkhamDb.initialize()
|
||||
if (savedData ~= nil) then
|
||||
if savedData and savedData ~= "" then
|
||||
local saveState = JSON.decode(savedData) or { }
|
||||
if (saveState.spawnBagState ~= nil) then
|
||||
if saveState.spawnBagState ~= nil then
|
||||
spawnBag.loadFromSave(saveState.spawnBagState)
|
||||
end
|
||||
end
|
||||
arkhamDb.initialize()
|
||||
buildExcludedWeaknessList()
|
||||
createButtons()
|
||||
end
|
||||
|
@ -11,7 +11,9 @@ function onSave() return JSON.encode(stats) end
|
||||
|
||||
-- load stats and make buttons (left to right)
|
||||
function onLoad(savedData)
|
||||
stats = JSON.decode(savedData) or { 1, 1, 1, 1 }
|
||||
if savedData and savedData ~= "" then
|
||||
stats = JSON.decode(savedData) or { 1, 1, 1, 1 }
|
||||
end
|
||||
|
||||
for index = 1, 4 do
|
||||
local fnName = "buttonClick" .. index
|
||||
|
@ -95,7 +95,14 @@ function onSave()
|
||||
})
|
||||
end
|
||||
|
||||
function onLoad(saveState)
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
playerColor = loadedData.playerColor
|
||||
activeInvestigatorId = loadedData.activeInvestigatorId
|
||||
isDrawButtonVisible = loadedData.isDrawButtonVisible
|
||||
end
|
||||
|
||||
self.interactable = false
|
||||
|
||||
-- get object references to owned objects
|
||||
@ -135,14 +142,6 @@ function onLoad(saveState)
|
||||
font_size = 180
|
||||
})
|
||||
|
||||
-- save state loading
|
||||
local state = JSON.decode(saveState)
|
||||
if state ~= nil then
|
||||
playerColor = state.playerColor
|
||||
activeInvestigatorId = state.activeInvestigatorId
|
||||
isDrawButtonVisible = state.isDrawButtonVisible
|
||||
end
|
||||
|
||||
showDrawButton(isDrawButtonVisible)
|
||||
math.randomseed(os.time())
|
||||
Wait.time(function() collisionEnabled = true end, 0.1)
|
||||
|
@ -6,7 +6,9 @@ function onSave()
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
lines = JSON.decode(savedData) or {}
|
||||
if savedData and savedData ~= "" then
|
||||
lines = JSON.decode(savedData) or {}
|
||||
end
|
||||
end
|
||||
|
||||
-- create timer when numpad 0 is pressed
|
||||
|
@ -1,8 +1,8 @@
|
||||
local zone = nil
|
||||
local zone
|
||||
|
||||
-- general code
|
||||
function onSave()
|
||||
return JSON.encode(zone and zone.getGUID() or nil)
|
||||
return JSON.encode(zone and zone.getGUID())
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
|
Loading…
x
Reference in New Issue
Block a user