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/Cards/sample_food.jsont b/Cards/sample_food.jsont
new file mode 100644
index 0000000..194228d
--- /dev/null
+++ b/Cards/sample_food.jsont
@@ -0,0 +1,12 @@
+{
+ "id": "[mod]_[name]",
+ "nameTerm": "[mod]_[name]",
+ "descriptionTerm": "[mod]_[name]_description",
+ "icon": "[name].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..7dad491 100644
--- a/Mod.cs
+++ b/Mod.cs
@@ -2,11 +2,28 @@
using System;
using System.Collections;
using UnityEngine;
+using CommonModNS;
namespace ExampleModNS
{
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();
+ }
+
public override void Ready()
{
Logger.Log("Ready!");
diff --git a/Mod.csproj b/Mod.csproj
index 3554c7d..c3d49bc 100644
--- a/Mod.csproj
+++ b/Mod.csproj
@@ -4,10 +4,19 @@
ExampleMod
netstandard2.1
enable
- enable
+ warnings
latest
+
+
+
+
+
+
+
+
+
$(stacklands)/Stacklands_Data/Managed/0Harmony.dll
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
diff --git a/build.py b/build.py
index 929983d..4591fc8 100644
--- a/build.py
+++ b/build.py
@@ -1,3 +1,4 @@
+from genericpath import isfile
import os
import shutil
import subprocess
@@ -7,14 +8,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"] # 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()
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 +39,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:%M:%S', time.localtime(start_time))}, finished in {time.time() - start_time:.2f}s")
# grab metadata
found_csprojs = list(Path(".").glob("*.csproj"))
@@ -51,19 +52,36 @@ 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}")
+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)
+# 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")
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