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