From d5d454e7e8cdbd76176c1e6c6e0b0ff9285359bd Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Sat, 26 Aug 2023 08:31:49 -0400 Subject: [PATCH 01/12] Needed changes --- .gitignore | 5 ++++- localization.tsv | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 localization.tsv diff --git a/.gitignore b/.gitignore index cbbd0b5..b9d5613 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ bin/ -obj/ \ No newline at end of file +obj/ +.vs/ +Icon Sources/ +*.user \ No newline at end of file diff --git a/localization.tsv b/localization.tsv new file mode 100644 index 0000000..6cf6fa8 --- /dev/null +++ b/localization.tsv @@ -0,0 +1 @@ +Term Notes English \ No newline at end of file From 5ab253322b1928aa7d4566ba22a09b39dca1998a Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Sun, 27 Aug 2023 04:56:37 -0400 Subject: [PATCH 02/12] Prevent copying examplemod.dll to the game. --- build.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.py b/build.py index 929983d..a9ef177 100644 --- a/build.py +++ b/build.py @@ -51,6 +51,11 @@ def sync_folder(src: Path, dst: Path): MOD_DLL = MOD_BIN / DLL_NAME MOD_PATH = MODS_ROOT / MOD_ID +# check dll has unique name +if DLL_NAME.lower() == "examplemod.dll": + print("Did you forget to rename the DLL in the project settings?") + exit(1); + # copy dll MOD_PATH.mkdir(exist_ok=True) shutil.copyfile(MOD_DLL, MOD_PATH / f"{DLL_NAME}") From b6dddd5264570c4f8fa46677be581535906aa641 Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Wed, 6 Sep 2023 18:21:35 -0400 Subject: [PATCH 03/12] more boilerplate --- Cards/sample_food.jsont | 12 ++++++++++++ Mod.cs | 8 ++++++++ Mod.csproj | 2 +- Mod.sln | 25 +++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Cards/sample_food.jsont create mode 100644 Mod.sln diff --git a/Cards/sample_food.jsont b/Cards/sample_food.jsont new file mode 100644 index 0000000..7f545c3 --- /dev/null +++ b/Cards/sample_food.jsont @@ -0,0 +1,12 @@ +{ + "id": "witchery_mushroom_soup", + "nameTerm": "witchery_mushroom_soup", + "descriptionTerm": "witchery_mushroom_soup_description", + "icon": "mushroom_soup.png", + "value": 6, + "type": "Food", + "script": "Food", + "_CanSpoil": false, + "_FoodValue": 5, + "_IsCookedFood": true +} \ No newline at end of file diff --git a/Mod.cs b/Mod.cs index 6f52f74..9792f50 100644 --- a/Mod.cs +++ b/Mod.cs @@ -7,6 +7,14 @@ namespace ExampleModNS { public class ExampleMod : Mod { + public static ExampleMod instance; + public static void Log(string msg) => instance.Logger.Log(msg); + private void Awake() + { + instance = this; + //Harmony.PatchAll(); + } + public override void Ready() { Logger.Log("Ready!"); diff --git a/Mod.csproj b/Mod.csproj index 3554c7d..51d308c 100644 --- a/Mod.csproj +++ b/Mod.csproj @@ -4,7 +4,7 @@ ExampleMod netstandard2.1 enable - enable + warnings latest diff --git a/Mod.sln b/Mod.sln new file mode 100644 index 0000000..46a8123 --- /dev/null +++ b/Mod.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34009.444 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mod", "Mod.csproj", "{EA19312D-028A-4EA2-BE2E-3BA011C67094}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EA19312D-028A-4EA2-BE2E-3BA011C67094}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA19312D-028A-4EA2-BE2E-3BA011C67094}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA19312D-028A-4EA2-BE2E-3BA011C67094}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA19312D-028A-4EA2-BE2E-3BA011C67094}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B2583325-9125-4EA6-BDCD-649E7979AE1B} + EndGlobalSection +EndGlobal From 03c3bf7ccde92f8de1cfaa2134fc86b030cae44c Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Wed, 6 Sep 2023 18:22:58 -0400 Subject: [PATCH 04/12] Update sample_food.jsont --- Cards/sample_food.jsont | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cards/sample_food.jsont b/Cards/sample_food.jsont index 7f545c3..194228d 100644 --- a/Cards/sample_food.jsont +++ b/Cards/sample_food.jsont @@ -1,8 +1,8 @@ { - "id": "witchery_mushroom_soup", - "nameTerm": "witchery_mushroom_soup", - "descriptionTerm": "witchery_mushroom_soup_description", - "icon": "mushroom_soup.png", + "id": "[mod]_[name]", + "nameTerm": "[mod]_[name]", + "descriptionTerm": "[mod]_[name]_description", + "icon": "[name].png", "value": 6, "type": "Food", "script": "Food", From 2938a193bf58ec7b2518dd4cb3a6e70970901db5 Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Mon, 11 Sep 2023 13:32:43 -0400 Subject: [PATCH 05/12] LogError --- Mod.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Mod.cs b/Mod.cs index 9792f50..d25be88 100644 --- a/Mod.cs +++ b/Mod.cs @@ -9,6 +9,7 @@ public class ExampleMod : Mod { public static ExampleMod instance; public static void Log(string msg) => instance.Logger.Log(msg); + public static void LogError(string msg) => instance.Logger.LogError(msg); private void Awake() { instance = this; From f2e78a758f8a1598ef9111799b4db5f6ab283555 Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Sat, 30 Sep 2023 03:04:19 -0400 Subject: [PATCH 06/12] first commit cleanup frequency fix Update README.md Revert "Update README.md" This reverts commit 35a1fda2c294b06942c3930994451cb855c0ebba. Revert "frequency fix" This reverts commit 0290ac2d1b3217bceba72e379ef52abc4be8aba8. Revert "cleanup" This reverts commit 50815c1978eae9d9b9a1b3dc2ebd764e890d62e1. Revert "first commit" This reverts commit 0e9481c5e6f16b3e9fdd9e71e02798ba8f5f7d2c. From 55afa97882fd3b01bf0da6846dce5647aef00029 Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Fri, 6 Oct 2023 20:12:06 -0400 Subject: [PATCH 07/12] Update build.py --- build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index a9ef177..0e28555 100644 --- a/build.py +++ b/build.py @@ -8,7 +8,7 @@ # ----- CONFIGURE THESE ----- SYNC_FOLDERS = ["Blueprints", "Boosterpacks", "Cards", "Icons", "Sounds"] # folders to be synced, such as Cards, Blueprints, Icons, etc. -COPY_FILES = ["manifest.json", "localization.tsv"] # individual files to copy, such as manifest.json, localization.tsv, etc. (the mod dll is copied automatically) +COPY_FILES = ["manifest.json", "localization.tsv", "workfile.txt", "icon.png"] # individual files to copy, such as manifest.json, localization.tsv, etc. (the mod dll is copied automatically) MODS_ROOT = Path(os.environ["userprofile"]) / Path("AppData/LocalLow/sokpop/Stacklands/Mods") # windows only, can be hardcoded with the below line instead # MODS_ROOT = Path("C:/Users/cyber/AppData/LocalLow/sokpop/Stacklands/Mods").resolve() @@ -38,7 +38,7 @@ def sync_folder(src: Path, dst: Path): if p.returncode != 0: print(stdout.decode()) exit(p.returncode) -print(f"built in {time.time() - start_time:.2f}s") +print(f"build started {time.strftime('%H:%I:%S', time.localtime(start_time))}, finished in {time.time() - start_time:.2f}s") # grab metadata found_csprojs = list(Path(".").glob("*.csproj")) From 2bfe9c9e755b1c8b889c099b0dfc10c818cfd773 Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Sun, 29 Oct 2023 16:04:09 -0400 Subject: [PATCH 08/12] added Common folder --- Mod.cs | 8 ++++++++ Mod.csproj | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Mod.cs b/Mod.cs index d25be88..7dad491 100644 --- a/Mod.cs +++ b/Mod.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using UnityEngine; +using CommonModNS; namespace ExampleModNS { @@ -10,9 +11,16 @@ public class ExampleMod : Mod public static ExampleMod instance; public static void Log(string msg) => instance.Logger.Log(msg); public static void LogError(string msg) => instance.Logger.LogError(msg); + private void Awake() { instance = this; + //WorldManagerPatches.LoadSaveRound += WM_OnLoad; + //WorldManagerPatches.GetSaveRound += WM_OnSave; + //WorldManagerPatches.StartNewRound += WM_OnNewGame; + //WorldManagerPatches.Play += WM_OnPlay; + //WorldManagerPatches.Update += WM_OnUpdate; + //WorldManagerPatches.ApplyPatches(Harmony); //Harmony.PatchAll(); } diff --git a/Mod.csproj b/Mod.csproj index 51d308c..60c0399 100644 --- a/Mod.csproj +++ b/Mod.csproj @@ -8,6 +8,14 @@ latest + + + + + + + + $(stacklands)/Stacklands_Data/Managed/0Harmony.dll @@ -70,4 +78,8 @@ False + + + + From c2f2c2a851516f4402b93cf8e420bf03d01ae170 Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Thu, 23 Nov 2023 11:21:35 -0500 Subject: [PATCH 09/12] Update build.py --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index 0e28555..8206fc1 100644 --- a/build.py +++ b/build.py @@ -8,7 +8,7 @@ # ----- CONFIGURE THESE ----- SYNC_FOLDERS = ["Blueprints", "Boosterpacks", "Cards", "Icons", "Sounds"] # folders to be synced, such as Cards, Blueprints, Icons, etc. -COPY_FILES = ["manifest.json", "localization.tsv", "workfile.txt", "icon.png"] # individual files to copy, such as manifest.json, localization.tsv, etc. (the mod dll is copied automatically) +COPY_FILES = ["manifest.json", "localization.tsv", "workshop.txt", "icon.png"] # individual files to copy, such as manifest.json, localization.tsv, etc. (the mod dll is copied automatically) MODS_ROOT = Path(os.environ["userprofile"]) / Path("AppData/LocalLow/sokpop/Stacklands/Mods") # windows only, can be hardcoded with the below line instead # MODS_ROOT = Path("C:/Users/cyber/AppData/LocalLow/sokpop/Stacklands/Mods").resolve() From 99e319c492fa3f81cca9d997814abf45735b58b8 Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Sun, 24 Dec 2023 05:52:31 -0500 Subject: [PATCH 10/12] Update build.py --- build.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build.py b/build.py index 8206fc1..4bebdfd 100644 --- a/build.py +++ b/build.py @@ -7,14 +7,14 @@ import json # ----- CONFIGURE THESE ----- +COMMON = ["CommonNS.tsv"] SYNC_FOLDERS = ["Blueprints", "Boosterpacks", "Cards", "Icons", "Sounds"] # folders to be synced, such as Cards, Blueprints, Icons, etc. -COPY_FILES = ["manifest.json", "localization.tsv", "workshop.txt", "icon.png"] # individual files to copy, such as manifest.json, localization.tsv, etc. (the mod dll is copied automatically) +COPY_FILES = ["manifest.json", "*.tsv", "workshop.txt", "icon.png"] # individual files to copy, such as manifest.json, localization.tsv, etc. (the mod dll is copied automatically) MODS_ROOT = Path(os.environ["userprofile"]) / Path("AppData/LocalLow/sokpop/Stacklands/Mods") # windows only, can be hardcoded with the below line instead # MODS_ROOT = Path("C:/Users/cyber/AppData/LocalLow/sokpop/Stacklands/Mods").resolve() MOD_BIN = Path("./bin/Debug/netstandard2.1").resolve() - def sync_folder(src: Path, dst: Path): for file in dst.glob("**/*"): file_in_src = src / file.relative_to(dst) @@ -38,7 +38,7 @@ def sync_folder(src: Path, dst: Path): if p.returncode != 0: print(stdout.decode()) exit(p.returncode) -print(f"build started {time.strftime('%H:%I:%S', time.localtime(start_time))}, finished in {time.time() - start_time:.2f}s") +print(f"build started {time.strftime('%H:%M:%S', time.localtime(start_time))}, finished in {time.time() - start_time:.2f}s") # grab metadata found_csprojs = list(Path(".").glob("*.csproj")) @@ -60,15 +60,21 @@ def sync_folder(src: Path, dst: Path): MOD_PATH.mkdir(exist_ok=True) shutil.copyfile(MOD_DLL, MOD_PATH / f"{DLL_NAME}") +for file in COMMON: + shutil.copyfile(f"../stacklands-common/{file}", f"./{file}") + # copy files for file in COPY_FILES: - try: - shutil.copyfile(file, MOD_PATH / file) - except FileNotFoundError: - print(f"No such file: '{file}'") + for f in Path(".").glob(file): + try: + shutil.copyfile(f, MOD_PATH / f) + except FileNotFoundError: + print(f"No such file: '{f}'") + +for file in COMMON: + os.remove(f"./{file}") # copy folders print("syncing folders..") for folder in SYNC_FOLDERS: sync_folder(Path(folder), MOD_PATH / folder) - From d93038f5e0245ee90078bf7140186ce7dde81bf0 Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Sat, 13 Jan 2024 05:20:08 -0500 Subject: [PATCH 11/12] bbcode --- build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index 4bebdfd..4591fc8 100644 --- a/build.py +++ b/build.py @@ -1,3 +1,4 @@ +from genericpath import isfile import os import shutil import subprocess @@ -9,7 +10,7 @@ # ----- CONFIGURE THESE ----- COMMON = ["CommonNS.tsv"] SYNC_FOLDERS = ["Blueprints", "Boosterpacks", "Cards", "Icons", "Sounds"] # folders to be synced, such as Cards, Blueprints, Icons, etc. -COPY_FILES = ["manifest.json", "*.tsv", "workshop.txt", "icon.png"] # individual files to copy, such as manifest.json, localization.tsv, etc. (the mod dll is copied automatically) +COPY_FILES = ["manifest.json", "*.tsv", "../stacklands-commonmod/*.tsv", "workshop.txt", "icon.png"] # individual files to copy, such as manifest.json, localization.tsv, etc. (the mod dll is copied automatically) MODS_ROOT = Path(os.environ["userprofile"]) / Path("AppData/LocalLow/sokpop/Stacklands/Mods") # windows only, can be hardcoded with the below line instead # MODS_ROOT = Path("C:/Users/cyber/AppData/LocalLow/sokpop/Stacklands/Mods").resolve() @@ -78,3 +79,9 @@ def sync_folder(src: Path, dst: Path): print("syncing folders..") for folder in SYNC_FOLDERS: sync_folder(Path(folder), MOD_PATH / folder) + +# run bb.cmd +if os.path.isfile("README.md"): + if not os.path.isfile("README.bbcode") or os.path.getmtime('README.md') > os.path.getmtime('README.bbcode'): + print("Updating bbcode file") + subprocess.call("..\MarkdownToSteam.exe -i README.md -o README.bbcode") From efbae6c9f3770466893b7c0926e8661897f33bbf Mon Sep 17 00:00:00 2001 From: Joe Mucchiello Date: Sat, 13 Jan 2024 05:27:27 -0500 Subject: [PATCH 12/12] Update Mod.csproj --- Mod.csproj | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Mod.csproj b/Mod.csproj index 60c0399..c3d49bc 100644 --- a/Mod.csproj +++ b/Mod.csproj @@ -11,6 +11,7 @@ + @@ -78,8 +79,4 @@ False - - - -