implementing clue counting method swap

This commit is contained in:
Chr1Z93 2022-12-08 14:27:55 +01:00
parent f69f426248
commit 251bf93dd4
19 changed files with 125 additions and 150 deletions

View File

@ -67,6 +67,10 @@
"ScriptingTrigger.67ce9a",
"Detailedphasereference.68fe54",
"RulesIndex.91c83e",
"Clues.3f22e5",
"Clues.db85d6",
"Clues.891403",
"Clues.4111de",
"Resources.4406f0",
"Damage.eb08d6",
"Horror.468e88",
@ -129,11 +133,10 @@
"LeakedItems.42cd6e",
"ChaosTokenReserve.106418",
"3DText.134348",
"Custom_Model.032300",
"Custom_Model.1769ed",
"Custom_Model.37be78",
"Custom_Model.d86b7c",
"ClueCounterSwapper.d919d6",
"ClueCounter.37be78",
"ClueCounter.1769ed",
"ClueCounter.032300",
"ClueCounter.d86b7c",
"MasterClueCounter.4a3aa4",
"LegacyAssets.7165a9",
"Weaknessdecks.750fdd",

View File

@ -46,16 +46,16 @@
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Model",
"Nickname": "",
"Nickname": "Clue Counter",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Tooltip": false,
"Transform": {
"posX": -31.911,
"posX": -32.193,
"posY": 1.52,
"posZ": 30.97,
"posZ": 30.977,
"rotX": 0,
"rotY": 0,
"rotY": 10,
"rotZ": 0,
"scaleX": 0.33,
"scaleY": 0.33,
@ -63,4 +63,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -46,16 +46,16 @@
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Model",
"Nickname": "",
"Nickname": "Clue Counter",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Tooltip": false,
"Transform": {
"posX": -59.449,
"posX": -59.426,
"posY": 1.52,
"posZ": -22.628,
"posZ": -22.721,
"rotX": 0,
"rotY": 270,
"rotY": 280,
"rotZ": 0,
"scaleX": 0.33,
"scaleY": 0.33,
@ -63,4 +63,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -46,16 +46,16 @@
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Model",
"Nickname": "",
"Nickname": "Clue Counter",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Tooltip": false,
"Transform": {
"posX": -18.983,
"posX": -18.87,
"posY": 1.52,
"posZ": -31.01,
"posZ": -30.977,
"rotX": 0,
"rotY": 180,
"rotY": 190,
"rotZ": 0,
"scaleX": 0.33,
"scaleY": 0.33,
@ -63,4 +63,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -46,16 +46,16 @@
"LuaScriptState": "",
"MeasureMovement": false,
"Name": "Custom_Model",
"Nickname": "",
"Nickname": "Clue Counter",
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Tooltip": false,
"Transform": {
"posX": -59.499,
"posX": -59.426,
"posY": 1.52,
"posZ": 9.561,
"posZ": 9.395,
"rotX": 0,
"rotY": 270,
"rotY": 280,
"rotZ": 0,
"scaleX": 0.33,
"scaleY": 0.33,
@ -63,4 +63,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -1,77 +0,0 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 1,
"g": 0.99217,
"r": 1
},
"ContainedObjects_order": [
"Clues.3f22e5",
"Clues.4111de",
"Clues.891403",
"Clues.db85d6"
],
"ContainedObjects_path": "ClueCounterSwapper.d919d6",
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "",
"Convex": true,
"CustomShader": {
"FresnelStrength": 0,
"SpecularColor": {
"b": 1,
"g": 1,
"r": 1
},
"SpecularIntensity": 0,
"SpecularSharpness": 2
},
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1179328606460871995/F2AFA106E788BB456C6F9134CE7A7B14D510F973/",
"MaterialIndex": 3,
"MeshURL": "http://pastebin.com/raw.php?i=uWAmuNZ2",
"NormalURL": "",
"TypeIndex": 6
},
"Description": "Counter mode courtesy of tadgh's clue counter mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2115363630",
"DragSelectable": true,
"GMNotes": "",
"GUID": "d919d6",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"util/ClueCounterSwapper\")",
"LuaScriptState_path": "ClueCounterSwapper.d919d6.luascriptstate",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Clue Counter Swapper",
"Snap": true,
"Sticky": true,
"Tooltip": false,
"Transform": {
"posX": -50.9,
"posY": 1.51,
"posZ": 0,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.4,
"scaleY": 0.01,
"scaleZ": 0.4
},
"Value": 0,
"XmlUI": ""
}

View File

@ -1 +0,0 @@
{"ml":{"3f22e5":{"lock":true,"pos":{"x":-59.50,"y":1.54,"z":9.56},"rot":{"x":0,"y":280,"z":0}},"4111de":{"lock":true,"pos":{"x":-59.45,"y":1.54,"z":-22.63},"rot":{"x":0,"y":280,"z":0}},"891403":{"lock":true,"pos":{"x":-31.91,"y":1.54,"z":30.97},"rot":{"x":0,"y":10,"z":0}},"db85d6":{"lock":true,"pos":{"x":-18.98,"y":1.54,"z":-31.01},"rot":{"x":0,"y":190,"z":0}}}}

View File

@ -40,13 +40,16 @@
"Nickname": "Clues",
"Snap": true,
"Sticky": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": false,
"Transform": {
"posX": -59.318,
"posY": 1.64,
"posZ": -17.674,
"posX": -59.426,
"posY": 1.3,
"posZ": -22.721,
"rotX": 0,
"rotY": 270,
"rotY": 280,
"rotZ": 0,
"scaleX": 0.26,
"scaleY": 1,
@ -54,4 +57,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -40,13 +40,16 @@
"Nickname": "Clues",
"Snap": true,
"Sticky": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": false,
"Transform": {
"posX": -23.81,
"posY": 1.589,
"posZ": -30.927,
"posX": -18.87,
"posY": 1.3,
"posZ": -30.977,
"rotX": 0,
"rotY": 180,
"rotY": 190,
"rotZ": 0,
"scaleX": 0.26,
"scaleY": 1,
@ -54,4 +57,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -40,13 +40,16 @@
"Nickname": "Clues",
"Snap": true,
"Sticky": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": false,
"Transform": {
"posX": -31.911,
"posY": 1.564,
"posZ": 30.92,
"posX": -32.193,
"posY": 1.3,
"posZ": 30.977,
"rotX": 0,
"rotY": 0,
"rotY": 10,
"rotZ": 0,
"scaleX": 0.26,
"scaleY": 1,
@ -54,4 +57,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -40,13 +40,16 @@
"Nickname": "Clues",
"Snap": true,
"Sticky": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": false,
"Transform": {
"posX": -59.439,
"posY": 1.637,
"posZ": 9.472,
"posX": -59.426,
"posY": 1.3,
"posZ": 9.395,
"rotX": 0,
"rotY": 270,
"rotY": 280,
"rotZ": 0,
"scaleX": 0.26,
"scaleY": 1,
@ -54,4 +57,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -34,7 +34,7 @@
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"core/MasterClueCounter\")",
"LuaScriptState": "",
"LuaScriptState": "false",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Master Clue Counter\n",

View File

@ -12,5 +12,6 @@ TRASHCAN_GUID = "147e80"
STAT_TRACKER_GUID = "e598c2"
RESOURCE_COUNTER_GUID = "4406f0"
CLUE_COUNTER_GUID = "d86b7c"
CLUE_CLICKER_GUID = "db85d6"
require("playermat/Playmat")

View File

@ -12,5 +12,6 @@ TRASHCAN_GUID = "f7b6c8"
STAT_TRACKER_GUID = "b4a5f7"
RESOURCE_COUNTER_GUID = "816d84"
CLUE_COUNTER_GUID = "1769ed"
CLUE_CLICKER_GUID = "3f22e5"
require("playermat/Playmat")

View File

@ -12,5 +12,6 @@ TRASHCAN_GUID = "5f896a"
STAT_TRACKER_GUID = "af7ed7"
RESOURCE_COUNTER_GUID = "cd15ac"
CLUE_COUNTER_GUID = "032300"
CLUE_CLICKER_GUID = "891403"
require("playermat/Playmat")

View File

@ -12,5 +12,6 @@ TRASHCAN_GUID = "4b8594"
STAT_TRACKER_GUID = "e74881"
RESOURCE_COUNTER_GUID = "a4b60d"
CLUE_COUNTER_GUID = "37be78"
CLUE_CLICKER_GUID = "4111de"
require("playermat/Playmat")

View File

@ -632,6 +632,8 @@ function applyChange(id, state)
printToAll("Clickable clue counters " .. (state and "en" or "dis") .."abled.", "White")
PlayerMatAPI.clickableClues(state, "All")
-- update master clue counter
getObjectFromGUID("4a3aa4").setVar("clickableCounters", state)
end
end

View File

@ -6,11 +6,27 @@ local clueCounterGUIDS = {
"d86b7c"
}
function onLoad()
local clueClickers = {}
local clueClickerGUIDS = {
"db85d6",
"3f22e5",
"891403",
"4111de"
}
count = 0
clickableCounters = false
function onSave() return JSON.encode(clickableCounters) end
function onLoad(savedData)
if savedData ~= nil then
clickableCounters = JSON.decode(savedData)
end
self.createButton({
label = "0",
click_function = "removeAllPlayerClues",
tooltip = "Click here to remove all Clues from playermats",
tooltip = "Click here to remove all collected clues",
function_owner = self,
position = { 0, 0.06, 0 },
height = 900,
@ -21,26 +37,41 @@ function onLoad()
color = { 0, 0, 0, 0 }
})
-- loading object references to the counting bowls via GUID
-- loading object references to the clue counters / clickers via GUID
for i = 1, 4 do
clueCounters[i] = getObjectFromGUID(clueCounterGUIDS[i])
clueClickers[i] = getObjectFromGUID(clueClickerGUIDS[i])
end
loopID = Wait.time(sumClues, 2, -1)
end
-- removes all player clues by calling the respective function from the counting bowls
-- removes all player clues by calling the respective function from the counting bowls / clickers
function removeAllPlayerClues()
for i = 1, 4 do
clueCounters[i].call("removeAllClues")
printToAll(count .. " clue(s) from playermats removed.", "White")
if not clickableCounters then
for i = 1, 4 do
clueCounters[i].call("removeAllClues")
end
else
for i = 1, 4 do
clueClickers[i].call("updateVal", 0)
end
end
self.editButton({ index = 0, label = "0" })
end
-- gets the counted values from the counting bowls and sums them up
-- gets the counted values from the counting bowls / clickers and sums them up
function sumClues()
local count = 0
for i = 1, 4 do
count = count + tonumber(clueCounters[i].getVar("exposedValue"))
count = 0
if not clickableCounters then
for i = 1, 4 do
count = count + tonumber(clueCounters[i].getVar("exposedValue"))
end
else
for i = 1, 4 do
count = count + tonumber(clueClickers[i].getVar("val"))
end
end
self.editButton({ index = 0, label = tostring(count) })
end

View File

@ -679,7 +679,8 @@ end
---@param clickableCounter Boolean. Whether the clickable clue counter should be present
function clickableClues(clickableCounter)
local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)
local pos = self.positionToWorld({x = -1.03, y = 0.05, z = 0.69})
local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)
local clickerPos = CLUE_CLICKER.getPosition()
local clueCount = 0
if clickableCounter then
@ -689,26 +690,26 @@ function clickableClues(clickableCounter)
-- remove clues
CLUE_COUNTER.call("removeAllClues")
-- spawn clue counter
-- update master clue counter
-- set value for clue clickers
CLUE_CLICKER.call("updateVal", clueCount)
-- move clue counters up
clickerPos.y = 1.52
CLUE_CLICKER.setPosition(clickerPos)
else
-- current clue count
clueCount = CLUE_CLICKER.getVar("val")
-- remove clue counter
-- move clue counters down
clickerPos.y = 1.3
CLUE_CLICKER.setPosition(clickerPos)
-- spawn clues
local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})
for i = 1, clueCount do
pos.y = pos.y + 0.1 * i
pos.y = pos.y + 0.045 * i
spawnToken(pos, "clue")
end
-- rotation = {x= 0, y= PLAY_ZONE_ROTATION.y + 15, z =0 }
-- update master clue counter
end
end