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
This commit is contained in:
parent
2f01c498a1
commit
a68e8c7194
|
|
@ -1,2 +1,3 @@
|
||||||
<Solution>
|
<Solution>
|
||||||
|
<Project Path="HookahPlace/HookahPlace.csproj" />
|
||||||
</Solution>
|
</Solution>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<!-- BepInEx Properties -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyName>Ratijas.HookahPlace</AssemblyName>
|
||||||
|
<Product>HookahPlace</Product>
|
||||||
|
<!-- Change to whatever version you're currently on. -->
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
</PropertyGroup>
|
||||||
|
<!-- Project Properties -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
|
<RootNamespace>CRLib._ModTemplate</RootNamespace>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Enable Nullable for better IDE null-checking -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Set NuGet Sources -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<RestoreAdditionalProjectSources>
|
||||||
|
https://api.nuget.org/v3/index.json;
|
||||||
|
https://nuget.bepinex.dev/v3/index.json;
|
||||||
|
https://nuget.windows10ce.com/nuget/v3/index.json <!-- This source lets you reference mods from thunderstore if they aren't on NuGet -->
|
||||||
|
</RestoreAdditionalProjectSources>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Disable Publicizer Warnings -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<NoWarn>$(NoWarn);CS0436</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Embed Debug Symbols for Easier Debugging -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
|
<!--
|
||||||
|
Trim the project path to prevent players from potentially
|
||||||
|
viewing Private Information in stack traces.
|
||||||
|
-->
|
||||||
|
<PathMap>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./</PathMap>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<DawnLibVersion>0.4.*</DawnLibVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Primary Package References - BepInEx -->
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all"/>
|
||||||
|
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all"/>
|
||||||
|
<PackageReference Include="BepInEx.Core" Version="5.*" PrivateAssets="all"/>
|
||||||
|
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" PrivateAssets="all"/>
|
||||||
|
<PackageReference Include="LethalCompany.GameLibs.Steam" Version="*-*" PrivateAssets="all"/>
|
||||||
|
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" PrivateAssets="all"/>
|
||||||
|
<PackageReference Include="TeamXiaolan.DawnLib" Version="$(DawnLibVersion)" PrivateAssets="all"/>
|
||||||
|
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||||
|
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Package References - Game Assembly HookGen -->
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="MMHOOK_Assembly-CSharp">
|
||||||
|
<HintPath>$(MMHOOKDirectory)MMHOOK_Assembly-CSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<!-- Netcode Patcher Post-Build Event -->
|
||||||
|
<Sdk Name="Evaisa.NetcodePatcher.MSBuild" Version="4.4.1" />
|
||||||
|
<ItemGroup>
|
||||||
|
<NetcodePatch Include="$(TargetPath)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<NetcodePatcherUnityVersion>2022.3.62</NetcodePatcherUnityVersion>
|
||||||
|
<NetcodePatcherNetcodeVersion>1.12.0</NetcodePatcherNetcodeVersion>
|
||||||
|
<NetcodePatcherTransportVersion>1.0.0</NetcodePatcherTransportVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Target Name="PackThunderstore" DependsOnTargets="NetcodePatch" AfterTargets="PostBuildEvent" Condition="$(Configuration) == 'Release'">
|
||||||
|
<Exec Command="tcli build --config-path "$(ProjectDir)Thunderstore/thunderstore.toml" --package-version $(Version) --package-name $(Product)" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<Project>
|
||||||
|
<!-- Custom Variables -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<!--#if (BepInExPluginLocation != "") -->
|
||||||
|
<CopyToDirectory>.../Lethal Company/BepInEx/plugins/</CopyToDirectory>
|
||||||
|
<!--#endif -->
|
||||||
|
<!--#if (MMHOOKLocation != "") -->
|
||||||
|
<MMHOOKDirectory>.../Lethal Comapny/BepInEx/plugins/MMHOOK/</MMHOOKDirectory>
|
||||||
|
<!--#endif -->
|
||||||
|
</PropertyGroup>
|
||||||
|
<!--#if (BepInExPluginLocation != "") -->
|
||||||
|
|
||||||
|
<!-- Copy to Plugin Directory for Quicker Testing -->
|
||||||
|
<!--#if (UseNetcodePatcher) -->
|
||||||
|
<Target Name="CopyFiles" DependsOnTargets="NetcodePatch" AfterTargets="PostBuildEvent">
|
||||||
|
<MakeDir
|
||||||
|
Directories="$(CopyToDirectory)$(Product)-DEV/Assets"
|
||||||
|
Condition="!Exists('$(CopyToDirectory)$(Product)-DEV/Assets')"
|
||||||
|
/>
|
||||||
|
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(CopyToDirectory)$(Product)-DEV"/>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<AssetBundles Include="$(ProjectDir)res/*" />
|
||||||
|
<AssetBundles Remove="$(ProjectDir)res/*.meta" />
|
||||||
|
<Assetbundles Remove="$(ProjectDir)res/*.manifest" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Copy SourceFiles="@(AssetBundles)" DestinationFolder="$(CopyToDirectory)$(Product)-DEV/Assets/"/>
|
||||||
|
</Target>
|
||||||
|
<!--#endif -->
|
||||||
|
</Project>
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
# 1.0.0
|
||||||
|
Inital release
|
||||||
|
|
@ -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" ]
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
using Dawn;
|
||||||
|
using Dusk;
|
||||||
|
|
||||||
|
namespace HookahPlace.Content;
|
||||||
|
|
||||||
|
// REMOVE THIS FILE IF NOT USING DUSK
|
||||||
|
public class ExampleContentHandler : ContentHandler<ExampleContentHandler>
|
||||||
|
{
|
||||||
|
public ExampleContentHandler(DuskMod mod) : base(mod)
|
||||||
|
{
|
||||||
|
RegisterContent("content bundle name here", out DefaultBundle? bundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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");
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue