more resilience to latency
This commit is contained in:
parent
f95613714c
commit
58e992dd0a
@ -291,17 +291,13 @@ function layout(_, _, isRightClick)
|
||||
local data = {}
|
||||
|
||||
-- clone tokens from chaos bag (default position above trash can)
|
||||
for i, obj in ipairs(chaosBag.getData().ContainedObjects) do
|
||||
obj["Tags"] = { "tempToken" }
|
||||
local value = tonumber(obj.Nickname)
|
||||
local precedence = tokenPrecedence[obj.Nickname]
|
||||
local spawnedObj = spawnObjectData({
|
||||
data = obj,
|
||||
position = { 0.49, 3, 0 }
|
||||
})
|
||||
for i, objData in ipairs(chaosBag.getData().ContainedObjects) do
|
||||
objData["Tags"] = { "tempToken" }
|
||||
local value = tonumber(objData.Nickname)
|
||||
local precedence = tokenPrecedence[objData.Nickname]
|
||||
|
||||
data[i] = {
|
||||
token = spawnedObj,
|
||||
token = objData,
|
||||
value = value or precedence[1]
|
||||
}
|
||||
|
||||
@ -321,12 +317,14 @@ function layout(_, _, isRightClick)
|
||||
if percentage then pos.z = pos.z - 3.05 end
|
||||
|
||||
local location = { x = pos.x, y = pos.y, z = pos.z }
|
||||
local rotation = self.getRotation()
|
||||
local currentValue = data[1].value
|
||||
local tokenCount = { row = 0, sum = 0, total = #data }
|
||||
local valueCount = 1
|
||||
local tokenName = false
|
||||
|
||||
for i, item in ipairs(data) do
|
||||
|
||||
-- this is true for the first token in a new row
|
||||
if item.value ~= currentValue then
|
||||
if percentage then
|
||||
@ -340,12 +338,16 @@ function layout(_, _, isRightClick)
|
||||
valueCount = valueCount + 1
|
||||
tokenCount.row = 0
|
||||
end
|
||||
|
||||
item.token.setPosition(location)
|
||||
item.token.setRotation(self.getRotation())
|
||||
item.token.setLock(true)
|
||||
|
||||
local spawnedObj = spawnObjectData({
|
||||
data = item.token,
|
||||
position = { 0.49, 2 + 0.5*i, 0 }
|
||||
})
|
||||
spawnedObj.setPosition(location)
|
||||
spawnedObj.setRotation(rotation)
|
||||
spawnedObj.setLock(true)
|
||||
tokenName = spawnedObj.getName()
|
||||
location.z = location.z - 1.75
|
||||
tokenName = item.token.getName()
|
||||
tokenCount.row = tokenCount.row + 1
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user