Handle review comments

This commit is contained in:
Buhallin 2022-11-17 01:27:59 -08:00
parent 2eba59d971
commit c04c7df9f1
No known key found for this signature in database
GPG Key ID: DB3C362823852294
3 changed files with 25 additions and 14 deletions

View File

@ -2,7 +2,7 @@
-- Amount to shift for the next card (zShift) or next row of cards (xShift) -- Amount to shift for the next card (zShift) or next row of cards (xShift)
-- Note that the table rotation is weird, and the X axis is vertical while the -- Note that the table rotation is weird, and the X axis is vertical while the
-- Z axis is horizontal -- Z axis is horizontal
local zShift = -2.29998 local SPREAD_Z_SHIFT = -2.3
Spawner = { } Spawner = { }
@ -53,7 +53,7 @@ Spawner.spawnCardSpread = function(cardList, startPos, rot, sort, callback)
local position = { x = startPos.x, y = startPos.y, z = startPos.z } local position = { x = startPos.x, y = startPos.y, z = startPos.z }
for _, card in ipairs(cardList) do for _, card in ipairs(cardList) do
Spawner.spawn({ card }, position, rot, callback) Spawner.spawn({ card }, position, rot, callback)
position.z = position.z + zShift position.z = position.z + SPREAD_Z_SHIFT
end end
end end

View File

@ -42,14 +42,28 @@ end
function createActionButtons() function createActionButtons()
self.createButton({ self.createButton({
label="Place", click_function="buttonClick_place", function_owner=self, label="Place",
position={1,0.1,2.1}, rotation={0,0,0}, height=350, width=800, click_function="buttonClick_place",
font_size=250, color={0,0,0}, font_color={1,1,1} function_owner=self,
position={1,0.1,2.1},
rotation={0,0,0},
height=350,
width=800,
font_size=250,
color={0,0,0},
font_color={1,1,1}
}) })
self.createButton({ self.createButton({
label="Recall", click_function="buttonClick_recall", function_owner=self, label="Recall",
position={-1,0.1,2.1}, rotation={0,0,0}, height=350, width=800, click_function="buttonClick_recall",
font_size=250, color={0,0,0}, font_color={1,1,1} function_owner=self,
position={-1,0.1,2.1},
rotation={0,0,0},
height=350,
width=800,
font_size=250,
color={0,0,0},
font_color={1,1,1}
}) })
end end
@ -57,7 +71,7 @@ function buttonClick_place()
SpawnBag.spawn(SPAWN_SPEC) SpawnBag.spawn(SPAWN_SPEC)
end end
--Recalls objects to bag from table -- Recalls objects to bag from table
function buttonClick_recall() function buttonClick_recall()
SpawnBag.recall() SpawnBag.recall()
end end

View File

@ -53,7 +53,6 @@ local RECALL_BAG = {
Tooltip = false, Tooltip = false,
} }
-- Tracks what has been placed by this "bag" so they can be recalled -- Tracks what has been placed by this "bag" so they can be recalled
local placedSpecs = { } local placedSpecs = { }
local placedObjectGuids = { } local placedObjectGuids = { }
@ -68,13 +67,11 @@ end
-- Generates a table of save state that can be included in the parent object's onSave -- Generates a table of save state that can be included in the parent object's onSave
SpawnBag.getStateForSave = function() SpawnBag.getStateForSave = function()
local saveState = { return {
placed = placedSpecs, placed = placedSpecs,
placedObjects = placedObjectGuids, placedObjects = placedObjectGuids,
recall = recallZone, recall = recallZone,
} }
return saveState
end end
-- Places the given spawnSpec on the table. See SpawnBag.ttslua header for spawnSpec table data and -- Places the given spawnSpec on the table. See SpawnBag.ttslua header for spawnSpec table data and
@ -149,7 +146,7 @@ function expandRecallZone(spawnedCard)
recallZone.upperLeft.x = pos.x + RECALL_BUFFER_X recallZone.upperLeft.x = pos.x + RECALL_BUFFER_X
end end
if (pos.x < recallZone.lowerRight.x) then if (pos.x < recallZone.lowerRight.x) then
recallZone.upperLeft.x = pos.x - RECALL_BUFFER_X recallZone.lowerRight.x = pos.x - RECALL_BUFFER_X
end end
if (pos.z > recallZone.upperLeft.z) then if (pos.z > recallZone.upperLeft.z) then
recallZone.upperLeft.z = pos.z + RECALL_BUFFER_Z recallZone.upperLeft.z = pos.z + RECALL_BUFFER_Z