SCED/src/core/PlayAreaApi.ttslua
Buhallin db65f3c8e3
Add PlayArea API
Creates an API object for the PlayArea, and moves most references to the PlayArea to use the API instead.

Image swapper is excluded on this, as I'm not completely sure how TTS will handle having an object rebuild itself.
2022-12-12 18:56:04 -08:00

51 lines
2.6 KiB
Plaintext

do
local PlayAreaApi = { }
local PLAY_AREA_GUID = "721ba2"
-- Returns the current value of the investigator counter from the playmat
---@return Integer. Number of investigators currently set on the counter
PlayAreaApi.getInvestigatorCount = function()
return getObjectFromGUID(PLAY_AREA_GUID).call("getInvestigatorCount")
end
-- Move all contents on the play area (cards, tokens, etc) one row up. Certain fixed objects will
-- be ignored, as will anything the player has tagged with 'displacement_excluded'
---@param playerColor Color of the player requesting the shift. Used solely to send an error
--- message in the unlikely case that the scripting zone has been deleted
PlayAreaApi.shiftContentsUp = function(playerColor)
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsUp", playerColor)
end
-- Move all contents on the play area (cards, tokens, etc) one row down. Certain fixed objects
-- will be ignored, as will anything the player has tagged with 'displacement_excluded'
---@param playerColor Color of the player requesting the shift. Used solely to send an error
--- message in the unlikely case that the scripting zone has been deleted
PlayAreaApi.shiftContentsDown = function(playerColor)
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsDown", playerColor)
end
-- Move all contents on the play area (cards, tokens, etc) one column left. Certain fixed objects
-- will be ignored, as will anything the player has tagged with 'displacement_excluded'
---@param playerColor Color of the player requesting the shift. Used solely to send an error
--- message in the unlikely case that the scripting zone has been deleted
PlayAreaApi.shiftContentsLeft = function(playerColor)
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsLeft", playerColor)
end
-- Move all contents on the play area (cards, tokens, etc) one column right. Certain fixed
-- objects will be ignored, as will anything the player has tagged with 'displacement_excluded'
---@param playerColor Color of the player requesting the shift. Used solely to send an error
--- message in the unlikely case that the scripting zone has been deleted
PlayAreaApi.shiftContentsRight = function(playerColor)
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsRight", playerColor)
end
-- Reset the play area's tracking of which cards have had tokens spawned.
PlayAreaApi.resetSpawnedCards = function()
return getObjectFromGUID(PLAY_AREA_GUID).call("resetSpawnedCards")
end
return PlayAreaApi
end