diff --git a/config.json b/config.json index 46a7d5dd..c28dcada 100644 --- a/config.json +++ b/config.json @@ -60,7 +60,7 @@ "Custom_Tile.2eca7c", "Custom_Tile.fb09d4", "3DText.65eb7e", - "setactiveinvestigators.f182ee", + "InvestigatorCount.f182ee", "ScriptingTrigger.c506bf", "ScriptingTrigger.cbc751", "ScriptingTrigger.57c22c", diff --git a/objects/Clues.3f22e5.json b/objects/Clues.3f22e5.json index 6004bd57..17a50489 100644 --- a/objects/Clues.3f22e5.json +++ b/objects/Clues.3f22e5.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Clues.4111de.json b/objects/Clues.4111de.json index 4240b00d..efe2d1a7 100644 --- a/objects/Clues.4111de.json +++ b/objects/Clues.4111de.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Clues.891403.json b/objects/Clues.891403.json index 2db17e40..d7dfcd22 100644 --- a/objects/Clues.891403.json +++ b/objects/Clues.891403.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Clues.db85d6.json b/objects/Clues.db85d6.json index 5d024ad5..902a38f5 100644 --- a/objects/Clues.db85d6.json +++ b/objects/Clues.db85d6.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Damage.1f5a0a.json b/objects/Damage.1f5a0a.json index 43b01ca0..b97d7fd8 100644 --- a/objects/Damage.1f5a0a.json +++ b/objects/Damage.1f5a0a.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Damage.591a45.json b/objects/Damage.591a45.json index de4a7ec4..41937170 100644 --- a/objects/Damage.591a45.json +++ b/objects/Damage.591a45.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Damage.e64eec.json b/objects/Damage.e64eec.json index b139388e..1ea4da6b 100644 --- a/objects/Damage.e64eec.json +++ b/objects/Damage.e64eec.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Damage.eb08d6.json b/objects/Damage.eb08d6.json index a2cb8816..3e461e08 100644 --- a/objects/Damage.eb08d6.json +++ b/objects/Damage.eb08d6.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Horror.0257d9.json b/objects/Horror.0257d9.json index e6657372..6a9ab31a 100644 --- a/objects/Horror.0257d9.json +++ b/objects/Horror.0257d9.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Horror.468e88.json b/objects/Horror.468e88.json index 256b9c3a..cdda908d 100644 --- a/objects/Horror.468e88.json +++ b/objects/Horror.468e88.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Horror.7b5729.json b/objects/Horror.7b5729.json index 0b0509b0..ba06284c 100644 --- a/objects/Horror.7b5729.json +++ b/objects/Horror.7b5729.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Horror.beb964.json b/objects/Horror.beb964.json index 6c3e6c49..39d68205 100644 --- a/objects/Horror.beb964.json +++ b/objects/Horror.beb964.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/setactiveinvestigators.f182ee.json b/objects/InvestigatorCount.f182ee.json similarity index 93% rename from objects/setactiveinvestigators.f182ee.json rename to objects/InvestigatorCount.f182ee.json index 0802d1d2..218ede08 100644 --- a/objects/setactiveinvestigators.f182ee.json +++ b/objects/InvestigatorCount.f182ee.json @@ -34,10 +34,10 @@ "LayoutGroupSortIndex": 0, "Locked": true, "LuaScript": "require(\"core/ActiveInvestigatorCounter\")", - "LuaScriptState": "[true,2]", + "LuaScriptState": "2", "MeasureMovement": false, "Name": "Custom_Token", - "Nickname": "set active investigators\n", + "Nickname": "Investigator Count", "Snap": true, "Sticky": true, "Tooltip": true, @@ -54,4 +54,4 @@ }, "Value": 0, "XmlUI": "" -} +} \ No newline at end of file diff --git a/objects/Resources.4406f0.json b/objects/Resources.4406f0.json index 5329df96..d3ca7508 100644 --- a/objects/Resources.4406f0.json +++ b/objects/Resources.4406f0.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "5", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Resources.816d84.json b/objects/Resources.816d84.json index eadba42d..d95532fe 100644 --- a/objects/Resources.816d84.json +++ b/objects/Resources.816d84.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "5", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Resources.a4b60d.json b/objects/Resources.a4b60d.json index 2acfa04c..bfbec567 100644 --- a/objects/Resources.a4b60d.json +++ b/objects/Resources.a4b60d.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "5", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/objects/Resources.cd15ac.json b/objects/Resources.cd15ac.json index eeafff2b..d232153d 100644 --- a/objects/Resources.cd15ac.json +++ b/objects/Resources.cd15ac.json @@ -33,7 +33,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "require(\"playermat/GenericCounter\")", + "LuaScript": "require(\"core/GenericCounter\")", "LuaScriptState": "5", "MeasureMovement": false, "Name": "Custom_Token", diff --git a/src/core/ActiveInvestigatorCounter.ttslua b/src/core/ActiveInvestigatorCounter.ttslua index c6ef982b..e075d01e 100644 --- a/src/core/ActiveInvestigatorCounter.ttslua +++ b/src/core/ActiveInvestigatorCounter.ttslua @@ -1,134 +1,3 @@ -DEBUG = false +require("core/GenericCounter") MIN_VALUE = 1 MAX_VALUE = 4 - -function onload(saved_data) - self.interactable = DEBUG - light_mode = false - val = 0 - - if saved_data ~= "" then - local loaded_data = JSON.decode(saved_data) - light_mode = loaded_data[1] - val = loaded_data[2] - end - - createAll() -end - -function updateSave() - local data_to_save = {light_mode, val} - saved_data = JSON.encode(data_to_save) - self.script_state = saved_data -end - -function createAll() - s_color = {0.5, 0.5, 0.5, 95} - - if light_mode then - f_color = {1,1,1,95} - else - f_color = {0,0,0,100} - end - - - - self.createButton({ - label=tostring(val), - click_function="add_subtract", - function_owner=self, - position={0,0.05,0}, - height=600, - width=1000, - alignment = 3, - scale={x=1.5, y=1.5, z=1.5}, - font_size=600, - font_color=f_color, - color={0,0,0,0} - }) - - - - - if light_mode then - lightButtonText = "[ Set dark ]" - else - lightButtonText = "[ Set light ]" - end - -end - -function removeAll() - self.removeInput(0) - self.removeInput(1) - self.removeButton(0) - self.removeButton(1) - self.removeButton(2) -end - -function reloadAll() - removeAll() - createAll() - - updateSave() -end - -function swap_fcolor(_obj, _color, alt_click) - light_mode = not light_mode - reloadAll() -end - -function swap_align(_obj, _color, alt_click) - center_mode = not center_mode - reloadAll() -end - -function editName(_obj, _string, value) - self.setName(value) - setTooltips() -end - -function add_subtract(_obj, _color, alt_click) - mod = alt_click and -1 or 1 - new_value = math.min(math.max(val + mod, MIN_VALUE), MAX_VALUE) - if val ~= new_value then - val = new_value - updateVal() - updateSave() - end -end - -function updateVal() - - self.editButton({ - index = 0, - label = tostring(val), - - }) -end - -function reset_val() - val = 0 - updateVal() - updateSave() -end - -function setTooltips() - self.editInput({ - index = 0, - value = self.getName(), - tooltip = ttText - }) - self.editButton({ - index = 0, - value = tostring(val), - tooltip = ttText - }) -end - -function null() -end - -function keepSample(_obj, _string, value) - reloadAll() -end diff --git a/src/playermat/GenericCounter.ttslua b/src/core/GenericCounter.ttslua similarity index 100% rename from src/playermat/GenericCounter.ttslua rename to src/core/GenericCounter.ttslua