Update Mods to be foldered/ own csproj/ ref dll

This commit is contained in:
CWX
2025-02-10 15:04:40 +00:00
parent ed54312f35
commit 7cd8ef9179
49 changed files with 361 additions and 121 deletions
+22
View File
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>_9OnUpdate</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- TODO: Change to Nuget Package -->
<ItemGroup>
<Reference Include="Core">
<HintPath>..\TempReferences\Core.dll</HintPath>
</Reference>
<Reference Include="SptCommon">
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
</Reference>
<Reference Include="SptDependencyInjection">
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
+33
View File
@@ -0,0 +1,33 @@
using Core.DI;
using Core.Models.Utils;
using SptCommon.Annotations;
namespace _9OnUpdate
{
// Flag class as being OnLoad and give it a load priority, check `OnLoadOrder` for list of possible choices
[Injectable(InjectableTypeOverride = typeof(IOnUpdate), TypePriority = OnUpdateOrder.PostSptUpdate)] // Can also give it an int value for more fine-grained control
[Injectable(InjectableTypeOverride = typeof(OnUpdateExample))]
public class OnUpdateExample : IOnUpdate // Must implement the IOnUpdate interface
{
private readonly ISptLogger<OnUpdateExample> _logger;
public OnUpdateExample(
ISptLogger<OnUpdateExample> logger)
{
_logger = logger;
}
public bool OnUpdate(long timeSinceLastRun)
{
// Can do work here
_logger.Success($"Mod running update after SPT updates have run!");
return true; // Return true for a success, false for failure
}
public string GetRoute()
{
return "mod-update-example";
}
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"Name": "9OnUpdateExample",
"Version": "1.0.0",
"SptVersion": "~4.0",
"LoadBefore": [],
"LoadAfter": [],
"IncompatibileMods": [],
"Url": "https://github.com/sp-tarkov/server-csharp/tree/develop/ExampleMods/Mods",
"IsBundleMod": false,
"Author": "SPT",
"Contributors": [],
"Licence": "MIT"
}