object metadata addition to memo

This commit is contained in:
Chr1Z93 2023-09-29 11:11:38 +02:00
parent 769249c21f
commit f6d0a99674
29 changed files with 37 additions and 5 deletions

View File

@ -45,6 +45,7 @@
"LuaScript": "require(\"playermat/ClueCounter\")", "LuaScript": "require(\"playermat/ClueCounter\")",
"LuaScriptState": "", "LuaScriptState": "",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model", "Name": "Custom_Model",
"Nickname": "Clue Counter", "Nickname": "Clue Counter",
"Snap": true, "Snap": true,

View File

@ -45,6 +45,7 @@
"LuaScript": "require(\"playermat/ClueCounter\")", "LuaScript": "require(\"playermat/ClueCounter\")",
"LuaScriptState": "", "LuaScriptState": "",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model", "Name": "Custom_Model",
"Nickname": "Clue Counter", "Nickname": "Clue Counter",
"Snap": true, "Snap": true,

View File

@ -45,6 +45,7 @@
"LuaScript": "require(\"playermat/ClueCounter\")", "LuaScript": "require(\"playermat/ClueCounter\")",
"LuaScriptState": "", "LuaScriptState": "",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model", "Name": "Custom_Model",
"Nickname": "Clue Counter", "Nickname": "Clue Counter",
"Snap": true, "Snap": true,

View File

@ -45,6 +45,7 @@
"LuaScript": "require(\"playermat/ClueCounter\")", "LuaScript": "require(\"playermat/ClueCounter\")",
"LuaScriptState": "", "LuaScriptState": "",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model", "Name": "Custom_Model",
"Nickname": "Clue Counter", "Nickname": "Clue Counter",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"ClickableClueCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Clues", "Nickname": "Clues",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"ClickableClueCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Clues", "Nickname": "Clues",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"ClickableClueCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Clues", "Nickname": "Clues",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"ClickableClueCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Clues", "Nickname": "Clues",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"DamageCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Damage\n", "Nickname": "Damage\n",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"DamageCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Damage\n", "Nickname": "Damage\n",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"DamageCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Damage\n", "Nickname": "Damage\n",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"DamageCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Damage\n", "Nickname": "Damage\n",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"HorrorCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Horror", "Nickname": "Horror",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"HorrorCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Horror", "Nickname": "Horror",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"HorrorCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Horror", "Nickname": "Horror",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "0", "LuaScriptState": "0",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"HorrorCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Horror", "Nickname": "Horror",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")", "LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]", "LuaScriptState": "[1,1,1,1]",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"InvestigatorSkillTracker\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker", "Nickname": "Investigator Skill Tracker",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")", "LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]", "LuaScriptState": "[1,1,1,1]",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"InvestigatorSkillTracker\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker", "Nickname": "Investigator Skill Tracker",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")", "LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]", "LuaScriptState": "[1,1,1,1]",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"InvestigatorSkillTracker\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker", "Nickname": "Investigator Skill Tracker",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"playermat/InvestigatorSkillTracker\")", "LuaScript": "require(\"playermat/InvestigatorSkillTracker\")",
"LuaScriptState": "[1,1,1,1]", "LuaScriptState": "[1,1,1,1]",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"InvestigatorSkillTracker\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Investigator Skill Tracker", "Nickname": "Investigator Skill Tracker",
"Snap": true, "Snap": true,

View File

@ -346,6 +346,7 @@
"LuaScriptState_path": "Playermat1White.8b081b.luascriptstate", "LuaScriptState_path": "Playermat1White.8b081b.luascriptstate",
"LuaScript_path": "Playermat1White.8b081b.ttslua", "LuaScript_path": "Playermat1White.8b081b.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"Playermat\"}",
"Name": "Custom_Tile", "Name": "Custom_Tile",
"Nickname": "Playermat 1: White", "Nickname": "Playermat 1: White",
"Snap": true, "Snap": true,

View File

@ -346,6 +346,7 @@
"LuaScriptState_path": "Playermat2Orange.bd0ff4.luascriptstate", "LuaScriptState_path": "Playermat2Orange.bd0ff4.luascriptstate",
"LuaScript_path": "Playermat2Orange.bd0ff4.ttslua", "LuaScript_path": "Playermat2Orange.bd0ff4.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"Playermat\"}",
"Name": "Custom_Tile", "Name": "Custom_Tile",
"Nickname": "Playermat 2: Orange", "Nickname": "Playermat 2: Orange",
"Snap": true, "Snap": true,

View File

@ -346,6 +346,7 @@
"LuaScriptState_path": "Playermat3Green.383d8b.luascriptstate", "LuaScriptState_path": "Playermat3Green.383d8b.luascriptstate",
"LuaScript_path": "Playermat3Green.383d8b.ttslua", "LuaScript_path": "Playermat3Green.383d8b.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"Playermat\"}",
"Name": "Custom_Tile", "Name": "Custom_Tile",
"Nickname": "Playermat 3: Green", "Nickname": "Playermat 3: Green",
"Snap": true, "Snap": true,

View File

@ -346,6 +346,7 @@
"LuaScriptState_path": "Playermat4Red.0840d5.luascriptstate", "LuaScriptState_path": "Playermat4Red.0840d5.luascriptstate",
"LuaScript_path": "Playermat4Red.0840d5.ttslua", "LuaScript_path": "Playermat4Red.0840d5.ttslua",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"Playermat\"}",
"Name": "Custom_Tile", "Name": "Custom_Tile",
"Nickname": "Playermat 4: Red", "Nickname": "Playermat 4: Red",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "5", "LuaScriptState": "5",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"White\",\"type\":\"ResourceCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Resources", "Nickname": "Resources",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "5", "LuaScriptState": "5",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Orange\",\"type\":\"ResourceCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Resources", "Nickname": "Resources",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "5", "LuaScriptState": "5",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Red\",\"type\":\"ResourceCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Resources", "Nickname": "Resources",
"Snap": true, "Snap": true,

View File

@ -36,6 +36,7 @@
"LuaScript": "require(\"core/GenericCounter\")", "LuaScript": "require(\"core/GenericCounter\")",
"LuaScriptState": "5", "LuaScriptState": "5",
"MeasureMovement": false, "MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"ResourceCounter\"}",
"Name": "Custom_Token", "Name": "Custom_Token",
"Nickname": "Resources", "Nickname": "Resources",
"Snap": true, "Snap": true,

View File

@ -893,7 +893,7 @@ function applyOptionPanelChange(id, state)
for i, color in ipairs(MAT_COLORS) do for i, color in ipairs(MAT_COLORS) do
local pos = playmatApi.transformLocalPosition({0.05, 0, -1.182}, color) local pos = playmatApi.transformLocalPosition({0.05, 0, -1.182}, color)
local rot = playmatApi.returnRotation(color) local rot = playmatApi.returnRotation(color)
optionPanel[id][i] = spawnOrRemoveHelper(state, "Hand Helper", pos, rot) optionPanel[id][i] = spawnOrRemoveHelper(state, "Hand Helper", pos, rot, color)
end end
-- option: Show search assistant for each player -- option: Show search assistant for each player
@ -901,7 +901,7 @@ function applyOptionPanelChange(id, state)
for i, color in ipairs(MAT_COLORS) do for i, color in ipairs(MAT_COLORS) do
local pos = playmatApi.transformLocalPosition({-0.3, 0, -1.182}, color) local pos = playmatApi.transformLocalPosition({-0.3, 0, -1.182}, color)
local rot = playmatApi.returnRotation(color) local rot = playmatApi.returnRotation(color)
optionPanel[id][i] = spawnOrRemoveHelper(state, "Search Assistant", pos, rot) optionPanel[id][i] = spawnOrRemoveHelper(state, "Search Assistant", pos, rot, color)
end end
-- option: Show attachment helper -- option: Show attachment helper
@ -928,12 +928,12 @@ end
---@param position Vector Position of the object (where it will spawn) ---@param position Vector Position of the object (where it will spawn)
---@param rotation Vector Rotation of the object for spawning (default: {0, 270, 0}) ---@param rotation Vector Rotation of the object for spawning (default: {0, 270, 0})
---@return. GUID of the spawnedObj (or nil if object was removed) ---@return. GUID of the spawnedObj (or nil if object was removed)
function spawnOrRemoveHelper(state, name, position, rotation) function spawnOrRemoveHelper(state, name, position, rotation, color)
if (type(state) == "table" and #state == 0) then if (type(state) == "table" and #state == 0) then
return removeHelperObject(name) return removeHelperObject(name)
elseif state then elseif state then
Player.getPlayers()[1].pingTable(position) Player.getPlayers()[1].pingTable(position)
return spawnHelperObject(name, position, rotation).getGUID() return spawnHelperObject(name, position, rotation, color).getGUID()
else else
return removeHelperObject(name) return removeHelperObject(name)
end end
@ -942,7 +942,9 @@ end
-- copies the specified tool (by name) from the option panel source bag -- copies the specified tool (by name) from the option panel source bag
---@param name String Name of the object that should be copied ---@param name String Name of the object that should be copied
---@param position Table Desired position of the object ---@param position Table Desired position of the object
function spawnHelperObject(name, position, rotation) ---@param rotation Table Desired rotation of the object (defaults to object's rotation)
---@param color String Matcolor this object is spawned for to set memo
function spawnHelperObject(name, position, rotation, color)
local sourceBag = getObjectFromGUID("830bd0") local sourceBag = getObjectFromGUID("830bd0")
-- error handling for missing sourceBag -- error handling for missing sourceBag
@ -961,6 +963,8 @@ function spawnHelperObject(name, position, rotation)
for _, obj in ipairs(sourceBag.getData().ContainedObjects) do for _, obj in ipairs(sourceBag.getData().ContainedObjects) do
if obj["Nickname"] == name then if obj["Nickname"] == name then
spawnTable.data = obj spawnTable.data = obj
-- this set the memo to identify the object at a later point (type = name without spaces)
spawnTable.data["Memo"] = "{\"matColor\":\"" .. color .. "\",\"type\":\"" .. name:gsub("%s+", "") .. "\"}"
spawnTable.callback_function = function(spawnedObj) spawnTable.callback_function = function(spawnedObj)
Wait.time(function() spawnedObj.setLock(true) end, 2) Wait.time(function() spawnedObj.setLock(true) end, 2)
end end