investigator handling

This commit is contained in:
Chr1Z93 2024-09-04 10:12:56 +02:00
parent 5fba05bd57
commit c35939402c

View File

@ -157,15 +157,22 @@ function onDrop(playerColor)
local syncObj = searchResult[1] local syncObj = searchResult[1]
local syncName = syncObj.getName() local syncName = syncObj.getName()
local notes = syncObj.getGMNotes() local notes = syncObj.getGMNotes()
local metadata = JSON.decode(notes) or {} local md = JSON.decode(notes) or {}
local syncId = metadata.id
-- loop through background table -- loop through background table
for _, bgInfo in ipairs(BACKGROUNDS) do for _, bgInfo in ipairs(BACKGROUNDS) do
if bgInfo.id == syncId or bgInfo.id2 == syncId then if bgInfo.id == md.id or bgInfo.id2 == md.id then
printToColor("Background for '" .. syncName .. "' loaded!", playerColor, "Green") printToColor("Background for '" .. syncName .. "' loaded!", playerColor, "Green")
showIcons = bgInfo.icons showIcons = bgInfo.icons
self.setRotation(syncObj.getRotation())
-- update rotation
local syncRotY = syncObj.getRotation().y
if md.type == "Investigator" then
syncRotY = syncRotY + 90
end
self.setRotation(self.getRotation():setAt("y", syncRotY))
-- update the image
updateImage(bgInfo.url) updateImage(bgInfo.url)
return return
end end