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\")",
"LuaScriptState": "",
"MeasureMovement": false,
"Memo": "{\"matColor\":\"Green\",\"type\":\"ClueCounter\"}",
"Name": "Custom_Model",
"Nickname": "Clue Counter",
"Snap": true,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -893,7 +893,7 @@ function applyOptionPanelChange(id, state)
for i, color in ipairs(MAT_COLORS) do
local pos = playmatApi.transformLocalPosition({0.05, 0, -1.182}, 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
-- option: Show search assistant for each player
@ -901,7 +901,7 @@ function applyOptionPanelChange(id, state)
for i, color in ipairs(MAT_COLORS) do
local pos = playmatApi.transformLocalPosition({-0.3, 0, -1.182}, 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
-- option: Show attachment helper
@ -928,12 +928,12 @@ end
---@param position Vector Position of the object (where it will spawn)
---@param rotation Vector Rotation of the object for spawning (default: {0, 270, 0})
---@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
return removeHelperObject(name)
elseif state then
Player.getPlayers()[1].pingTable(position)
return spawnHelperObject(name, position, rotation).getGUID()
return spawnHelperObject(name, position, rotation, color).getGUID()
else
return removeHelperObject(name)
end
@ -942,7 +942,9 @@ end
-- copies the specified tool (by name) from the option panel source bag
---@param name String Name of the object that should be copied
---@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")
-- error handling for missing sourceBag
@ -961,6 +963,8 @@ function spawnHelperObject(name, position, rotation)
for _, obj in ipairs(sourceBag.getData().ContainedObjects) do
if obj["Nickname"] == name then
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)
Wait.time(function() spawnedObj.setLock(true) end, 2)
end