adding new util file

This commit is contained in:
Chr1Z93 2023-01-05 15:59:07 +01:00
parent 5a90702526
commit 46781a9f9e
19 changed files with 69 additions and 625 deletions

View File

@ -1,5 +1,3 @@
ASSEMBLY_POSITION = {69.08, 4, 36.45}
function onload()
chaosbag = getChaosBag()
manager = getObjectFromGUID("5933fb")

View File

@ -14,16 +14,16 @@
"r": 1
},
"ContainedObjects_order": [
"Custom_Tile.b2b7be",
"Custom_Tile.b2b7be",
"Custom_Tile.09aa04",
"Custom_Tile.90e57c",
"Custom_Tile.5ca99d",
"Custom_Tile.b2b7be",
"Custom_Tile.bc1c12",
"Custom_Tile.e9c4f9",
"Custom_Tile.eb0b16",
"Custom_Tile.eb0b16"
"Bless.b2b7be",
"Bless.b2b7be",
"Bless.b2b7be",
"Bless.b2b7be",
"Bless.b2b7be",
"Bless.b2b7be",
"Bless.b2b7be",
"Bless.b2b7be",
"Bless.b2b7be",
"Bless.b2b7be"
],
"ContainedObjects_path": "Blesstokens.afa06b",
"CustomMesh": {

View File

@ -37,7 +37,7 @@
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Nickname": "Bless",
"Snap": true,
"Sticky": true,
"Tooltip": true,
@ -54,4 +54,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.04894,
"g": 0.32859,
"r": 0.37456
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "09aa04",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -1.465,
"posY": 1.694,
"posZ": -26.93,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.04894,
"g": 0.32859,
"r": 0.37456
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "5ca99d",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -1.465,
"posY": 1.709,
"posZ": -26.93,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.04894,
"g": 0.32859,
"r": 0.37456
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "90e57c",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -1.465,
"posY": 1.706,
"posZ": -26.93,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.04894,
"g": 0.32859,
"r": 0.37456
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "bc1c12",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -1.465,
"posY": 1.688,
"posZ": -26.93,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.04894,
"g": 0.32859,
"r": 0.37456
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "e9c4f9",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -1.465,
"posY": 1.697,
"posZ": -26.93,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.04894,
"g": 0.32859,
"r": 0.37456
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "eb0b16",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -45.934,
"posY": 1.814,
"posZ": 4.076,
"rotX": 0,
"rotY": 90,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -14,16 +14,16 @@
"r": 1
},
"ContainedObjects_order": [
"Custom_Tile.678891",
"Custom_Tile.678891",
"Custom_Tile.adec97",
"Custom_Tile.678891",
"Custom_Tile.f82dd9",
"Custom_Tile.678891",
"Custom_Tile.5b224c",
"Custom_Tile.678891",
"Custom_Tile.b92c2b",
"Custom_Tile.678891"
"Curse.678891",
"Curse.678891",
"Curse.678891",
"Curse.678891",
"Curse.678891",
"Curse.678891",
"Curse.678891",
"Curse.678891",
"Curse.678891",
"Curse.678891"
],
"ContainedObjects_path": "Cursetokens.bd0253",
"CustomMesh": {

View File

@ -37,7 +37,7 @@
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Nickname": "Curse",
"Snap": true,
"Sticky": true,
"Tooltip": true,
@ -54,4 +54,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.44425,
"g": 0.00387,
"r": 0.27072
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "5b224c",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 4.233,
"posY": 1.607,
"posZ": -21.577,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.44425,
"g": 0.00387,
"r": 0.27072
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "adec97",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 4.233,
"posY": 1.607,
"posZ": -21.577,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.44425,
"g": 0.00387,
"r": 0.27072
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "b92c2b",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": -45.493,
"posY": 1.791,
"posZ": -3.886,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1,57 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0.44425,
"g": 0.00387,
"r": 0.27072
},
"CustomImage": {
"CustomTile": {
"Stackable": false,
"Stretch": true,
"Thickness": 0.1,
"Type": 2
},
"ImageScalar": 1,
"ImageSecondaryURL": "",
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/",
"WidthScale": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "f82dd9",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "",
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 4.233,
"posY": 1.607,
"posZ": -21.577,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.81,
"scaleY": 1,
"scaleZ": 0.81
},
"Value": 0,
"XmlUI": ""
}

View File

@ -167,7 +167,7 @@ function isCardOrDeck(x) return x.tag == 'Card' or x.tag == 'Deck' end
-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the
-- chaos bag during search operations to avoid this.
function onObjectSearchStart(object, playerColor)
findChaosBag()
chaosbag = findChaosBag()
if object == chaosbag then
bagSearchers[playerColor] = true
end
@ -177,7 +177,7 @@ end
-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the
-- chaos bag during search operations to avoid this.
function onObjectSearchEnd(object, playerColor)
findChaosBag()
chaosbag = findChaosBag()
if object == chaosbag then
bagSearchers[playerColor] = nil
end
@ -265,7 +265,9 @@ end
-- checks scripting zone for chaos bag
function findChaosBag()
for _, item in ipairs(getObjectFromGUID("83ef06").getObjects()) do
if item.getDescription() == "Chaos Bag" then chaosbag = item end
if item.getDescription() == "Chaos Bag" then
return item
end
end
end
@ -300,7 +302,7 @@ function drawChaostoken(params)
local mat = params[1]
local tokenOffset = params[2]
local isRightClick = params[3]
findChaosBag()
chaosbag = findChaosBag()
-- return token(s) on other playmat first
if chaosTokensLastMat ~= nil and chaosTokensLastMat ~= mat and #chaosTokens ~= 0 then
@ -465,7 +467,7 @@ end
---@param key string Name of the scenario
---@param mode string diffculty (e.g. "hard" or "expert")
function fillContainer(args)
findChaosBag()
chaosbag = findChaosBag()
if chaosbag ~= nil then
local data = getDataValue('modeData', args.key)

View File

@ -1,4 +1,5 @@
local tokenManager = require("core/token/TokenManager")
local isChaosToken = require("util/isChaosToken")
-- set true to enable debug logging and show Physics.cast()
local DEBUG = false
@ -178,6 +179,10 @@ function makeDiscardHandlerFor(searchPosition, discardPosition)
obj.setPositionSmooth(discardPosition, false, true)
obj.setRotation({0, -90, 0})
end
-- put chaos tokens back into bag (e.g. Unrelenting)
elseif isChaosToken(obj) then
local chaosBag = Global.call("findChaosBag")
chaosBag.putObject(obj)
-- don't touch the table or this playmat itself
elseif obj.guid ~= "4ee1f2" and obj ~= self then
TRASHCAN.putObject(obj)

View File

@ -1,25 +1,5 @@
local zone = nil
local CHAOS_TOKEN_NAMES = {
["Elder Sign"] = true,
["+1"] = true,
["0"] = true,
["-1"] = true,
["-2"] = true,
["-3"] = true,
["-4"] = true,
["-5"] = true,
["-6"] = true,
["-7"] = true,
["-8"] = true,
["Skull"] = true,
["Cultist"] = true,
["Tablet"] = true,
["Elder Thing"] = true,
["Auto-fail"] = true,
["Bless"] = true,
["Curse"] = true,
["Frost"] = true
}
local isChaosToken = require("util/isChaosToken")
-- general code
function onSave()
@ -36,14 +16,12 @@ end
-- context menu functions
function enable()
local scale = self.getScale()
zone = spawnObject({
type = "ScriptingTrigger",
position = self.getPosition() + Vector(0, 2.5 + 0.11, 0),
rotation = self.getRotation(),
scale = { scale.x * 2, 5, scale.z * 2 }
})
setMenu(false)
end
@ -65,7 +43,7 @@ end
function onObjectEnterScriptingZone(entering, object)
if zone ~= entering then return end
if object == self or object.type == "Deck" or object.type == "Card" then return end
if CHAOS_TOKEN_NAMES[object.getName()] then return end
if isChaosToken(object) then return end
object.destruct()
end

View File

@ -0,0 +1,31 @@
do
local CHAOS_TOKEN_NAMES = {
["Elder Sign"] = true,
["+1"] = true,
["0"] = true,
["-1"] = true,
["-2"] = true,
["-3"] = true,
["-4"] = true,
["-5"] = true,
["-6"] = true,
["-7"] = true,
["-8"] = true,
["Skull"] = true,
["Cultist"] = true,
["Tablet"] = true,
["Elder Thing"] = true,
["Auto-fail"] = true,
["Bless"] = true,
["Curse"] = true,
["Frost"] = true
}
return function(obj)
if CHAOS_TOKEN_NAMES[obj.getName()] then
return true
else
return false
end
end
end