From c04c7df9f1d119a4bdca54f995c01532dfc9eecd Mon Sep 17 00:00:00 2001 From: Buhallin Date: Thu, 17 Nov 2022 01:27:59 -0800 Subject: [PATCH] Handle review comments --- src/playercards/PlayerCardSpawner.ttslua | 4 ++-- src/playercards/spawnbag/BondedBag.ttslua | 28 +++++++++++++++++------ src/playercards/spawnbag/SpawnBag.ttslua | 7 ++---- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/playercards/PlayerCardSpawner.ttslua b/src/playercards/PlayerCardSpawner.ttslua index 3b2d6034..8e214385 100644 --- a/src/playercards/PlayerCardSpawner.ttslua +++ b/src/playercards/PlayerCardSpawner.ttslua @@ -2,7 +2,7 @@ -- 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 -- Z axis is horizontal -local zShift = -2.29998 +local SPREAD_Z_SHIFT = -2.3 Spawner = { } @@ -53,7 +53,7 @@ Spawner.spawnCardSpread = function(cardList, startPos, rot, sort, callback) local position = { x = startPos.x, y = startPos.y, z = startPos.z } for _, card in ipairs(cardList) do Spawner.spawn({ card }, position, rot, callback) - position.z = position.z + zShift + position.z = position.z + SPREAD_Z_SHIFT end end diff --git a/src/playercards/spawnbag/BondedBag.ttslua b/src/playercards/spawnbag/BondedBag.ttslua index b2a5bec3..0eb0f381 100644 --- a/src/playercards/spawnbag/BondedBag.ttslua +++ b/src/playercards/spawnbag/BondedBag.ttslua @@ -42,14 +42,28 @@ end function createActionButtons() self.createButton({ - label="Place", click_function="buttonClick_place", 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} + label="Place", + click_function="buttonClick_place", + 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({ - label="Recall", click_function="buttonClick_recall", 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} + label="Recall", + click_function="buttonClick_recall", + 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 @@ -57,7 +71,7 @@ function buttonClick_place() SpawnBag.spawn(SPAWN_SPEC) end ---Recalls objects to bag from table +-- Recalls objects to bag from table function buttonClick_recall() SpawnBag.recall() end diff --git a/src/playercards/spawnbag/SpawnBag.ttslua b/src/playercards/spawnbag/SpawnBag.ttslua index dfd70325..d45a16a9 100644 --- a/src/playercards/spawnbag/SpawnBag.ttslua +++ b/src/playercards/spawnbag/SpawnBag.ttslua @@ -53,7 +53,6 @@ local RECALL_BAG = { Tooltip = false, } - -- Tracks what has been placed by this "bag" so they can be recalled local placedSpecs = { } local placedObjectGuids = { } @@ -68,13 +67,11 @@ end -- Generates a table of save state that can be included in the parent object's onSave SpawnBag.getStateForSave = function() - local saveState = { + return { placed = placedSpecs, placedObjects = placedObjectGuids, recall = recallZone, } - - return saveState end -- 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 end if (pos.x < recallZone.lowerRight.x) then - recallZone.upperLeft.x = pos.x - RECALL_BUFFER_X + recallZone.lowerRight.x = pos.x - RECALL_BUFFER_X end if (pos.z > recallZone.upperLeft.z) then recallZone.upperLeft.z = pos.z + RECALL_BUFFER_Z