From c35939402c837b8d40eb8de758eff862397da905 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Wed, 4 Sep 2024 10:12:56 +0200 Subject: [PATCH] investigator handling --- src/accessories/AttachmentHelper.ttslua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/accessories/AttachmentHelper.ttslua b/src/accessories/AttachmentHelper.ttslua index 72c277ce..f268d9b4 100644 --- a/src/accessories/AttachmentHelper.ttslua +++ b/src/accessories/AttachmentHelper.ttslua @@ -157,15 +157,22 @@ function onDrop(playerColor) local syncObj = searchResult[1] local syncName = syncObj.getName() local notes = syncObj.getGMNotes() - local metadata = JSON.decode(notes) or {} - local syncId = metadata.id + local md = JSON.decode(notes) or {} -- loop through background table 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") 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) return end