Merge branch 'master' into patches

This commit is contained in:
Adam Goldsmith 2021-04-10 00:46:27 -04:00
commit 7bb3dd1da7
832 changed files with 35776 additions and 18574 deletions

View File

@ -24,7 +24,7 @@ CameraStates:
- null
ComponentTags:
labels: []
Date: 3/22/2021 3:09:47 PM
Date: 4/6/2021 5:23:05 PM
DecalPallet:
- ImageURL: http://cloud-3.steamusercontent.com/ugc/1474319121424323663/BC5570ECF747F1B30224461B576E8B0FE7FA5F33/
Name: Achivement Checkmark
@ -504,8 +504,8 @@ ObjectStates:
- !include 'unpacked/Custom_Tile Whimsical''s Token Remover 0a5a29.yaml'
- !include 'unpacked/Custom_Token BlessCurse Token Manager 5933fb.yaml'
- !include 'unpacked/Checker_white Token Spawner 36b4ee.yaml'
- !include 'unpacked/Custom_Model_Bag Investigator Replacements 2bd67f.yaml'
- !include 'unpacked/Notecard Arkham SCE 1.55 - 3222021 - Page 1 af01b8.yaml'
- !include 'unpacked/Custom_Model_Bag Investigator Replacements 570406.yaml'
- !include 'unpacked/Notecard Arkham SCE 1.5501 - 462021 - Page 1 af01b8.yaml'
PlayArea: 1.0
PlayerCounts:
- 0
@ -514,7 +514,7 @@ PlayingTime:
- 0
- 0
Rules: ''
SaveName: Arkham SCE 1.55
SaveName: Arkham SCE 1.5501
Sky: Sky_Museum
SkyURL: https://i.imgur.com/GkQqaOF.jpg
SnapPoints:

View File

@ -1022,7 +1022,7 @@ ContainedObjects:
- !include 'Bag All Player Cards 15bb07/CardCustom Justify the Means (3) 2770dd.yaml'
- !include 'Bag All Player Cards 15bb07/CardCustom Lucky Dice (3) 723609.yaml'
- !include 'Bag All Player Cards 15bb07/Card Enchant Weapon (3) 33455f.yaml'
- !include 'Bag All Player Cards 15bb07/Card Nephthys (4) 66c93b.yaml'
- !include 'Bag All Player Cards 15bb07/Card Nephthys (4) 5659d1.yaml'
- !include 'Bag All Player Cards 15bb07/Card The Stygian Eye (3) c4ae95.yaml'
- !include 'Bag All Player Cards 15bb07/Card Hyperawareness (4) 78adda.yaml'
- !include 'Bag All Player Cards 15bb07/Card Geas (2) b7223c.yaml'
@ -1034,6 +1034,9 @@ ContainedObjects:
- !include 'Bag All Player Cards 15bb07/Card Favor of the Moon (1) 542a70.yaml'
- !include 'Bag All Player Cards 15bb07/Card Favor of the Sun (1) 1e6a06.yaml'
- !include 'Bag All Player Cards 15bb07/Card Purifying Corruption (4) ac9763.yaml'
- !include 'Bag All Player Cards 15bb07/Card Waveworn Idol 591284.yaml'
- !include 'Bag All Player Cards 15bb07/Card Headdress of Y''ha-nthlei e44c96.yaml'
- !include 'Bag All Player Cards 15bb07/Card Awakened Mantle e81861.yaml'
Description: ''
DragSelectable: true
GMNotes: ''

View File

@ -1,22 +1,22 @@
Autoraise: true
CardID: 536300
CardID: 451113
ColorDiffuse:
b: 0.713235259
g: 0.713235259
r: 0.713235259
CustomDeck:
'5363':
'4511':
BackIsHidden: true
BackURL: https://i.imgur.com/EcbhVuh.jpg/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1496838227126880981/92B4DE73E4772563B8288697DC2F9049F74A64F3/
NumHeight: 1
NumWidth: 1
FaceURL: http://cloud-3.steamusercontent.com/ugc/1655600400212405700/559F1F3EF87BDF7F067F9B7011EDC3A6ACE71259/
NumHeight: 5
NumWidth: 5
Type: 0
UniqueBack: false
Description: ''
DragSelectable: true
GMNotes: ''
GUID: b52142
GUID: e81861
Grid: true
GridProjection: false
Hands: true
@ -27,19 +27,19 @@ Locked: false
LuaScript: ''
LuaScriptState: ''
MeasureMovement: false
Name: CardCustom
Nickname: ''
Name: Card
Nickname: Awakened Mantle
SidewaysCard: false
Snap: true
Sticky: true
Tooltip: true
Transform:
posX: -11.2
posY: 3.68
posZ: 6.74
rotX: 359.94
posX: 78.84
posY: 3.33
posZ: 0.97
rotX: 359.39
rotY: 270.0
rotZ: 0.01
rotZ: 179.71
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -1,22 +1,22 @@
Autoraise: true
CardID: 536100
CardID: 451114
ColorDiffuse:
b: 0.713235259
g: 0.713235259
r: 0.713235259
CustomDeck:
'5361':
'4511':
BackIsHidden: true
BackURL: https://i.imgur.com/EcbhVuh.jpg/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1496838227126879976/105904C526CF885FF384B2867462728CB54B4CA2/
NumHeight: 1
NumWidth: 1
FaceURL: http://cloud-3.steamusercontent.com/ugc/1655600400212405700/559F1F3EF87BDF7F067F9B7011EDC3A6ACE71259/
NumHeight: 5
NumWidth: 5
Type: 0
UniqueBack: false
Description: ''
DragSelectable: true
GMNotes: ''
GUID: 1af547
GUID: e44c96
Grid: true
GridProjection: false
Hands: true
@ -27,19 +27,19 @@ Locked: false
LuaScript: ''
LuaScriptState: ''
MeasureMovement: false
Name: CardCustom
Nickname: ''
Name: Card
Nickname: Headdress of Y'ha-nthlei
SidewaysCard: false
Snap: true
Sticky: true
Tooltip: true
Transform:
posX: -10.72
posY: 3.68
posZ: 6.82
rotX: 359.94
rotY: 270.01
rotZ: 0.01
posX: 78.61
posY: 3.29
posZ: 0.24
rotX: 359.21
rotY: 269.96
rotZ: 183.65
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -16,7 +16,7 @@ CustomDeck:
Description: Huntress of Bast
DragSelectable: true
GMNotes: ''
GUID: 66c93b
GUID: 5659d1
Grid: true
GridProjection: false
Hands: true
@ -24,7 +24,7 @@ HideWhenFaceDown: true
IgnoreFoW: false
LayoutGroupSortIndex: 0
Locked: false
LuaScript: ''
LuaScript: !include 'Card Nephthys (4) 5659d1.ttslua'
LuaScriptState: ''
MeasureMovement: false
Name: Card
@ -34,12 +34,12 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 7.23
posY: 3.56
posZ: -22.6
rotX: 0.27
posX: 70.16
posY: 2.32
posZ: -70.23
rotX: 0.08
rotY: 270.0
rotZ: 180.29
rotZ: 179.99
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -1,22 +1,22 @@
Autoraise: true
CardID: 536200
CardID: 451112
ColorDiffuse:
b: 0.713235259
g: 0.713235259
r: 0.713235259
CustomDeck:
'5362':
'4511':
BackIsHidden: true
BackURL: https://i.imgur.com/EcbhVuh.jpg/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1496838227126880498/F7C4EE9D2420F15AAE07B2BAED7A1DCCA7794C00/
NumHeight: 1
NumWidth: 1
FaceURL: http://cloud-3.steamusercontent.com/ugc/1655600400212405700/559F1F3EF87BDF7F067F9B7011EDC3A6ACE71259/
NumHeight: 5
NumWidth: 5
Type: 0
UniqueBack: false
Description: ''
DragSelectable: true
GMNotes: ''
GUID: d51e37
GUID: '591284'
Grid: true
GridProjection: false
Hands: true
@ -27,19 +27,19 @@ Locked: false
LuaScript: ''
LuaScriptState: ''
MeasureMovement: false
Name: CardCustom
Nickname: ''
Name: Card
Nickname: Waveworn Idol
SidewaysCard: false
Snap: true
Sticky: true
Tooltip: true
Transform:
posX: -10.47
posY: 3.68
posZ: 7.68
rotX: 359.94
posX: 78.34
posY: 3.33
posZ: 0.31
rotX: 359.81
rotY: 270.0
rotZ: 0.01
rotZ: 180.84
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -2,9 +2,9 @@ Autoraise: true
Bag:
Order: 0
ColorDiffuse:
b: 0.2499978
g: 0.2499978
r: 0.2499978
b: 0.249997646
g: 0.249997646
r: 0.249997646
ContainedObjects:
- !include 'Bag Random Basic Weaknesses 770c4e/Card Self-Destructive 2204cc.yaml'
- !include 'Bag Random Basic Weaknesses 770c4e/Card Indebted b2ef43.yaml'

View File

@ -1,8 +1,8 @@
Autoraise: true
ColorDiffuse:
b: 0.141080678
g: 0.141080678
r: 0.141080678
b: 0.141080379
g: 0.141080379
r: 0.141080379
CustomMesh:
CastShadows: true
ColliderURL: ''

View File

@ -1,8 +1,8 @@
Autoraise: true
ColorDiffuse:
b: 0.141080678
g: 0.141080678
r: 0.141080678
b: 0.141080379
g: 0.141080379
r: 0.141080379
CustomMesh:
CastShadows: true
ColliderURL: ''

View File

@ -1,8 +1,8 @@
Autoraise: true
ColorDiffuse:
b: 0.141080678
g: 0.141080678
r: 0.141080678
b: 0.141080379
g: 0.141080379
r: 0.141080379
CustomMesh:
CastShadows: true
ColliderURL: ''

View File

@ -258,9 +258,9 @@ States:
Sticky: true
Tooltip: true
Transform:
posX: -47.66
posX: -47.65
posY: 1.61
posZ: 21.13
posZ: 21.15
rotX: 359.92
rotY: 270.01
rotZ: 0.02

View File

@ -258,9 +258,9 @@ States:
Sticky: true
Tooltip: true
Transform:
posX: -47.67
posX: -47.65
posY: 1.6
posZ: -23.47
posZ: -23.46
rotX: 359.92
rotY: 269.94
rotZ: 0.02

View File

@ -258,11 +258,11 @@ States:
Sticky: true
Tooltip: true
Transform:
posX: -47.67
posX: -47.65
posY: 1.6
posZ: -21.0
posZ: -20.99
rotX: 359.92
rotY: 269.95
rotY: 269.94
rotZ: 0.02
scaleX: 0.45
scaleY: 0.6

View File

@ -258,9 +258,9 @@ States:
Sticky: true
Tooltip: true
Transform:
posX: -47.66
posX: -47.65
posY: 1.61
posZ: 22.37
posZ: 22.38
rotX: 359.92
rotY: 269.95
rotZ: 0.02

View File

@ -258,9 +258,9 @@ States:
Sticky: true
Tooltip: true
Transform:
posX: -47.67
posX: -47.65
posY: 1.61
posZ: 23.6
posZ: 23.62
rotX: 359.92
rotY: 269.95
rotZ: 0.02

View File

@ -258,9 +258,9 @@ States:
Sticky: true
Tooltip: true
Transform:
posX: -47.67
posX: -47.65
posY: 1.6
posZ: -22.24
posZ: -22.23
rotX: 359.92
rotY: 270.04
rotZ: 0.02

View File

@ -8,15 +8,6 @@ ColorDiffuse:
ContainedObjects:
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile 0a46d1.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile 066d48.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile 675e97.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile 50e58d.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
@ -25,6 +16,15 @@ ContainedObjects:
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile 0a46d1.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile 066d48.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile 675e97.yaml'
- !include 'Custom_Model_Bag Chaos Bag fea079/Custom_Tile a752d9.yaml'
CustomMesh:
CastShadows: true
@ -65,9 +65,9 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 1.65
posX: 1.64
posY: 1.58
posZ: -13.9
posZ: -13.86
rotX: 359.93
rotY: 315.01
rotZ: 359.96

View File

@ -11,7 +11,7 @@ CustomImage:
Type: 2
ImageScalar: 1.0
ImageSecondaryURL: ''
ImageURL: https://i.imgur.com/yfs8gHq.png
ImageURL: https://i.imgur.com/1plY463.png
WidthScale: 0.0
Description: ''
DragSelectable: true

View File

@ -1,10 +1,56 @@
-- Utility memory bag by Directsun
-- Version 2.5.2
-- Fork of Memory Bag 2.0 by MrStump
function updateSave()
local data_to_save = {["ml"]=memoryList}
saved_data = JSON.encode(data_to_save)
self.script_state = saved_data
end
function combineMemoryFromBagsWithin()
local bagObjList = self.getObjects()
for _, bagObj in ipairs(bagObjList) do
local data = bagObj.lua_script_state
if data ~= nil then
local j = JSON.decode(data)
if j ~= nil and j.ml ~= nil then
for guid, entry in pairs(j.ml) do
memoryList[guid] = entry
end
end
end
end
end
function updateMemoryWithMoves()
memoryList = memoryListBackup
--get the first transposed object's coordinates
local obj = getObjectFromGUID(moveGuid)
-- p1 is where needs to go, p2 is where it was
local refObjPos = memoryList[moveGuid].pos
local deltaPos = findOffsetDistance(obj.getPosition(), refObjPos, nil)
local movedRotation = obj.getRotation()
for guid, entry in pairs(memoryList) do
memoryList[guid].pos.x = entry.pos.x - deltaPos.x
memoryList[guid].pos.y = entry.pos.y - deltaPos.y
memoryList[guid].pos.z = entry.pos.z - deltaPos.z
-- memoryList[guid].rot.x = movedRotation.x
-- memoryList[guid].rot.y = movedRotation.y
-- memoryList[guid].rot.z = movedRotation.z
end
--theList[obj.getGUID()] = {
-- pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
-- rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
-- lock=obj.getLock()
--}
moveList = {}
end
function onload(saved_data)
fresh = true
if saved_data ~= "" then
local loaded_data = JSON.decode(saved_data)
--Set up information off of loaded_data
@ -14,9 +60,13 @@ function onload(saved_data)
memoryList = {}
end
moveList = {}
moveGuid = nil
if next(memoryList) == nil then
createSetupButton()
else
fresh = false
createMemoryActionButtons()
end
end
@ -29,47 +79,85 @@ end
function createSetupButton()
self.createButton({
label="Setup", click_function="buttonClick_setup", function_owner=self,
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={0,0.1,-2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
end
--Triggered by Transpose button
function buttonClick_transpose()
moveGuid = nil
broadcastToAll("Select one object and move it- all objects will move relative to the new location", {0.75, 0.75, 1})
memoryListBackup = duplicateTable(memoryList)
memoryList = {}
moveList = {}
self.clearButtons()
createButtonsOnAllObjects(true)
createSetupActionButtons(true)
end
--Triggered by setup button,
function buttonClick_setup()
memoryListBackup = duplicateTable(memoryList)
memoryList = {}
self.clearButtons()
createButtonsOnAllObjects()
createSetupActionButtons()
createButtonsOnAllObjects(false)
createSetupActionButtons(false)
end
function getAllObjectsInMemory()
local objTable = {}
local curObj = {}
for guid in pairs(memoryListBackup) do
curObj = getObjectFromGUID(guid)
table.insert(objTable, curObj)
end
return objTable
-- return getAllObjects()
end
--Creates selection buttons on objects
function createButtonsOnAllObjects()
function createButtonsOnAllObjects(move)
local howManyButtons = 0
for _, obj in ipairs(getAllObjects()) do
local objsToHaveButtons = {}
if move == true then
objsToHaveButtons = getAllObjectsInMemory()
else
objsToHaveButtons = getAllObjects()
end
for _, obj in ipairs(objsToHaveButtons) do
if obj ~= self then
local dummyIndex = howManyButtons
--On a normal bag, the button positions aren't the same size as the bag.
globalScaleFactor = 1.25 * 1/self.getScale().x
globalScaleFactor = 1 * 1/self.getScale().x
--Super sweet math to set button positions
local selfPos = self.getPosition()
local objPos = obj.getPosition()
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
local objPos = rotateLocalCoordinates(deltaPos, self)
objPos.x = -objPos.x * globalScaleFactor
objPos.y = objPos.y * globalScaleFactor
objPos.z = objPos.z * globalScaleFactor
objPos.y = objPos.y * globalScaleFactor + 2
objPos.z = objPos.z * globalScaleFactor * 0.9
--Offset rotation of bag
local rot = self.getRotation()
rot.y = -rot.y + 180
--Create function
local funcName = "selectButton_" .. howManyButtons
local func = function() buttonClick_selection(dummyIndex, obj) end
local func = function() buttonClick_selection(dummyIndex, obj, move) end
local color = {0.75,0.25,0.25,0.6}
local colorMove = {0,0,1,0.6}
if move == true then
color = colorMove
end
self.setVar(funcName, func)
self.createButton({
click_function=funcName, function_owner=self,
position=objPos, rotation=rot, height=1000, width=1000,
color={0.75,0.25,0.25,0.6},
position=objPos, rotation=rot, height=500, width=500,
color=color,
})
howManyButtons = howManyButtons + 1
end
@ -77,21 +165,44 @@ function createButtonsOnAllObjects()
end
--Creates submit and cancel buttons
function createSetupActionButtons()
function createSetupActionButtons(move)
self.createButton({
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.1,-2.1}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
self.createButton({
label="Submit", click_function="buttonClick_submit", function_owner=self,
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.3,-2.5}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
if move == false then
self.createButton({
label="Add", click_function="buttonClick_add", function_owner=self,
position={0.6,0.3,-2.1}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={0.25,1,0.25}
})
if fresh == false then
self.createButton({
label="Set New", click_function="buttonClick_setNew", function_owner=self,
position={0.6,0.3,-2.9}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={0.75,0.75,1}
})
self.createButton({
label="Remove", click_function="buttonClick_remove", function_owner=self,
position={0.6,0.3,-2.5}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,0.25,0.25}
})
end
end
self.createButton({
label="Reset", click_function="buttonClick_reset", function_owner=self,
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.3,-2.9}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
end
@ -100,23 +211,43 @@ end
--Checks or unchecks buttons
function buttonClick_selection(index, obj)
function buttonClick_selection(index, obj, move)
local colorMove = {0,0,1,0.6}
local color = {0,1,0,0.6}
if memoryList[obj.getGUID()] == nil then
previousGuid = selectedGuid
selectedGuid = obj.getGUID()
theList = memoryList
if move == true then
theList = moveList
if previousGuid ~= nil and previousGuid ~= selectedGuid then
local prevObj = getObjectFromGUID(previousGuid)
prevObj.highlightOff()
self.editButton({index=previousIndex, color=colorMove})
theList[previousGuid] = nil
end
previousIndex = index
end
if theList[selectedGuid] == nil then
self.editButton({index=index, color=color})
--Adding pos/rot to memory table
local pos, rot = obj.getPosition(), obj.getRotation()
--I need to add it like this or it won't save due to indexing issue
memoryList[obj.getGUID()] = {
theList[obj.getGUID()] = {
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
lock=obj.getLock()
}
obj.highlightOn({0,1,0})
else
color = {0.75,0.25,0.25,0.6}
color = {0.75,0.25,0.25,0.6}
if move == true then
color = colorMove
end
self.editButton({index=index, color=color})
memoryList[obj.getGUID()] = nil
theList[obj.getGUID()] = nil
obj.highlightOff()
end
end
@ -124,6 +255,7 @@ end
--Cancels selection process
function buttonClick_cancel()
memoryList = memoryListBackup
moveList = {}
self.clearButtons()
if next(memoryList) == nil then
createSetupButton()
@ -132,28 +264,110 @@ function buttonClick_cancel()
end
removeAllHighlights()
broadcastToAll("Selection Canceled", {1,1,1})
moveGuid = nil
end
--Saves selections
function buttonClick_submit()
if next(memoryList) == nil then
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
else
fresh = false
if next(moveList) ~= nil then
for guid in pairs(moveList) do
moveGuid = guid
end
if memoryListBackup[moveGuid] == nil then
broadcastToAll("Item selected for moving is not already in memory", {1, 0.25, 0.25})
else
broadcastToAll("Moving all items in memory relative to new objects position!", {0.75, 0.75, 1})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(moveList) do
moveGuid = guid
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
updateMemoryWithMoves()
updateSave()
buttonClick_place()
end
elseif next(memoryList) == nil and moveGuid == nil then
memoryList = memoryListBackup
broadcastToAll("No selections made.", {0.75, 0.25, 0.25})
end
combineMemoryFromBagsWithin()
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
updateSave()
moveGuid = nil
end
function combineTables(first_table, second_table)
for k,v in pairs(second_table) do first_table[k] = v end
end
function buttonClick_add()
fresh = false
combineTables(memoryList, memoryListBackup)
broadcastToAll("Adding internal bags and selections to existing memory", {0.25, 0.75, 0.25})
combineMemoryFromBagsWithin()
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
updateSave()
end
function buttonClick_remove()
broadcastToAll("Removing Selected Entries From Memory", {1.0, 0.25, 0.25})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
memoryListBackup[guid] = nil
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
broadcastToAll(count.." Objects Removed", {1,1,1})
memoryList = memoryListBackup
updateSave()
end
function buttonClick_setNew()
broadcastToAll("Setting new position relative to items in memory", {0.75, 0.75, 1})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for _, obj in ipairs(getAllObjects()) do
guid = obj.guid
if memoryListBackup[guid] ~= nil then
count = count + 1
memoryListBackup[guid].pos = obj.getPosition()
memoryListBackup[guid].rot = obj.getRotation()
memoryListBackup[guid].lock = obj.getLock()
end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
memoryList = memoryListBackup
updateSave()
end
--Resets bag to starting status
function buttonClick_reset()
fresh = true
memoryList = {}
self.clearButtons()
createSetupButton()
@ -178,11 +392,16 @@ function createMemoryActionButtons()
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
-- self.createButton({
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
-- font_size=250, color={0,0,0}, font_color={1,1,1}
-- })
self.createButton({
label="Setup", click_function="buttonClick_setup", function_owner=self,
position={0,0.1,-2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
--- self.createButton({
--- label="Move", click_function="buttonClick_transpose", function_owner=self,
--- position={-2.8,0.3,0}, rotation={0,0,0}, height=350, width=800,
--- font_size=250, color={0,0,0}, font_color={0.75,0.75,1}
--- })
end
--Sends objects from bag/table to their saved position/rotation
@ -200,7 +419,7 @@ function buttonClick_place()
for _, bagObj in ipairs(bagObjList) do
if bagObj.guid == guid then
local item = self.takeObject({
guid=guid, position=entry.pos, rotation=entry.rot,
guid=guid, position=entry.pos, rotation=entry.rot, smooth=false
})
item.setLock(entry.lock)
break
@ -226,10 +445,14 @@ end
--Find delta (difference) between 2 x/y/z coordinates
function findOffsetDistance(p1, p2, obj)
local yOffset = 0
if obj ~= nil then
local bounds = obj.getBounds()
yOffset = (bounds.size.y - bounds.offset.y)
end
local deltaPos = {}
local bounds = obj.getBounds()
deltaPos.x = (p2.x-p1.x)
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
deltaPos.y = (p2.y-p1.y) + yOffset
deltaPos.z = (p2.z-p1.z)
return deltaPos
end
@ -244,6 +467,13 @@ function rotateLocalCoordinates(desiredPos, obj)
return {x=x, y=desiredPos.y, z=z}
end
function rotateMyCoordinates(desiredPos, obj)
local angle = math.rad(obj.getRotation().y)
local x = desiredPos.x * math.sin(angle)
local z = desiredPos.z * math.cos(angle)
return {x=x, y=desiredPos.y, z=z}
end
--Coroutine delay, in seconds
function wait(time)
local start = os.time()
@ -270,4 +500,4 @@ end
function round(num, dec)
local mult = 10^(dec or 0)
return math.floor(num * mult + 0.5) / mult
end
end

View File

@ -1,10 +1,56 @@
-- Utility memory bag by Directsun
-- Version 2.5.2
-- Fork of Memory Bag 2.0 by MrStump
function updateSave()
local data_to_save = {["ml"]=memoryList}
saved_data = JSON.encode(data_to_save)
self.script_state = saved_data
end
function combineMemoryFromBagsWithin()
local bagObjList = self.getObjects()
for _, bagObj in ipairs(bagObjList) do
local data = bagObj.lua_script_state
if data ~= nil then
local j = JSON.decode(data)
if j ~= nil and j.ml ~= nil then
for guid, entry in pairs(j.ml) do
memoryList[guid] = entry
end
end
end
end
end
function updateMemoryWithMoves()
memoryList = memoryListBackup
--get the first transposed object's coordinates
local obj = getObjectFromGUID(moveGuid)
-- p1 is where needs to go, p2 is where it was
local refObjPos = memoryList[moveGuid].pos
local deltaPos = findOffsetDistance(obj.getPosition(), refObjPos, nil)
local movedRotation = obj.getRotation()
for guid, entry in pairs(memoryList) do
memoryList[guid].pos.x = entry.pos.x - deltaPos.x
memoryList[guid].pos.y = entry.pos.y - deltaPos.y
memoryList[guid].pos.z = entry.pos.z - deltaPos.z
-- memoryList[guid].rot.x = movedRotation.x
-- memoryList[guid].rot.y = movedRotation.y
-- memoryList[guid].rot.z = movedRotation.z
end
--theList[obj.getGUID()] = {
-- pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
-- rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
-- lock=obj.getLock()
--}
moveList = {}
end
function onload(saved_data)
fresh = true
if saved_data ~= "" then
local loaded_data = JSON.decode(saved_data)
--Set up information off of loaded_data
@ -14,9 +60,13 @@ function onload(saved_data)
memoryList = {}
end
moveList = {}
moveGuid = nil
if next(memoryList) == nil then
createSetupButton()
else
fresh = false
createMemoryActionButtons()
end
end
@ -29,47 +79,85 @@ end
function createSetupButton()
self.createButton({
label="Setup", click_function="buttonClick_setup", function_owner=self,
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={0,0.1,-2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
end
--Triggered by Transpose button
function buttonClick_transpose()
moveGuid = nil
broadcastToAll("Select one object and move it- all objects will move relative to the new location", {0.75, 0.75, 1})
memoryListBackup = duplicateTable(memoryList)
memoryList = {}
moveList = {}
self.clearButtons()
createButtonsOnAllObjects(true)
createSetupActionButtons(true)
end
--Triggered by setup button,
function buttonClick_setup()
memoryListBackup = duplicateTable(memoryList)
memoryList = {}
self.clearButtons()
createButtonsOnAllObjects()
createSetupActionButtons()
createButtonsOnAllObjects(false)
createSetupActionButtons(false)
end
function getAllObjectsInMemory()
local objTable = {}
local curObj = {}
for guid in pairs(memoryListBackup) do
curObj = getObjectFromGUID(guid)
table.insert(objTable, curObj)
end
return objTable
-- return getAllObjects()
end
--Creates selection buttons on objects
function createButtonsOnAllObjects()
function createButtonsOnAllObjects(move)
local howManyButtons = 0
for _, obj in ipairs(getAllObjects()) do
local objsToHaveButtons = {}
if move == true then
objsToHaveButtons = getAllObjectsInMemory()
else
objsToHaveButtons = getAllObjects()
end
for _, obj in ipairs(objsToHaveButtons) do
if obj ~= self then
local dummyIndex = howManyButtons
--On a normal bag, the button positions aren't the same size as the bag.
globalScaleFactor = 1.25 * 1/self.getScale().x
globalScaleFactor = 1 * 1/self.getScale().x
--Super sweet math to set button positions
local selfPos = self.getPosition()
local objPos = obj.getPosition()
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
local objPos = rotateLocalCoordinates(deltaPos, self)
objPos.x = -objPos.x * globalScaleFactor
objPos.y = objPos.y * globalScaleFactor
objPos.z = objPos.z * globalScaleFactor
objPos.y = objPos.y * globalScaleFactor + 2
objPos.z = objPos.z * globalScaleFactor * 0.9
--Offset rotation of bag
local rot = self.getRotation()
rot.y = -rot.y + 180
--Create function
local funcName = "selectButton_" .. howManyButtons
local func = function() buttonClick_selection(dummyIndex, obj) end
local func = function() buttonClick_selection(dummyIndex, obj, move) end
local color = {0.75,0.25,0.25,0.6}
local colorMove = {0,0,1,0.6}
if move == true then
color = colorMove
end
self.setVar(funcName, func)
self.createButton({
click_function=funcName, function_owner=self,
position=objPos, rotation=rot, height=1000, width=1000,
color={0.75,0.25,0.25,0.6},
position=objPos, rotation=rot, height=500, width=500,
color=color,
})
howManyButtons = howManyButtons + 1
end
@ -77,21 +165,44 @@ function createButtonsOnAllObjects()
end
--Creates submit and cancel buttons
function createSetupActionButtons()
function createSetupActionButtons(move)
self.createButton({
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.1,-2.1}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
self.createButton({
label="Submit", click_function="buttonClick_submit", function_owner=self,
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.3,-2.5}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
if move == false then
self.createButton({
label="Add", click_function="buttonClick_add", function_owner=self,
position={0.6,0.3,-2.1}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={0.25,1,0.25}
})
if fresh == false then
self.createButton({
label="Set New", click_function="buttonClick_setNew", function_owner=self,
position={0.6,0.3,-2.9}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={0.75,0.75,1}
})
self.createButton({
label="Remove", click_function="buttonClick_remove", function_owner=self,
position={0.6,0.3,-2.5}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,0.25,0.25}
})
end
end
self.createButton({
label="Reset", click_function="buttonClick_reset", function_owner=self,
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.3,-2.9}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
end
@ -100,23 +211,43 @@ end
--Checks or unchecks buttons
function buttonClick_selection(index, obj)
function buttonClick_selection(index, obj, move)
local colorMove = {0,0,1,0.6}
local color = {0,1,0,0.6}
if memoryList[obj.getGUID()] == nil then
previousGuid = selectedGuid
selectedGuid = obj.getGUID()
theList = memoryList
if move == true then
theList = moveList
if previousGuid ~= nil and previousGuid ~= selectedGuid then
local prevObj = getObjectFromGUID(previousGuid)
prevObj.highlightOff()
self.editButton({index=previousIndex, color=colorMove})
theList[previousGuid] = nil
end
previousIndex = index
end
if theList[selectedGuid] == nil then
self.editButton({index=index, color=color})
--Adding pos/rot to memory table
local pos, rot = obj.getPosition(), obj.getRotation()
--I need to add it like this or it won't save due to indexing issue
memoryList[obj.getGUID()] = {
theList[obj.getGUID()] = {
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
lock=obj.getLock()
}
obj.highlightOn({0,1,0})
else
color = {0.75,0.25,0.25,0.6}
color = {0.75,0.25,0.25,0.6}
if move == true then
color = colorMove
end
self.editButton({index=index, color=color})
memoryList[obj.getGUID()] = nil
theList[obj.getGUID()] = nil
obj.highlightOff()
end
end
@ -124,6 +255,7 @@ end
--Cancels selection process
function buttonClick_cancel()
memoryList = memoryListBackup
moveList = {}
self.clearButtons()
if next(memoryList) == nil then
createSetupButton()
@ -132,28 +264,110 @@ function buttonClick_cancel()
end
removeAllHighlights()
broadcastToAll("Selection Canceled", {1,1,1})
moveGuid = nil
end
--Saves selections
function buttonClick_submit()
if next(memoryList) == nil then
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
else
fresh = false
if next(moveList) ~= nil then
for guid in pairs(moveList) do
moveGuid = guid
end
if memoryListBackup[moveGuid] == nil then
broadcastToAll("Item selected for moving is not already in memory", {1, 0.25, 0.25})
else
broadcastToAll("Moving all items in memory relative to new objects position!", {0.75, 0.75, 1})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(moveList) do
moveGuid = guid
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
updateMemoryWithMoves()
updateSave()
buttonClick_place()
end
elseif next(memoryList) == nil and moveGuid == nil then
memoryList = memoryListBackup
broadcastToAll("No selections made.", {0.75, 0.25, 0.25})
end
combineMemoryFromBagsWithin()
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
updateSave()
moveGuid = nil
end
function combineTables(first_table, second_table)
for k,v in pairs(second_table) do first_table[k] = v end
end
function buttonClick_add()
fresh = false
combineTables(memoryList, memoryListBackup)
broadcastToAll("Adding internal bags and selections to existing memory", {0.25, 0.75, 0.25})
combineMemoryFromBagsWithin()
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
updateSave()
end
function buttonClick_remove()
broadcastToAll("Removing Selected Entries From Memory", {1.0, 0.25, 0.25})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
memoryListBackup[guid] = nil
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
broadcastToAll(count.." Objects Removed", {1,1,1})
memoryList = memoryListBackup
updateSave()
end
function buttonClick_setNew()
broadcastToAll("Setting new position relative to items in memory", {0.75, 0.75, 1})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for _, obj in ipairs(getAllObjects()) do
guid = obj.guid
if memoryListBackup[guid] ~= nil then
count = count + 1
memoryListBackup[guid].pos = obj.getPosition()
memoryListBackup[guid].rot = obj.getRotation()
memoryListBackup[guid].lock = obj.getLock()
end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
memoryList = memoryListBackup
updateSave()
end
--Resets bag to starting status
function buttonClick_reset()
fresh = true
memoryList = {}
self.clearButtons()
createSetupButton()
@ -178,11 +392,16 @@ function createMemoryActionButtons()
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
-- self.createButton({
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
-- font_size=250, color={0,0,0}, font_color={1,1,1}
-- })
self.createButton({
label="Setup", click_function="buttonClick_setup", function_owner=self,
position={0,0.1,-2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
--- self.createButton({
--- label="Move", click_function="buttonClick_transpose", function_owner=self,
--- position={-2.8,0.3,0}, rotation={0,0,0}, height=350, width=800,
--- font_size=250, color={0,0,0}, font_color={0.75,0.75,1}
--- })
end
--Sends objects from bag/table to their saved position/rotation
@ -200,7 +419,7 @@ function buttonClick_place()
for _, bagObj in ipairs(bagObjList) do
if bagObj.guid == guid then
local item = self.takeObject({
guid=guid, position=entry.pos, rotation=entry.rot,
guid=guid, position=entry.pos, rotation=entry.rot, smooth=false
})
item.setLock(entry.lock)
break
@ -226,10 +445,14 @@ end
--Find delta (difference) between 2 x/y/z coordinates
function findOffsetDistance(p1, p2, obj)
local yOffset = 0
if obj ~= nil then
local bounds = obj.getBounds()
yOffset = (bounds.size.y - bounds.offset.y)
end
local deltaPos = {}
local bounds = obj.getBounds()
deltaPos.x = (p2.x-p1.x)
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
deltaPos.y = (p2.y-p1.y) + yOffset
deltaPos.z = (p2.z-p1.z)
return deltaPos
end
@ -244,6 +467,13 @@ function rotateLocalCoordinates(desiredPos, obj)
return {x=x, y=desiredPos.y, z=z}
end
function rotateMyCoordinates(desiredPos, obj)
local angle = math.rad(obj.getRotation().y)
local x = desiredPos.x * math.sin(angle)
local z = desiredPos.z * math.cos(angle)
return {x=x, y=desiredPos.y, z=z}
end
--Coroutine delay, in seconds
function wait(time)
local start = os.time()
@ -270,4 +500,4 @@ end
function round(num, dec)
local mult = 10^(dec or 0)
return math.floor(num * mult + 0.5) / mult
end
end

View File

@ -21,6 +21,8 @@ ColorDiffuse:
g: 1.0
r: 1.0
ContainedObjects:
- !include 'Custom_Model_Bag 2 The Midnight Masks c38c96/Custom_Tile Midnight Masks
Helper b3f79e.yaml'
- !include 'Custom_Model_Bag 2 The Midnight Masks c38c96/Card Southside 076b61.yaml'
- !include 'Custom_Model_Bag 2 The Midnight Masks c38c96/Card Southside 19e7d8.yaml'
- !include 'Custom_Model_Bag 2 The Midnight Masks c38c96/Card Downtown 1aa7cb.yaml'
@ -82,7 +84,7 @@ IgnoreFoW: false
LayoutGroupSortIndex: 0
Locked: false
LuaScript: !include 'Custom_Model_Bag 2 The Midnight Masks c38c96.ttslua'
LuaScriptState: '{"ml":{"076b61":{"lock":false,"pos":{"x":-31.9633,"y":1.8288,"z":0.0339},"rot":{"x":4.7395,"y":270.0055,"z":0.0075}},"19e7d8":{"lock":false,"pos":{"x":-30.2242,"y":1.6954,"z":-0.03},"rot":{"x":359.9205,"y":270.0006,"z":0.0176}},"1aa7cb":{"lock":false,"pos":{"x":-17.1199,"y":1.6771,"z":-0.0298},"rot":{"x":359.9201,"y":270.0016,"z":0.0168}},"23b896":{"lock":false,"pos":{"x":-23.6766,"y":1.6885,"z":7.57},"rot":{"x":359.9201,"y":269.9991,"z":0.0169}},"28e161":{"lock":false,"pos":{"x":-3.9275,"y":1.7237,"z":5.757},"rot":{"x":359.9197,"y":269.9996,"z":180.0168}},"377b20":{"lock":false,"pos":{"x":-30.2243,"y":1.6931,"z":-7.7},"rot":{"x":359.9201,"y":269.9993,"z":0.0169}},"50a9d7":{"lock":false,"pos":{"x":-20.4665,"y":1.6122,"z":7.3646},"rot":{"x":0.0799,"y":90.0003,"z":359.9831}},"5f4d79":{"lock":false,"pos":{"x":-21.121,"y":1.61,"z":-3.2557},"rot":{"x":0.0684,"y":135.0004,"z":0.0446}},"692e5f":{"lock":false,"pos":{"x":-17.1201,"y":1.6748,"z":-7.7},"rot":{"x":359.9201,"y":269.9981,"z":0.0169}},"6a2978":{"lock":false,"pos":{"x":-23.6765,"y":1.6134,"z":-3.83},"rot":{"x":0.0169,"y":179.9998,"z":0.0799}},"7234af":{"lock":false,"pos":{"x":-17.12,"y":1.6042,"z":-3.83},"rot":{"x":0.0169,"y":179.9995,"z":0.08}},"75ffdc":{"lock":false,"pos":{"x":-26.9897,"y":1.6181,"z":-3.5596},"rot":{"x":0.0253,"y":30.0002,"z":359.9224}},"775f4f":{"lock":false,"pos":{"x":-26.9925,"y":1.6213,"z":7.2863},"rot":{"x":0.0799,"y":89.9998,"z":359.9831}},"8112ff":{"lock":false,"pos":{"x":-3.692,"y":1.5822,"z":-14.9167},"rot":{"x":359.9197,"y":270.0211,"z":0.0168}},"83358c":{"lock":false,"pos":{"x":-27.0804,"y":1.6203,"z":3.49},"rot":{"x":359.9554,"y":224.9999,"z":0.0684}},"a22908":{"lock":false,"pos":{"x":-3.9558,"y":1.6556,"z":-10.4412},"rot":{"x":359.9197,"y":270.0002,"z":0.0168}},"af8db2":{"lock":false,"pos":{"x":-23.6763,"y":1.6862,"z":-0.0278},"rot":{"x":359.9201,"y":269.9992,"z":0.0169}},"b5b8db":{"lock":false,"pos":{"x":-15.6844,"y":1.7271,"z":-0.0291},"rot":{"x":0.0879,"y":269.9867,"z":359.877}},"c6f13f":{"lock":false,"pos":{"x":-2.7246,"y":1.664,"z":0.3734},"rot":{"x":0.0168,"y":180.0051,"z":0.0803}},"d2ad6e":{"lock":false,"pos":{"x":-17.12,"y":1.6793,"z":7.57},"rot":{"x":359.9201,"y":269.9966,"z":0.0169}},"d716a1":{"lock":false,"pos":{"x":-27.2073,"y":1.6194,"z":-0.1216},"rot":{"x":0.0799,"y":89.9999,"z":359.9831}},"d85d68":{"lock":false,"pos":{"x":-23.6765,"y":1.6157,"z":3.86},"rot":{"x":0.0169,"y":179.9995,"z":0.0799}},"d9c370":{"lock":false,"pos":{"x":-30.2242,"y":1.6248,"z":3.86},"rot":{"x":0.0169,"y":179.9996,"z":0.0799}},"e1b8fc":{"lock":false,"pos":{"x":-23.6766,"y":1.684,"z":-7.7},"rot":{"x":359.9201,"y":269.9992,"z":0.0169}},"e1f778":{"lock":false,"pos":{"x":-17.1199,"y":1.6065,"z":3.86},"rot":{"x":0.0169,"y":179.9996,"z":0.0799}},"e4821e":{"lock":false,"pos":{"x":1.696,"y":1.5583,"z":14.2788},"rot":{"x":359.9551,"y":224.998,"z":0.0687}},"f859a4":{"lock":false,"pos":{"x":-2.6884,"y":1.6555,"z":-5.0485},"rot":{"x":0.0168,"y":179.9984,"z":0.0803}},"fac63b":{"lock":false,"pos":{"x":-30.2243,"y":1.6976,"z":7.57},"rot":{"x":359.9201,"y":269.9993,"z":0.0169}}}}'
LuaScriptState: '{"ml":{"076b61":{"lock":false,"pos":{"x":-31.9575824737549,"y":1.66336166858673,"z":0.0345288477838039},"rot":{"x":0.801109313964844,"y":269.987915039063,"z":0.00707567343488336}},"19e7d8":{"lock":false,"pos":{"x":-30.2242164611816,"y":1.63722372055054,"z":-0.0299990326166153},"rot":{"x":359.920562744141,"y":270.000518798828,"z":0.0176045913249254}},"1aa7cb":{"lock":false,"pos":{"x":-17.1199169158936,"y":1.61892199516296,"z":-0.0297970715910196},"rot":{"x":359.920135498047,"y":270.001556396484,"z":0.0167074911296368}},"23b896":{"lock":false,"pos":{"x":-23.6766166687012,"y":1.63030028343201,"z":7.57000207901001},"rot":{"x":359.920104980469,"y":269.999084472656,"z":0.0168416313827038}},"28e161":{"lock":false,"pos":{"x":-3.92750549316406,"y":1.71067988872528,"z":5.75700187683105},"rot":{"x":359.919738769531,"y":269.999603271484,"z":180.016815185547}},"377b20":{"lock":false,"pos":{"x":-30.2243175506592,"y":1.63494288921356,"z":-7.69999742507935},"rot":{"x":359.920104980469,"y":269.999267578125,"z":0.0168412197381258}},"50a9d7":{"lock":false,"pos":{"x":-20.4664993286133,"y":1.61215877532959,"z":7.36460018157959},"rot":{"x":0.0798943638801575,"y":90.0003051757813,"z":359.983123779297}},"5f4d79":{"lock":false,"pos":{"x":-21.121000289917,"y":1.60995018482208,"z":-3.25570034980774},"rot":{"x":0.06840780377388,"y":135.000396728516,"z":0.0445858277380466}},"692e5f":{"lock":false,"pos":{"x":-17.1201171875,"y":1.61667001247406,"z":-7.69999647140503},"rot":{"x":359.920104980469,"y":269.998077392578,"z":0.0168429240584373}},"6a2978":{"lock":false,"pos":{"x":-23.6765003204346,"y":1.61334490776062,"z":-3.82999992370605},"rot":{"x":0.0168396029621363,"y":179.999755859375,"z":0.0799403935670853}},"7234af":{"lock":false,"pos":{"x":-17.1199989318848,"y":1.60420215129852,"z":-3.82999968528748},"rot":{"x":0.0168400723487139,"y":179.999450683594,"z":0.0799458548426628}},"75ffdc":{"lock":false,"pos":{"x":-26.9897003173828,"y":1.61804449558258,"z":-3.55959987640381},"rot":{"x":0.0253676623106003,"y":30.0002193450928,"z":359.922393798828}},"775f4f":{"lock":false,"pos":{"x":-26.9925003051758,"y":1.62123584747314,"z":7.28630018234253},"rot":{"x":0.0798941627144814,"y":89.9998092651367,"z":359.983123779297}},"8112ff":{"lock":false,"pos":{"x":-3.6920006275177,"y":1.58224987983704,"z":-14.9167041778564},"rot":{"x":359.919738769531,"y":270.021057128906,"z":0.0168084446340799}},"83358c":{"lock":false,"pos":{"x":-27.0804004669189,"y":1.62024259567261,"z":3.49000072479248},"rot":{"x":359.955413818359,"y":224.999893188477,"z":0.0683783441781998}},"a22908":{"lock":false,"pos":{"x":-3.95581722259521,"y":1.59753918647766,"z":-10.4411993026733},"rot":{"x":359.919738769531,"y":270.000183105469,"z":0.0168378315865994}},"af8db2":{"lock":false,"pos":{"x":-23.6763172149658,"y":1.62806689739227,"z":-0.0277968645095825},"rot":{"x":359.920104980469,"y":269.999206542969,"z":0.0168413165956736}},"b3f79e":{"lock":false,"pos":{"x":-11.8946933746338,"y":1.59565806388855,"z":-8.11061096191406},"rot":{"x":359.920104980469,"y":270.00048828125,"z":0.0168422311544418}},"b5b8db":{"lock":false,"pos":{"x":-15.6844148635864,"y":1.66888844966888,"z":-0.0290974024683237},"rot":{"x":0.0791712552309036,"y":269.986694335938,"z":359.983001708984}},"c6f13f":{"lock":false,"pos":{"x":-2.72462439537048,"y":1.6159462928772,"z":0.373405307531357},"rot":{"x":0.0168283060193062,"y":180.005096435547,"z":0.0802579522132874}},"d2ad6e":{"lock":false,"pos":{"x":-17.1200180053711,"y":1.62115752696991,"z":7.57000350952148},"rot":{"x":359.920104980469,"y":269.99658203125,"z":0.0168450437486172}},"d716a1":{"lock":false,"pos":{"x":-27.2073001861572,"y":1.61935830116272,"z":-0.121600218117237},"rot":{"x":0.0798944160342216,"y":89.9999084472656,"z":359.983123779297}},"d85d68":{"lock":false,"pos":{"x":-23.6765003204346,"y":1.61560475826263,"z":3.8600001335144},"rot":{"x":0.0168399680405855,"y":179.999450683594,"z":0.0799410417675972}},"d9c370":{"lock":false,"pos":{"x":-30.2241992950439,"y":1.62473499774933,"z":3.86000037193298},"rot":{"x":0.0168398097157478,"y":179.999588012695,"z":0.0799403339624405}},"e1b8fc":{"lock":false,"pos":{"x":-23.6766166687012,"y":1.62581253051758,"z":-7.69999647140503},"rot":{"x":359.920104980469,"y":269.999206542969,"z":0.0168413668870926}},"e1f778":{"lock":false,"pos":{"x":-17.1198997497559,"y":1.60646188259125,"z":3.86000037193298},"rot":{"x":0.0168397314846516,"y":179.999618530273,"z":0.0799399092793465}},"e4821e":{"lock":false,"pos":{"x":1.69600057601929,"y":1.55831730365753,"z":14.2788019180298},"rot":{"x":359.955139160156,"y":224.998016357422,"z":0.0686723738908768}},"f859a4":{"lock":false,"pos":{"x":-2.68841671943665,"y":1.59734857082367,"z":-5.04849672317505},"rot":{"x":0.0168380346149206,"y":179.998397827148,"z":0.0802551358938217}},"fac63b":{"lock":false,"pos":{"x":-30.2243175506592,"y":1.63943064212799,"z":7.57000398635864},"rot":{"x":359.920104980469,"y":269.999267578125,"z":0.016841247677803}}}}'
MaterialIndex: -1
MeasureMovement: false
MeshIndex: -1
@ -96,7 +98,7 @@ Transform:
posY: 1.46
posZ: -0.06
rotX: 359.92
rotY: 270.01
rotY: 270.03
rotZ: 0.02
scaleX: 2.21
scaleY: 0.46

View File

@ -0,0 +1,75 @@
LOCATIONS = {
{
name = "Downtown",
guids = { "1aa7cb", "b5b8db" },
position = Vector({-17.12, 1.62, -0.03})
},
{
name = "Southside",
guids = { "076b61", "19e7d8" },
position = Vector({-30.22, 1.64, -0.03})
}
}
ACOLYTE_SPAWNS = {
{-33.72, 1.64, -0.02}, {-13.78, 1.61, 0.01}, {-23.79, 1.63, -10.13}
}
ENCOUNTER_DECK_GUID = "28e161"
SET_ASIDE = {
position = Vector({-5.75, 1.54, 19.25}),
rotation = { x=0, y=270, z=0 }
}
function onLoad()
self.createButton({
label="Set Up",
click_function="setup",
function_owner=self,
position={0,0.1,-00},
height=120,
width=500,
scale={x=1.75, y=1.75, z=1.75},
font_size=80
})
COUNTER = getObjectFromGUID('f182ee')
math.randomseed(os.time())
end
function setup(_obj, _color, alt_click)
if SETUP_DONE then return end
SETUP_DONE = true
for i,loc in ipairs(LOCATIONS) do
local chosen = math.random(2)
local guid = loc.guids[chosen]
local card = getObjectFromGUID(loc.guids[3 - chosen])
card.setPosition(SET_ASIDE.position)
card.setRotation({0, 270, 0})
card = getObjectFromGUID(guid)
card.setPosition(loc.position)
card.setRotation({0, 270, 0})
end
local numPlayers = COUNTER.getVar('val')
if numPlayers > 1 then
local deck = getObjectFromGUID(ENCOUNTER_DECK_GUID)
local objs = deck.getObjects()
local indexes = {}
for i,card in ipairs(objs) do
if card.name == "Acolyte" then
table.insert(indexes, card.index)
end
end
for i=numPlayers-1,1,-1 do
deck.takeObject({
index = indexes[i],
position = ACOLYTE_SPAWNS[i],
rotation = {0, 270, 0},
smooth = false
})
Global.call("spawnToken", { Vector(ACOLYTE_SPAWNS[i]) + Vector({ 0, 1, 0}), "doom" })
end
end
end

View File

@ -0,0 +1,45 @@
Autoraise: true
ColorDiffuse:
b: 1.0
g: 1.0
r: 1.0
CustomImage:
CustomTile:
Stackable: false
Stretch: true
Thickness: 0.1
Type: 0
ImageScalar: 1.0
ImageSecondaryURL: http://cloud-3.steamusercontent.com/ugc/1759191866095195329/4B148B442FF84529F59EAE88F91BFBCAF215871A/
ImageURL: http://cloud-3.steamusercontent.com/ugc/1759191866095195329/4B148B442FF84529F59EAE88F91BFBCAF215871A/
WidthScale: 0.0
Description: Randomizes locations and spawns cultists.
DragSelectable: true
GMNotes: ''
GUID: b3f79e
Grid: true
GridProjection: false
Hands: false
HideWhenFaceDown: false
IgnoreFoW: false
LayoutGroupSortIndex: 0
Locked: false
LuaScript: !include 'Custom_Tile Midnight Masks Helper b3f79e.ttslua'
LuaScriptState: ''
MeasureMovement: false
Name: Custom_Tile
Nickname: Midnight Masks Helper
Snap: true
Sticky: true
Tooltip: true
Transform:
posX: -11.89
posY: 1.6
posZ: -8.11
rotX: 359.92
rotY: 270.0
rotZ: 0.02
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
XmlUI: ''

View File

@ -1,10 +1,56 @@
-- Utility memory bag by Directsun
-- Version 2.5.2
-- Fork of Memory Bag 2.0 by MrStump
function updateSave()
local data_to_save = {["ml"]=memoryList}
saved_data = JSON.encode(data_to_save)
self.script_state = saved_data
end
function combineMemoryFromBagsWithin()
local bagObjList = self.getObjects()
for _, bagObj in ipairs(bagObjList) do
local data = bagObj.lua_script_state
if data ~= nil then
local j = JSON.decode(data)
if j ~= nil and j.ml ~= nil then
for guid, entry in pairs(j.ml) do
memoryList[guid] = entry
end
end
end
end
end
function updateMemoryWithMoves()
memoryList = memoryListBackup
--get the first transposed object's coordinates
local obj = getObjectFromGUID(moveGuid)
-- p1 is where needs to go, p2 is where it was
local refObjPos = memoryList[moveGuid].pos
local deltaPos = findOffsetDistance(obj.getPosition(), refObjPos, nil)
local movedRotation = obj.getRotation()
for guid, entry in pairs(memoryList) do
memoryList[guid].pos.x = entry.pos.x - deltaPos.x
memoryList[guid].pos.y = entry.pos.y - deltaPos.y
memoryList[guid].pos.z = entry.pos.z - deltaPos.z
-- memoryList[guid].rot.x = movedRotation.x
-- memoryList[guid].rot.y = movedRotation.y
-- memoryList[guid].rot.z = movedRotation.z
end
--theList[obj.getGUID()] = {
-- pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
-- rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
-- lock=obj.getLock()
--}
moveList = {}
end
function onload(saved_data)
fresh = true
if saved_data ~= "" then
local loaded_data = JSON.decode(saved_data)
--Set up information off of loaded_data
@ -14,9 +60,13 @@ function onload(saved_data)
memoryList = {}
end
moveList = {}
moveGuid = nil
if next(memoryList) == nil then
createSetupButton()
else
fresh = false
createMemoryActionButtons()
end
end
@ -29,47 +79,85 @@ end
function createSetupButton()
self.createButton({
label="Setup", click_function="buttonClick_setup", function_owner=self,
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=800,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={0,0.1,-2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
end
--Triggered by Transpose button
function buttonClick_transpose()
moveGuid = nil
broadcastToAll("Select one object and move it- all objects will move relative to the new location", {0.75, 0.75, 1})
memoryListBackup = duplicateTable(memoryList)
memoryList = {}
moveList = {}
self.clearButtons()
createButtonsOnAllObjects(true)
createSetupActionButtons(true)
end
--Triggered by setup button,
function buttonClick_setup()
memoryListBackup = duplicateTable(memoryList)
memoryList = {}
self.clearButtons()
createButtonsOnAllObjects()
createSetupActionButtons()
createButtonsOnAllObjects(false)
createSetupActionButtons(false)
end
function getAllObjectsInMemory()
local objTable = {}
local curObj = {}
for guid in pairs(memoryListBackup) do
curObj = getObjectFromGUID(guid)
table.insert(objTable, curObj)
end
return objTable
-- return getAllObjects()
end
--Creates selection buttons on objects
function createButtonsOnAllObjects()
function createButtonsOnAllObjects(move)
local howManyButtons = 0
for _, obj in ipairs(getAllObjects()) do
local objsToHaveButtons = {}
if move == true then
objsToHaveButtons = getAllObjectsInMemory()
else
objsToHaveButtons = getAllObjects()
end
for _, obj in ipairs(objsToHaveButtons) do
if obj ~= self then
local dummyIndex = howManyButtons
--On a normal bag, the button positions aren't the same size as the bag.
globalScaleFactor = 1.25 * 1/self.getScale().x
globalScaleFactor = 1 * 1/self.getScale().x
--Super sweet math to set button positions
local selfPos = self.getPosition()
local objPos = obj.getPosition()
local deltaPos = findOffsetDistance(selfPos, objPos, obj)
local objPos = rotateLocalCoordinates(deltaPos, self)
objPos.x = -objPos.x * globalScaleFactor
objPos.y = objPos.y * globalScaleFactor
objPos.z = objPos.z * globalScaleFactor
objPos.y = objPos.y * globalScaleFactor + 2
objPos.z = objPos.z * globalScaleFactor * 0.9
--Offset rotation of bag
local rot = self.getRotation()
rot.y = -rot.y + 180
--Create function
local funcName = "selectButton_" .. howManyButtons
local func = function() buttonClick_selection(dummyIndex, obj) end
local func = function() buttonClick_selection(dummyIndex, obj, move) end
local color = {0.75,0.25,0.25,0.6}
local colorMove = {0,0,1,0.6}
if move == true then
color = colorMove
end
self.setVar(funcName, func)
self.createButton({
click_function=funcName, function_owner=self,
position=objPos, rotation=rot, height=1000, width=1000,
color={0.75,0.25,0.25,0.6},
position=objPos, rotation=rot, height=500, width=500,
color=color,
})
howManyButtons = howManyButtons + 1
end
@ -77,21 +165,44 @@ function createButtonsOnAllObjects()
end
--Creates submit and cancel buttons
function createSetupActionButtons()
function createSetupActionButtons(move)
self.createButton({
label="Cancel", click_function="buttonClick_cancel", function_owner=self,
position={0,0.3,-2}, rotation={0,180,0}, height=350, width=1100,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.1,-2.1}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
self.createButton({
label="Submit", click_function="buttonClick_submit", function_owner=self,
position={0,0.3,-2.8}, rotation={0,180,0}, height=350, width=1100,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.3,-2.5}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
if move == false then
self.createButton({
label="Add", click_function="buttonClick_add", function_owner=self,
position={0.6,0.3,-2.1}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={0.25,1,0.25}
})
if fresh == false then
self.createButton({
label="Set New", click_function="buttonClick_setNew", function_owner=self,
position={0.6,0.3,-2.9}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={0.75,0.75,1}
})
self.createButton({
label="Remove", click_function="buttonClick_remove", function_owner=self,
position={0.6,0.3,-2.5}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,0.25,0.25}
})
end
end
self.createButton({
label="Reset", click_function="buttonClick_reset", function_owner=self,
position={-2,0.3,0}, rotation={0,270,0}, height=350, width=800,
font_size=250, color={0,0,0}, font_color={1,1,1}
position={-0.6,0.3,-2.9}, rotation={0,0,0}, height=220, width=550,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
end
@ -100,23 +211,43 @@ end
--Checks or unchecks buttons
function buttonClick_selection(index, obj)
function buttonClick_selection(index, obj, move)
local colorMove = {0,0,1,0.6}
local color = {0,1,0,0.6}
if memoryList[obj.getGUID()] == nil then
previousGuid = selectedGuid
selectedGuid = obj.getGUID()
theList = memoryList
if move == true then
theList = moveList
if previousGuid ~= nil and previousGuid ~= selectedGuid then
local prevObj = getObjectFromGUID(previousGuid)
prevObj.highlightOff()
self.editButton({index=previousIndex, color=colorMove})
theList[previousGuid] = nil
end
previousIndex = index
end
if theList[selectedGuid] == nil then
self.editButton({index=index, color=color})
--Adding pos/rot to memory table
local pos, rot = obj.getPosition(), obj.getRotation()
--I need to add it like this or it won't save due to indexing issue
memoryList[obj.getGUID()] = {
theList[obj.getGUID()] = {
pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},
rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},
lock=obj.getLock()
}
obj.highlightOn({0,1,0})
else
color = {0.75,0.25,0.25,0.6}
color = {0.75,0.25,0.25,0.6}
if move == true then
color = colorMove
end
self.editButton({index=index, color=color})
memoryList[obj.getGUID()] = nil
theList[obj.getGUID()] = nil
obj.highlightOff()
end
end
@ -124,6 +255,7 @@ end
--Cancels selection process
function buttonClick_cancel()
memoryList = memoryListBackup
moveList = {}
self.clearButtons()
if next(memoryList) == nil then
createSetupButton()
@ -132,28 +264,110 @@ function buttonClick_cancel()
end
removeAllHighlights()
broadcastToAll("Selection Canceled", {1,1,1})
moveGuid = nil
end
--Saves selections
function buttonClick_submit()
if next(memoryList) == nil then
broadcastToAll("You cannot submit without any selections.", {0.75, 0.25, 0.25})
else
fresh = false
if next(moveList) ~= nil then
for guid in pairs(moveList) do
moveGuid = guid
end
if memoryListBackup[moveGuid] == nil then
broadcastToAll("Item selected for moving is not already in memory", {1, 0.25, 0.25})
else
broadcastToAll("Moving all items in memory relative to new objects position!", {0.75, 0.75, 1})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(moveList) do
moveGuid = guid
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
updateMemoryWithMoves()
updateSave()
buttonClick_place()
end
elseif next(memoryList) == nil and moveGuid == nil then
memoryList = memoryListBackup
broadcastToAll("No selections made.", {0.75, 0.25, 0.25})
end
combineMemoryFromBagsWithin()
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
updateSave()
moveGuid = nil
end
function combineTables(first_table, second_table)
for k,v in pairs(second_table) do first_table[k] = v end
end
function buttonClick_add()
fresh = false
combineTables(memoryList, memoryListBackup)
broadcastToAll("Adding internal bags and selections to existing memory", {0.25, 0.75, 0.25})
combineMemoryFromBagsWithin()
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
updateSave()
end
function buttonClick_remove()
broadcastToAll("Removing Selected Entries From Memory", {1.0, 0.25, 0.25})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for guid in pairs(memoryList) do
count = count + 1
memoryListBackup[guid] = nil
local obj = getObjectFromGUID(guid)
if obj ~= nil then obj.highlightOff() end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
broadcastToAll(count.." Objects Removed", {1,1,1})
memoryList = memoryListBackup
updateSave()
end
function buttonClick_setNew()
broadcastToAll("Setting new position relative to items in memory", {0.75, 0.75, 1})
self.clearButtons()
createMemoryActionButtons()
local count = 0
for _, obj in ipairs(getAllObjects()) do
guid = obj.guid
if memoryListBackup[guid] ~= nil then
count = count + 1
memoryListBackup[guid].pos = obj.getPosition()
memoryListBackup[guid].rot = obj.getRotation()
memoryListBackup[guid].lock = obj.getLock()
end
end
broadcastToAll(count.." Objects Saved", {1,1,1})
memoryList = memoryListBackup
updateSave()
end
--Resets bag to starting status
function buttonClick_reset()
fresh = true
memoryList = {}
self.clearButtons()
createSetupButton()
@ -178,11 +392,16 @@ function createMemoryActionButtons()
position={-0.6,0.1,2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
-- self.createButton({
-- label="Setup", click_function="buttonClick_setup", function_owner=self,
-- position={2,0.3,0}, rotation={0,90,0}, height=350, width=800,
-- font_size=250, color={0,0,0}, font_color={1,1,1}
-- })
self.createButton({
label="Setup", click_function="buttonClick_setup", function_owner=self,
position={0,0.1,-2.1}, rotation={0,0,0}, height=220, width=500,
font_size=130, color={0,0,0}, font_color={1,1,1}
})
--- self.createButton({
--- label="Move", click_function="buttonClick_transpose", function_owner=self,
--- position={-2.8,0.3,0}, rotation={0,0,0}, height=350, width=800,
--- font_size=250, color={0,0,0}, font_color={0.75,0.75,1}
--- })
end
--Sends objects from bag/table to their saved position/rotation
@ -200,7 +419,7 @@ function buttonClick_place()
for _, bagObj in ipairs(bagObjList) do
if bagObj.guid == guid then
local item = self.takeObject({
guid=guid, position=entry.pos, rotation=entry.rot,
guid=guid, position=entry.pos, rotation=entry.rot, smooth=false
})
item.setLock(entry.lock)
break
@ -226,10 +445,14 @@ end
--Find delta (difference) between 2 x/y/z coordinates
function findOffsetDistance(p1, p2, obj)
local yOffset = 0
if obj ~= nil then
local bounds = obj.getBounds()
yOffset = (bounds.size.y - bounds.offset.y)
end
local deltaPos = {}
local bounds = obj.getBounds()
deltaPos.x = (p2.x-p1.x)
deltaPos.y = (p2.y-p1.y) + (bounds.size.y - bounds.offset.y)
deltaPos.y = (p2.y-p1.y) + yOffset
deltaPos.z = (p2.z-p1.z)
return deltaPos
end
@ -244,6 +467,13 @@ function rotateLocalCoordinates(desiredPos, obj)
return {x=x, y=desiredPos.y, z=z}
end
function rotateMyCoordinates(desiredPos, obj)
local angle = math.rad(obj.getRotation().y)
local x = desiredPos.x * math.sin(angle)
local z = desiredPos.z * math.cos(angle)
return {x=x, y=desiredPos.y, z=z}
end
--Coroutine delay, in seconds
function wait(time)
local start = os.time()
@ -270,4 +500,4 @@ end
function round(num, dec)
local mult = 10^(dec or 0)
return math.floor(num * mult + 0.5) / mult
end
end

View File

@ -1,4 +1,6 @@
Autoraise: true
Bag:
Order: 0
ColorDiffuse:
b: 0.0
g: 0.366520882
@ -34,9 +36,9 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 15.36
posY: 2.96
posZ: -82.22
posX: 31.29
posY: 2.1
posZ: -72.86
rotX: 359.98
rotY: 270.0
rotZ: 0.0

View File

@ -1,4 +1,6 @@
Autoraise: true
Bag:
Order: 0
ColorDiffuse:
b: 0.0
g: 0.366520882
@ -32,12 +34,12 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 87.61
posY: 3.19
posZ: 0.15
rotX: 358.38
rotY: 0.04
rotZ: 358.02
posX: 41.93
posY: 2.11
posZ: -51.44
rotX: 0.0
rotY: 0.01
rotZ: 0.0
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -1,4 +1,6 @@
Autoraise: true
Bag:
Order: 0
ColorDiffuse:
b: 0.0
g: 0.366520882
@ -29,12 +31,12 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 86.04
posY: 3.19
posZ: -10.08
rotX: 357.39
posX: 32.2
posY: 2.38
posZ: -23.91
rotX: 0.0
rotY: 0.01
rotZ: 359.43
rotZ: 359.99
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -37,12 +37,12 @@ Snap: true
Sticky: true
Tooltip: false
Transform:
posX: 83.19
posY: 3.45
posZ: -14.36
rotX: 0.78
rotY: 270.17
rotZ: 2.12
posX: 15.7
posY: 3.6
posZ: 19.15
rotX: 359.58
rotY: 270.0
rotZ: 0.02
scaleX: 0.7
scaleY: 1.0
scaleZ: 0.7

View File

@ -37,12 +37,12 @@ Snap: true
Sticky: true
Tooltip: false
Transform:
posX: 82.23
posY: 3.41
posZ: -14.32
rotX: 2.54
rotY: 270.02
rotZ: 0.77
posX: 15.26
posY: 3.57
posZ: 18.67
rotX: 2.19
rotY: 270.04
rotZ: 2.29
scaleX: 0.7
scaleY: 1.0
scaleZ: 0.7

View File

@ -511,24 +511,24 @@ ContainedObjects:
scaleZ: 1.0
XmlUI: ''
- Autoraise: true
CardID: 266400
CardID: 448302
ColorDiffuse:
b: 0.713235259
g: 0.713235259
r: 0.713235259
CustomDeck:
'2664':
'4483':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/1747933191218961222/32A8F41F3FDA4387C71BA2668B2645E36EDAE74D/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1747933191218960581/4546AD2542BDA831A52F111505063691712EE74F/
NumHeight: 5
NumWidth: 10
BackURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426673/269D77168965F22EE72041C9C027AA5C269BF851/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426502/5256CD7EBB3950C9ACEA29AEEDC2C962E033BE47/
NumHeight: 2
NumWidth: 3
Type: 0
UniqueBack: true
Description: Act 3
DragSelectable: true
GMNotes: ''
GUID: 93dd4c
GUID: a8d0bf
Grid: true
GridProjection: false
Hands: true
@ -546,35 +546,35 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 95.96377
posY: 1.55791354
posZ: -0.7406169
rotX: 359.9868
rotY: 269.1516
rotZ: 179.981064
posX: 16.4486256
posY: 1.64528382
posZ: 28.27672
rotX: 0.107826106
rotY: 179.998184
rotZ: 0.0738619938
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
XmlUI: ''
- Autoraise: true
CardID: 266401
CardID: 448301
ColorDiffuse:
b: 0.713235259
g: 0.713235259
r: 0.713235259
CustomDeck:
'2664':
'4483':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/1747933191218961222/32A8F41F3FDA4387C71BA2668B2645E36EDAE74D/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1747933191218960581/4546AD2542BDA831A52F111505063691712EE74F/
NumHeight: 5
NumWidth: 10
BackURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426673/269D77168965F22EE72041C9C027AA5C269BF851/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426502/5256CD7EBB3950C9ACEA29AEEDC2C962E033BE47/
NumHeight: 2
NumWidth: 3
Type: 0
UniqueBack: true
Description: Act 2
DragSelectable: true
GMNotes: ''
GUID: 158b35
GUID: 5e482e
Grid: true
GridProjection: false
Hands: true
@ -592,35 +592,35 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 95.6354141
posY: 1.56212819
posZ: -0.492235
rotX: 0.0759175047
rotY: 269.468872
rotZ: 179.95282
posX: 16.6478634
posY: 1.65269876
posZ: 28.791378
rotX: 0.0170303844
rotY: 179.99791
rotZ: 0.0796133652
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
XmlUI: ''
- Autoraise: true
CardID: 266402
CardID: 448300
ColorDiffuse:
b: 0.713235259
g: 0.713235259
r: 0.713235259
CustomDeck:
'2664':
'4483':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/1747933191218961222/32A8F41F3FDA4387C71BA2668B2645E36EDAE74D/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1747933191218960581/4546AD2542BDA831A52F111505063691712EE74F/
NumHeight: 5
NumWidth: 10
BackURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426673/269D77168965F22EE72041C9C027AA5C269BF851/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426502/5256CD7EBB3950C9ACEA29AEEDC2C962E033BE47/
NumHeight: 2
NumWidth: 3
Type: 0
UniqueBack: true
Description: Act 1
DragSelectable: true
GMNotes: ''
GUID: c715c9
GUID: 3b920f
Grid: true
GridProjection: false
Hands: true
@ -638,35 +638,35 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 95.71167
posY: 1.5735656
posZ: -0.776779234
rotX: 359.991852
rotY: 269.90036
rotZ: 179.9727
posX: 16.7871284
posY: 1.6671077
posZ: 28.6912766
rotX: 0.199478284
rotY: 180.000275
rotZ: 0.100667186
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
XmlUI: ''
- Autoraise: true
CardID: 266500
CardID: 448304
ColorDiffuse:
b: 0.713235259
g: 0.713235259
r: 0.713235259
CustomDeck:
'2665':
'4483':
BackIsHidden: true
BackURL: https://i.imgur.com/b1f3mgA.jpg
FaceURL: https://i.imgur.com/FFxz16e.jpg
BackURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426673/269D77168965F22EE72041C9C027AA5C269BF851/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426502/5256CD7EBB3950C9ACEA29AEEDC2C962E033BE47/
NumHeight: 2
NumWidth: 2
NumWidth: 3
Type: 0
UniqueBack: true
Description: Agenda 2
DragSelectable: true
GMNotes: ''
GUID: 023684
GUID: c5e7c8
Grid: true
GridProjection: false
Hands: true
@ -678,41 +678,41 @@ ContainedObjects:
LuaScriptState: ''
MeasureMovement: false
Name: Card
Nickname: Schemes in the Dark Beyond
Nickname: Schemes in the Dark Brotherhood
SidewaysCard: true
Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 96.21822
posY: 1.55591869
posZ: -0.447373033
rotX: 359.974731
rotY: 270.0273
rotZ: 179.95517
posX: 16.3758
posY: 1.67217064
posZ: 28.2662754
rotX: 0.0168318674
rotY: 180.0039
rotZ: 0.0795824
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
XmlUI: ''
- Autoraise: true
CardID: 266404
CardID: 448303
ColorDiffuse:
b: 0.713235259
g: 0.713235259
r: 0.713235259
CustomDeck:
'2664':
'4483':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/1747933191218961222/32A8F41F3FDA4387C71BA2668B2645E36EDAE74D/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1747933191218960581/4546AD2542BDA831A52F111505063691712EE74F/
NumHeight: 5
NumWidth: 10
BackURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426673/269D77168965F22EE72041C9C027AA5C269BF851/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426502/5256CD7EBB3950C9ACEA29AEEDC2C962E033BE47/
NumHeight: 2
NumWidth: 3
Type: 0
UniqueBack: true
Description: Agenda 1
DragSelectable: true
GMNotes: ''
GUID: 05b7a2
GUID: 3ab8f1
Grid: true
GridProjection: false
Hands: true
@ -730,12 +730,12 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 95.81102
posY: 1.41099083
posZ: -0.609462
rotX: 359.985748
rotY: 270.020447
rotZ: 179.9743
posX: 16.2762318
posY: 1.68202114
posZ: 28.2888432
rotX: 0.016518794
rotY: 180.002533
rotZ: 0.07967561
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
@ -749,20 +749,12 @@ CustomDeck:
NumWidth: 10
Type: 0
UniqueBack: true
'2664':
'4483':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/1747933191218961222/32A8F41F3FDA4387C71BA2668B2645E36EDAE74D/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1747933191218960581/4546AD2542BDA831A52F111505063691712EE74F/
NumHeight: 5
NumWidth: 10
Type: 0
UniqueBack: true
'2665':
BackIsHidden: true
BackURL: https://i.imgur.com/b1f3mgA.jpg
FaceURL: https://i.imgur.com/FFxz16e.jpg
BackURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426673/269D77168965F22EE72041C9C027AA5C269BF851/
FaceURL: http://cloud-3.steamusercontent.com/ugc/1723164938912426502/5256CD7EBB3950C9ACEA29AEEDC2C962E033BE47/
NumHeight: 2
NumWidth: 2
NumWidth: 3
Type: 0
UniqueBack: true
DeckIDs:
@ -777,11 +769,11 @@ DeckIDs:
- 266206
- 266208
- 266207
- 266400
- 266401
- 266402
- 266500
- 266404
- 448302
- 448301
- 448300
- 448304
- 448303
Description: ''
DragSelectable: true
GMNotes: ''
@ -803,12 +795,12 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 82.9
posY: 3.46
posZ: -14.79
rotX: 1.12
rotY: 270.07
rotZ: 3.44
posX: 15.82
posY: 3.65
posZ: 19.32
rotX: 359.54
rotY: 269.99
rotZ: 359.62
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -1,4 +1,6 @@
Autoraise: true
Bag:
Order: 0
ColorDiffuse:
b: 0.0
g: 0.366520882
@ -46,12 +48,12 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 16.96
posY: 2.97
posZ: -47.92
rotX: 0.0
posX: 27.42
posY: 2.11
posZ: -64.47
rotX: 359.99
rotY: 0.0
rotZ: 359.98
rotZ: 359.97
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -1529,7 +1529,7 @@ ContainedObjects:
g: 0.713235259
r: 0.713235259
CustomDeck:
'4482':
'5398':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/780749631103001215/3FF9DC51D7737267B68EC5D9CF17BE421681663B/
FaceURL: http://cloud-3.steamusercontent.com/ugc/780749631102998699/DA1D7C58FE177F46169558EF1D8301754A91A73A/
@ -1552,18 +1552,18 @@ ContainedObjects:
LuaScriptState: ''
MeasureMovement: false
Name: Card
Nickname: The Are Upon You!
Nickname: They Are Upon You!
SidewaysCard: true
Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 47.98791
posY: 1.87741852
posZ: 51.83585
rotX: 359.9203
rotY: 269.999817
rotZ: 0.0168208033
posX: 10.44375
posY: 1.84596336
posZ: -31.38194
rotX: 359.920258
rotY: 270.0004
rotZ: 0.01657437
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
@ -1575,7 +1575,7 @@ ContainedObjects:
g: 0.713235259
r: 0.713235259
CustomDeck:
'4482':
'5398':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/780749631103001215/3FF9DC51D7737267B68EC5D9CF17BE421681663B/
FaceURL: http://cloud-3.steamusercontent.com/ugc/780749631102998699/DA1D7C58FE177F46169558EF1D8301754A91A73A/
@ -1604,12 +1604,12 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 47.91146
posY: 1.8871423
posZ: 51.7693062
rotX: 359.920074
rotY: 269.9829
rotZ: 0.0167244412
posX: 10.2998857
posY: 2.18132639
posZ: -31.5308
rotX: 359.943176
rotY: 269.9842
rotZ: 19.12985
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
@ -1621,7 +1621,7 @@ ContainedObjects:
g: 0.713235259
r: 0.713235259
CustomDeck:
'4482':
'5398':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/780749631103001215/3FF9DC51D7737267B68EC5D9CF17BE421681663B/
FaceURL: http://cloud-3.steamusercontent.com/ugc/780749631102998699/DA1D7C58FE177F46169558EF1D8301754A91A73A/
@ -1650,12 +1650,12 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 47.94799
posY: 1.8969295
posZ: 52.3759727
rotX: 359.9204
rotY: 269.999878
rotZ: 0.0167983416
posX: 10.4405441
posY: 2.03472543
posZ: -31.598
rotX: 359.9617
rotY: 269.9955
rotZ: 10.8818359
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
@ -1667,7 +1667,7 @@ ContainedObjects:
g: 0.713235259
r: 0.713235259
CustomDeck:
'4483':
'5397':
BackIsHidden: true
BackURL: http://cloud-3.steamusercontent.com/ugc/780749631103441607/63F6472BFA33AA6C487997A0A45EEBB4C27336C8/
FaceURL: http://cloud-3.steamusercontent.com/ugc/780749631103441052/FC2DD250B4173C28B245388F80C6D9ABA3B7D2E7/
@ -1696,12 +1696,12 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: -5.88149071
posY: 1.73344219
posZ: 85.77766
rotX: 0.017959075
rotY: 269.979553
rotZ: 0.0130561721
posX: 10.3301277
posY: 2.05476022
posZ: -30.87974
rotX: 359.951721
rotY: 270.00708
rotZ: 9.641686
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
@ -1798,9 +1798,9 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 28.16
posY: 4.3
posZ: -25.4
posX: 16.4
posY: 2.71
posZ: -43.16
rotX: 359.92
rotY: 270.0
rotZ: 0.02

View File

@ -47,12 +47,12 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 24.25
posX: 32.01
posY: 2.11
posZ: -54.31
rotX: 0.0
posZ: -68.55
rotX: 359.99
rotY: 0.0
rotZ: 0.0
rotZ: 359.97
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0

View File

@ -709,14 +709,14 @@ ContainedObjects:
NumWidth: 5
Type: 0
UniqueBack: false
Description: Item. Relic.
Description: ''
DragSelectable: true
GMNotes: ''
GUID: 0c1322
Grid: true
GridProjection: false
Hands: true
HideWhenFaceDown: true
HideWhenFaceDown: false
IgnoreFoW: false
LayoutGroupSortIndex: 0
Locked: false
@ -730,12 +730,12 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 5.363399
posY: 2.505006
posZ: 22.04943
rotX: 0.0208047628
rotY: 270.0138
rotZ: 0.0167760812
posX: 16.4546871
posY: 2.30093741
posZ: -69.9715042
rotX: 359.920135
rotY: 269.999969
rotZ: 0.01687443
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
@ -755,14 +755,14 @@ ContainedObjects:
NumWidth: 5
Type: 0
UniqueBack: false
Description: Item. Relic. Clothing.
Description: ''
DragSelectable: true
GMNotes: ''
GUID: 16e85d
Grid: true
GridProjection: false
Hands: true
HideWhenFaceDown: true
HideWhenFaceDown: false
IgnoreFoW: false
LayoutGroupSortIndex: 0
Locked: false
@ -776,12 +776,12 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 2.407879
posY: 2.511467
posZ: 29.998127
rotX: 0.0208047926
rotY: 270.0139
rotZ: 0.0167760663
posX: 8.0331955
posY: 2.34013724
posZ: -50.30057
rotX: 359.920135
rotY: 269.999817
rotZ: 0.0168730877
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
@ -801,14 +801,14 @@ ContainedObjects:
NumWidth: 5
Type: 0
UniqueBack: false
Description: Item. Relic.
Description: ''
DragSelectable: true
GMNotes: ''
GUID: f24cd3
Grid: true
GridProjection: false
Hands: true
HideWhenFaceDown: true
HideWhenFaceDown: false
IgnoreFoW: false
LayoutGroupSortIndex: 0
Locked: false
@ -822,12 +822,12 @@ ContainedObjects:
Sticky: true
Tooltip: true
Transform:
posX: 2.75166321
posY: 2.5109725
posZ: 28.3076458
rotX: 0.0208044723
rotY: 270.013916
rotZ: 0.0167762842
posX: 8.735557
posY: 2.33671665
posZ: -56.0377769
rotX: 359.983154
rotY: 269.999969
rotZ: 0.00355958822
scaleX: 1.0
scaleY: 1.0
scaleZ: 1.0
@ -1845,10 +1845,10 @@ Snap: true
Sticky: true
Tooltip: true
Transform:
posX: 15.04
posY: 2.68
posZ: 25.87
rotX: 0.02
posX: 31.79
posY: 2.5
posZ: -54.54
rotX: 359.92
rotY: 270.0
rotZ: 0.02
scaleX: 1.0

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,81 @@
function onload()
mode = "Bless"
chaosbag = getChaosBag()
manager = getObjectFromGUID("5933fb")
sealedTokens = { }
IMAGE_TOKEN_MAP = { }
for i,v in pairs(Global.getVar("IMAGE_TOKEN_MAP")) do
IMAGE_TOKEN_MAP[i] = v
end
-- add menu items
self.clearContextMenu()
self.addContextMenuItem("Release Token", releaseTokens, true)
for url,name in pairs(IMAGE_TOKEN_MAP) do
if name == mode then
self.addContextMenuItem("Seal " .. mode, function(playerColor) sealToken(url, playerColor) end, true)
end
end
end
function sealToken(url, playerColor)
local pos = self.getPosition()
local name = IMAGE_TOKEN_MAP[url]
for i,obj in ipairs(chaosbag.getObjects()) do
if obj.name == name then
chaosbag.takeObject({
position={ pos.x, pos.y + 1, pos.z },
index=i-1,
smooth=false,
callback_function=_sealToken
})
return
end
end
printToColor(name .. " token not found in bag", playerColor)
end
function _sealToken(obj)
table.insert(sealedTokens, obj)
local guid = obj.getGUID()
local tokensTaken = manager.getVar("tokensTaken")
table.insert(tokensTaken[mode], guid)
manager.setVar("tokensTaken", tokensTaken)
manager.setVar("mode", mode)
printToAll("Sealing " .. mode .. " token " .. manager.call("getTokenCount"))
end
function releaseTokens(playerColor)
if #sealedTokens == 0 then return end
local token = sealedTokens[#sealedTokens]
if token ~= nil then
local guid = token.getGUID()
chaosbag.putObject(token)
local tokensTaken = manager.getVar("tokensTaken")
for i,v in ipairs(tokensTaken[mode]) do
if v == guid then
table.remove(tokensTaken[mode], i)
break
end
end
manager.setVar("tokensTaken", tokensTaken)
manager.setVar("mode", mode)
printToAll("Releasing " .. mode .. " token" .. manager.call("getTokenCount"))
end
table.remove(sealedTokens)
end
function getChaosBag()
local items = getObjectFromGUID("83ef06").getObjects()
local chaosbag = nil
for i,v in ipairs(items) do
if v.getDescription() == "Chaos Bag" then
chaosbag = getObjectFromGUID(v.getGUID())
break
end
end
if chaosbag == nil then printToAll("No chaos bag found") end
return chaosbag
end

View File

@ -16,7 +16,7 @@ CustomDeck:
Description: Huntress of Bast
DragSelectable: true
GMNotes: ''
GUID: 66c93b
GUID: 5659d1
Grid: true
GridProjection: false
Hands: true
@ -24,7 +24,7 @@ HideWhenFaceDown: true
IgnoreFoW: false
LayoutGroupSortIndex: 0
Locked: false
LuaScript: ''
LuaScript: !include 'Card Nephthys (4) 5659d1.ttslua'
LuaScriptState: ''
MeasureMovement: false
Name: Card
@ -38,7 +38,7 @@ Transform:
posY: 1.3
posZ: -70.41
rotX: 0.02
rotY: 270.01
rotY: 270.0
rotZ: 0.02
scaleX: 1.0
scaleY: 1.0

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,81 @@
function onload()
mode = "Bless"
chaosbag = getChaosBag()
manager = getObjectFromGUID("5933fb")
sealedTokens = { }
IMAGE_TOKEN_MAP = { }
for i,v in pairs(Global.getVar("IMAGE_TOKEN_MAP")) do
IMAGE_TOKEN_MAP[i] = v
end
-- add menu items
self.clearContextMenu()
self.addContextMenuItem("Release Token", releaseTokens, true)
for url,name in pairs(IMAGE_TOKEN_MAP) do
if name == mode then
self.addContextMenuItem("Seal " .. mode, function(playerColor) sealToken(url, playerColor) end, true)
end
end
end
function sealToken(url, playerColor)
local pos = self.getPosition()
local name = IMAGE_TOKEN_MAP[url]
for i,obj in ipairs(chaosbag.getObjects()) do
if obj.name == name then
chaosbag.takeObject({
position={ pos.x, pos.y + 1, pos.z },
index=i-1,
smooth=false,
callback_function=_sealToken
})
return
end
end
printToColor(name .. " token not found in bag", playerColor)
end
function _sealToken(obj)
table.insert(sealedTokens, obj)
local guid = obj.getGUID()
local tokensTaken = manager.getVar("tokensTaken")
table.insert(tokensTaken[mode], guid)
manager.setVar("tokensTaken", tokensTaken)
manager.setVar("mode", mode)
printToAll("Sealing " .. mode .. " token " .. manager.call("getTokenCount"))
end
function releaseTokens(playerColor)
if #sealedTokens == 0 then return end
local token = sealedTokens[#sealedTokens]
if token ~= nil then
local guid = token.getGUID()
chaosbag.putObject(token)
local tokensTaken = manager.getVar("tokensTaken")
for i,v in ipairs(tokensTaken[mode]) do
if v == guid then
table.remove(tokensTaken[mode], i)
break
end
end
manager.setVar("tokensTaken", tokensTaken)
manager.setVar("mode", mode)
printToAll("Releasing " .. mode .. " token" .. manager.call("getTokenCount"))
end
table.remove(sealedTokens)
end
function getChaosBag()
local items = getObjectFromGUID("83ef06").getObjects()
local chaosbag = nil
for i,v in ipairs(items) do
if v.getDescription() == "Chaos Bag" then
chaosbag = getObjectFromGUID(v.getGUID())
break
end
end
if chaosbag == nil then printToAll("No chaos bag found") end
return chaosbag
end

View File

@ -16,7 +16,7 @@ CustomDeck:
Description: Huntress of Bast
DragSelectable: true
GMNotes: ''
GUID: 66c93b
GUID: 5659d1
Grid: true
GridProjection: false
Hands: true
@ -24,7 +24,7 @@ HideWhenFaceDown: true
IgnoreFoW: false
LayoutGroupSortIndex: 0
Locked: false
LuaScript: ''
LuaScript: !include 'Card Nephthys (4) 5659d1.ttslua'
LuaScriptState: ''
MeasureMovement: false
Name: Card
@ -38,7 +38,7 @@ Transform:
posY: 1.41
posZ: -63.98
rotX: 0.02
rotY: 270.01
rotY: 270.0
rotZ: 0.02
scaleX: 1.0
scaleY: 1.0

View File

@ -0,0 +1,81 @@
function onload()
mode = "Bless"
chaosbag = getChaosBag()
manager = getObjectFromGUID("5933fb")
sealedTokens = { }
IMAGE_TOKEN_MAP = { }
for i,v in pairs(Global.getVar("IMAGE_TOKEN_MAP")) do
IMAGE_TOKEN_MAP[i] = v
end
-- add menu items
self.clearContextMenu()
self.addContextMenuItem("Release Token", releaseTokens, true)
for url,name in pairs(IMAGE_TOKEN_MAP) do
if name == mode then
self.addContextMenuItem("Seal " .. mode, function(playerColor) sealToken(url, playerColor) end, true)
end
end
end
function sealToken(url, playerColor)
local pos = self.getPosition()
local name = IMAGE_TOKEN_MAP[url]
for i,obj in ipairs(chaosbag.getObjects()) do
if obj.name == name then
chaosbag.takeObject({
position={ pos.x, pos.y + 1, pos.z },
index=i-1,
smooth=false,
callback_function=_sealToken
})
return
end
end
printToColor(name .. " token not found in bag", playerColor)
end
function _sealToken(obj)
table.insert(sealedTokens, obj)
local guid = obj.getGUID()
local tokensTaken = manager.getVar("tokensTaken")
table.insert(tokensTaken[mode], guid)
manager.setVar("tokensTaken", tokensTaken)
manager.setVar("mode", mode)
printToAll("Sealing " .. mode .. " token " .. manager.call("getTokenCount"))
end
function releaseTokens(playerColor)
if #sealedTokens == 0 then return end
local token = sealedTokens[#sealedTokens]
if token ~= nil then
local guid = token.getGUID()
chaosbag.putObject(token)
local tokensTaken = manager.getVar("tokensTaken")
for i,v in ipairs(tokensTaken[mode]) do
if v == guid then
table.remove(tokensTaken[mode], i)
break
end
end
manager.setVar("tokensTaken", tokensTaken)
manager.setVar("mode", mode)
printToAll("Releasing " .. mode .. " token" .. manager.call("getTokenCount"))
end
table.remove(sealedTokens)
end
function getChaosBag()
local items = getObjectFromGUID("83ef06").getObjects()
local chaosbag = nil
for i,v in ipairs(items) do
if v.getDescription() == "Chaos Bag" then
chaosbag = getObjectFromGUID(v.getGUID())
break
end
end
if chaosbag == nil then printToAll("No chaos bag found") end
return chaosbag
end

Some files were not shown because too many files have changed in this diff Show More