Skip to content

Commit

Permalink
Merge pull request #1039 from argonui/import-export-token-remover
Browse files Browse the repository at this point in the history
Importer / Exporter: updated detection for token remover state
  • Loading branch information
dscarpac authored Dec 4, 2024
2 parents 22b6127 + eaaba2b commit 53986df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/core/CampaignImporterExporter.ttslua
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ function exportToToken()
-- check if Token Removers are enabled
local tokenRemoverList = guidReferenceApi.getObjectsByType("TokenRemover")
if #tokenRemoverList > 0 then
local zoneGUID = tokenRemoverList[1].call("onSave")
if getObjectFromGUID(zoneGUID) ~= nil then
if tokenRemoverList[1].getVar("state") == true then
dataToSave.enableTokenRemover = true
end
end
Expand Down
3 changes: 3 additions & 0 deletions src/tokens/TokenRemover.ttslua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
state = false

function updateSave()
self.script_state = JSON.encode(zone and zone.getGUID())
end
Expand Down Expand Up @@ -36,6 +38,7 @@ function disable()
end

function setMenu(isEnabled)
state = not isEnabled
self.clearContextMenu()
if isEnabled then
self.addContextMenuItem("Enable", enable)
Expand Down

0 comments on commit 53986df

Please sign in to comment.