From a68e8c71948e472855f1757b4f1c4bde15470198 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Sat, 20 Dec 2025 17:40:07 +0200 Subject: [PATCH] create DawnLib mod project, with a subdirectory layout - Mod Manager (Gale) > New Profile, name it "HookahPlace Test" - Install "DawnLib by TeamXiaolan v0.5.12" - Launch game once and close - Open profile folder, e.g. `C:\Users\user\AppData\Roaming\com.kesomannen.gale\lethal-company\profiles\HookahPlace Test\` $mod_dir = "C:\Users\user\AppData\Roaming\com.kesomannen.gale\lethal-company\profiles\HookahPlace Test\" dotnet new dawnlibmod ` -M Ratijas.HookahPlace ` -MM "$mod_dir\BepInEx\plugins\MMHOOK\Managed" ` -B "$mod_dir\BepInEx\plugins" ` --name HookahPlace dotnet sln HookahPlace.slnx add HookahPlace/HookahPlace.csproj rm HookahPlace/Thunderstore/icon.png --- HookahPlace.slnx | 1 + HookahPlace/HookahPlace.csproj | 89 +++++++++++++++++++ HookahPlace/HookahPlace.csproj.user.template | 30 +++++++ HookahPlace/README.md | 12 +++ HookahPlace/Thunderstore/CHANGELOG.md | 2 + HookahPlace/Thunderstore/thunderstore.toml | 34 +++++++ HookahPlace/res/ASSETBUNDLES HERE | 0 .../src/Content/ExampleContentHandler.cs | 13 +++ HookahPlace/src/HookahPlace.cs | 36 ++++++++ HookahPlace/src/HookahPlaceKeys.cs | 21 +++++ 10 files changed, 238 insertions(+) create mode 100644 HookahPlace/HookahPlace.csproj create mode 100644 HookahPlace/HookahPlace.csproj.user.template create mode 100644 HookahPlace/README.md create mode 100644 HookahPlace/Thunderstore/CHANGELOG.md create mode 100644 HookahPlace/Thunderstore/thunderstore.toml create mode 100644 HookahPlace/res/ASSETBUNDLES HERE create mode 100644 HookahPlace/src/Content/ExampleContentHandler.cs create mode 100644 HookahPlace/src/HookahPlace.cs create mode 100644 HookahPlace/src/HookahPlaceKeys.cs diff --git a/HookahPlace.slnx b/HookahPlace.slnx index ba788ff..cb581a0 100644 --- a/HookahPlace.slnx +++ b/HookahPlace.slnx @@ -1,2 +1,3 @@ + diff --git a/HookahPlace/HookahPlace.csproj b/HookahPlace/HookahPlace.csproj new file mode 100644 index 0000000..0798e29 --- /dev/null +++ b/HookahPlace/HookahPlace.csproj @@ -0,0 +1,89 @@ + + + + + Ratijas.HookahPlace + HookahPlace + + 1.0.0 + + + + netstandard2.1 + CRLib._ModTemplate + true + latest + + + + + enable + + + + + + https://api.nuget.org/v3/index.json; + https://nuget.bepinex.dev/v3/index.json; + https://nuget.windows10ce.com/nuget/v3/index.json + + + + + + $(NoWarn);CS0436 + + + + + true + embedded + + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./ + + + + 0.4.* + + + + + + + + + + + + + + + + + + + + + + $(MMHOOKDirectory)MMHOOK_Assembly-CSharp.dll + + + + + + + + + + 2022.3.62 + 1.12.0 + 1.0.0 + + + + + + diff --git a/HookahPlace/HookahPlace.csproj.user.template b/HookahPlace/HookahPlace.csproj.user.template new file mode 100644 index 0000000..1b05b60 --- /dev/null +++ b/HookahPlace/HookahPlace.csproj.user.template @@ -0,0 +1,30 @@ + + + + + .../Lethal Company/BepInEx/plugins/ + + + .../Lethal Comapny/BepInEx/plugins/MMHOOK/ + + + + + + + + + + + + + + + + + + + diff --git a/HookahPlace/README.md b/HookahPlace/README.md new file mode 100644 index 0000000..b59b1a7 --- /dev/null +++ b/HookahPlace/README.md @@ -0,0 +1,12 @@ +# TODO before release: +- `thunderstore.toml`: + - **Important**: Set `namespace` (this is your author name) and `description` + - Set `websiteUrl` + - Update `DawnLib` version + - Note that the name of your mod is determined by the name of the project, and the version is determined in your `.csproj` +- `.csproj`: + - Update `DawnLib` version +- `HookahPlaceKeys.cs`: + - Look in this file +- Update this README! (it gets used to generate your mods readme) +- Finally, build in the `Release` configuration to create the zip \ No newline at end of file diff --git a/HookahPlace/Thunderstore/CHANGELOG.md b/HookahPlace/Thunderstore/CHANGELOG.md new file mode 100644 index 0000000..6185211 --- /dev/null +++ b/HookahPlace/Thunderstore/CHANGELOG.md @@ -0,0 +1,2 @@ +# 1.0.0 +Inital release \ No newline at end of file diff --git a/HookahPlace/Thunderstore/thunderstore.toml b/HookahPlace/Thunderstore/thunderstore.toml new file mode 100644 index 0000000..72defb0 --- /dev/null +++ b/HookahPlace/Thunderstore/thunderstore.toml @@ -0,0 +1,34 @@ +[config] +schemaVersion = "0.0.1" + +[package] +namespace = "" +description = "" +websiteUrl = "" +containsNsfwContent = false +[package.dependencies] +BepInEx-BepInExPack = "5.4.2100" +TeamXiaolan-DawnLib = "0.4.0" + +[build] +icon = "./icon.png" +readme = "../README.md" +outdir = "../Packages" + +[[build.copy]] +source = "../bin/Release/netstandard2.1/Ratijas.HookahPlace.dll" +target = "BepInEx/plugins/HookahPlace/" + +[[build.copy]] +source = "../res" +target = "BepInEx/plugins/HookahPlace/Assets" + +[[build.copy]] +source = "./CHANGELOG.md" +target = "/" + +[publish] +repository = "https://thunderstore.io" +communities = [ "lethal-company", ] +[publish.categories] +lethal-company = [ "mods", "tools", "libraries", "clientside", "serverside" ] \ No newline at end of file diff --git a/HookahPlace/res/ASSETBUNDLES HERE b/HookahPlace/res/ASSETBUNDLES HERE new file mode 100644 index 0000000..e69de29 diff --git a/HookahPlace/src/Content/ExampleContentHandler.cs b/HookahPlace/src/Content/ExampleContentHandler.cs new file mode 100644 index 0000000..1fe0a70 --- /dev/null +++ b/HookahPlace/src/Content/ExampleContentHandler.cs @@ -0,0 +1,13 @@ +using Dawn; +using Dusk; + +namespace HookahPlace.Content; + +// REMOVE THIS FILE IF NOT USING DUSK +public class ExampleContentHandler : ContentHandler +{ + public ExampleContentHandler(DuskMod mod) : base(mod) + { + RegisterContent("content bundle name here", out DefaultBundle? bundle); + } +} \ No newline at end of file diff --git a/HookahPlace/src/HookahPlace.cs b/HookahPlace/src/HookahPlace.cs new file mode 100644 index 0000000..de984f9 --- /dev/null +++ b/HookahPlace/src/HookahPlace.cs @@ -0,0 +1,36 @@ +using BepInEx; +using BepInEx.Logging; +using System.Reflection; +using UnityEngine; +using Dawn; +using Dawn.Utils; + +namespace HookahPlace; + +[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)] +[BepInDependency(DawnLib.PLUGIN_GUID)] +public class HookahPlace : BaseUnityPlugin +{ + internal new static ManualLogSource Logger { get; private set; } = null!; + + internal static PersistentDataContainer PersistentData { get; private set; } = null!; + + + private void Awake() + { + Logger = base.Logger; + + // Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), MyPluginInfo.PLUGIN_GUID) // uncomment if using Harmony to patch + + + // Example Persistent Data Container Usage + // You can do anything you want with this DataContainer, there are a few additonal ones under the DawnLib class that pertain to actual save files + PersistentData = this.GetPersistentDataContainer(); + + // e.g. track the last version the player played with, could be useful if you want do to stuff like setting migration. + // if you want to do config migration you should use DawnLib.GetCurrentInstallSave instead. + PersistentData.Set(HookahPlaceKeys.LastVersion, MyPluginInfo.PLUGIN_VERSION); + + Logger.LogInfo($"{MyPluginInfo.PLUGIN_GUID} v{MyPluginInfo.PLUGIN_VERSION} has loaded!"); + } +} diff --git a/HookahPlace/src/HookahPlaceKeys.cs b/HookahPlace/src/HookahPlaceKeys.cs new file mode 100644 index 0000000..b2f44ba --- /dev/null +++ b/HookahPlace/src/HookahPlaceKeys.cs @@ -0,0 +1,21 @@ +using Dawn; + +namespace HookahPlace; + +// NamespacedKeys are a big component of how DawnLib works and tracks information, +// therefore you'll end up using quite a few of them +// +// To keep things organised, it's best practice to keep all your keys within a static class like this. +// So instead of doing NamespacedKey.From anywhere in your plugin, you should do it here. +// This way you only create one, and if you want to refactor the name to something, it's much easier. +// +// If you contain lots of keys, you might want to use child classes e.g: HookahPlaceKeys.Items.MyItem +// Note: the use of `partial` here is because of the DawnLib SourceGenerator, which you might not be using. +public static partial class HookahPlaceKeys { + // You may want to update this namespace. It should be "Snake case", e.g: FacilityMeltdown's namespace should be `facility_meltdown` + // You can also shorten it if you want, e.g: `meltdown` + public const string Namespace = "hookah_place"; + + // Data Keys + internal static NamespacedKey LastVersion = NamespacedKey.From(Namespace, "last_version"); +} \ No newline at end of file