updating tools and their position

This commit is contained in:
Chr1Z93 2023-02-02 17:23:51 +01:00
parent 94b803deb3
commit caad1df8ea
17 changed files with 95 additions and 119 deletions

View File

@ -112,13 +112,11 @@
"Blesstokens.afa06b",
"Cursetokens.bd0253",
"TokenRemover.0a5a29",
"TokenSpawner.36b4ee",
"TokenSpawnTool.36b4ee",
"OfficialStandaloneChallengeScenarios.0ef5c8",
"TarotDeck.77f1e5",
"TarotDeckScripted.a230f9",
"Fan-MadeAccessories.aa8b38",
"UIBuilder.ddd2eb",
"CommandManager.a0b1de",
"CoreNightoftheZealot.64a613",
"TheDunwichLegacy.2898f6",
"ThePathtoCarcosa.aca04c",

View File

@ -1546,8 +1546,8 @@
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 77.886,
"posY": 1.043,
"posX": 78,
"posY": 0.96,
"posZ": 27.031,
"rotX": 0,
"rotY": 0,

View File

@ -33,8 +33,8 @@
],
"Tooltip": true,
"Transform": {
"posX": 77.159,
"posY": 1.297,
"posX": 78,
"posY": 1.208,
"posZ": 6.315,
"rotX": 0,
"rotY": 270,

View File

@ -33,8 +33,8 @@
],
"Tooltip": true,
"Transform": {
"posX": 77.464,
"posY": 1.485,
"posX": 78,
"posY": 1.395,
"posZ": 4.352,
"rotX": 0,
"rotY": 270,

View File

@ -42,8 +42,8 @@
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 77.159,
"posY": 1.284,
"posX": 78,
"posY": 1.195,
"posZ": 7.589,
"rotX": 0,
"rotY": 270,

View File

@ -21,7 +21,9 @@
"AttachmentFacedownHelper.3da8b6",
"GuardDog2.66c1cb",
"Flashlight3.ecd43e",
"DeckImporter-Commands.2e59f6"
"DeckImporter-Commands.2e59f6",
"UIBuilder.ddd2eb",
"CommandManager.a0b1de"
],
"ContainedObjects_path": "LegacyAssets.7165a9",
"CustomMesh": {

View File

@ -20,9 +20,9 @@
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"Locked": false,
"LuaScriptState": "",
"LuaScript_path": "CommandManager.a0b1de.ttslua",
"LuaScript_path": "LegacyAssets.7165a9/CommandManager.a0b1de.ttslua",
"MeasureMovement": false,
"Name": "Checker_black",
"Nickname": "Command Manager",
@ -30,9 +30,9 @@
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 77.06,
"posY": 1.296,
"posZ": 9.378,
"posX": -62.479,
"posY": 4.337,
"posZ": -90.341,
"rotX": 0,
"rotY": 270,
"rotZ": 180,

View File

@ -20,9 +20,9 @@
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"Locked": false,
"LuaScriptState": "",
"LuaScript_path": "UIBuilder.ddd2eb.ttslua",
"LuaScript_path": "LegacyAssets.7165a9/UIBuilder.ddd2eb.ttslua",
"MeasureMovement": false,
"Name": "Checker_black",
"Nickname": "UI Builder",
@ -30,9 +30,9 @@
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 77.06,
"posY": 1.296,
"posZ": 8.942,
"posX": -62.479,
"posY": 4.337,
"posZ": -90.777,
"rotX": 0,
"rotY": 270,
"rotZ": 180,

View File

@ -30,7 +30,7 @@
"Sticky": true,
"Tooltip": false,
"Transform": {
"posX": 77.836,
"posX": 78,
"posY": 1.244,
"posZ": 33.583,
"rotX": 0,

View File

@ -44,8 +44,8 @@
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 78.46,
"posY": 1.138,
"posX": 78,
"posY": 1.047,
"posZ": -1.001,
"rotX": 0,
"rotY": 0,

View File

@ -21,17 +21,17 @@
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"util/TokenSpawner\")",
"LuaScript": "require(\"util/TokenSpawnTool\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Checker_white",
"Nickname": "Token Spawner",
"Nickname": "Token Spawn Tool",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 77.159,
"posY": 1.297,
"posX": 78,
"posY": 1.208,
"posZ": 6.952,
"rotX": 0,
"rotY": 270,
@ -42,4 +42,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -30,8 +30,8 @@
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 77.88,
"posY": 1.485,
"posX": 78,
"posY": 1.395,
"posZ": 1.875,
"rotX": 0,
"rotY": 0,

View File

@ -1,98 +1,85 @@
-- Drawing Tool
-- created by: Chr1Z
-- original by: Whimsical
-- description: draws lines between selected objects
information = {
version = "1.1",
last_updated = "10.10.2022"
}
local lines = {}
-- save "lines" to be able to remove them after loading
function onSave() return JSON.encode(lines) end
function onSave()
return JSON.encode(lines)
end
-- load data and add context menu
function onload(saved_data)
lines = JSON.decode(saved_data) or {}
self.addContextMenuItem("More Information", function()
printToAll("------------------------------", "White")
printToAll("Drawing Tool v" .. information["version"] .. " by Chr1Z", "Orange")
printToAll("last updated: " .. information["last_updated"], "White")
printToAll("original concept by Whimsical", "White")
end)
function onLoad(savedData)
lines = JSON.decode(savedData) or {}
end
-- create timer when numpad 0 is pressed
function onScriptingButtonDown(index, player_color)
if index ~= 10 then return end
TimerID = Wait.time(function() draw_from(Player[player_color]) end, 1)
if index ~= 10 then return end
TimerID = Wait.time(function() draw_from(Player[player_color]) end, 1)
end
-- called for long press of numpad 0, draws lines from hovered object to selected objects
function draw_from(player)
local source = player.getHoverObject()
if not source then return end
local source = player.getHoverObject()
if not source then return end
for _, item in ipairs(player.getSelectedObjects()) do
if item.getGUID() ~= source.getGUID() then
if item.getGUID() > source.getGUID() then
draw_with_pair(item, source)
else
draw_with_pair(source, item)
end
end
for _, item in ipairs(player.getSelectedObjects()) do
if item.getGUID() ~= source.getGUID() then
if item.getGUID() > source.getGUID() then
draw_with_pair(item, source)
else
draw_with_pair(source, item)
end
end
end
process_lines()
process_lines()
end
-- general drawing of all lines between selected objects
function onScriptingButtonUp(index, player_color)
if index ~= 10 then return end
-- returns true only if there is a timer to cancel. If this is false then we've waited longer than a second.
if not Wait.stop(TimerID) then return end
if index ~= 10 then return end
-- returns true only if there is a timer to cancel. If this is false then we've waited longer than a second.
if not Wait.stop(TimerID) then return end
local items = Player[player_color].getSelectedObjects()
if #items < 2 then
broadcastToColor("You must have at least two items selected (currently: " .. #items .. ").", player_color, "Red")
return
local items = Player[player_color].getSelectedObjects()
if #items < 2 then
broadcastToColor("You must have at least two items selected (currently: " .. #items .. ").", player_color, "Red")
return
end
table.sort(items, function(a, b) return a.getGUID() > b.getGUID() end)
for f = 1, #items - 1 do
for s = f + 1, #items do
draw_with_pair(items[f], items[s])
end
end
table.sort(items, function(a, b) return a.getGUID() > b.getGUID() end)
for f = 1, #items - 1 do
for s = f + 1, #items do
draw_with_pair(items[f], items[s])
end
end
process_lines()
process_lines()
end
-- adds two objects to table of vector lines
function draw_with_pair(first, second)
local guid_first = first.getGUID()
local guid_second = second.getGUID()
local guid_first = first.getGUID()
local guid_second = second.getGUID()
if Global.getVectorLines() == nil then lines = {} end
if not lines[guid_first] then lines[guid_first] = {} end
if Global.getVectorLines() == nil then lines = {} end
if not lines[guid_first] then lines[guid_first] = {} end
if lines[guid_first][guid_second] then
lines[guid_first][guid_second] = nil
else
lines[guid_first][guid_second] = { points = { first.getPosition(), second.getPosition() }, color = "White" }
end
if lines[guid_first][guid_second] then
lines[guid_first][guid_second] = nil
else
lines[guid_first][guid_second] = { points = { first.getPosition(), second.getPosition() }, color = "White" }
end
end
-- updates the global vector lines based on "lines"
function process_lines()
local drawing = {}
local drawing = {}
for _, first in pairs(lines) do
for _, data in pairs(first) do
table.insert(drawing, data)
end
for _, first in pairs(lines) do
for _, data in pairs(first) do
table.insert(drawing, data)
end
end
Global.setVectorLines(drawing)
Global.setVectorLines(drawing)
end

View File

@ -1,31 +1,23 @@
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Whimsical.
--- DateTime: 2020-09-26 5:50 p.m.
---
---@param index number
---@param player_color string
-- cut 3 (6) cards from a deck if numpad 1 (2) is pressed
function onScriptingButtonDown(index, player_color)
if not (index>=1 and index<=3) then return end
if not (index >= 1 and index <= 2) then return end
local count = index * 3
---@type Player
local count = index * 3
local player = Player[player_color]
local object = player:getHoverObject()
local object = player.getHoverObject()
if (not object) then return end
if (object.tag~="Deck") then return end
if (count >= object:getQuantity()) then return end
if (object.tag ~= "Deck") then
broadcastToColor("Hover over a deck to cut 3 (6) cards when pressing 1 (2).", player_color, "Orange")
return
end
if (count >= object.getQuantity()) then return end
for _ =1, count do
local target_position = object:positionToWorld(Vector(0, 0, -3.5))
object:takeObject {
local pos = object.positionToWorld(Vector(0, 0, -3.5))
for _ = 1, count do
object.takeObject {
index = 0,
position = target_position,
position = pos,
smooth = false
}
end

View File

@ -1,8 +1,5 @@
local tokenManager = require("core/token/TokenManager")
local TOKEN_INDEX = {}
TOKEN_INDEX[1] = false
TOKEN_INDEX[2] = false
TOKEN_INDEX[3] = "resourceCounter"
TOKEN_INDEX[4] = "damage"
TOKEN_INDEX[5] = "path"