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
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>_6OverrideMethod</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>
@@ -0,0 +1,29 @@
using Core.Models.Utils;
using Core.Servers;
using Core.Services;
using Core.Utils;
using SptCommon.Annotations;
namespace _6OverrideMethod
{
[Injectable(InjectableTypeOverride = typeof(Watermark))]
public class OverrideMethod: Watermark
{
public OverrideMethod(
ISptLogger<Watermark> logger, // The logger needs to use the same type as the overriden type (in this case, Watermark)
ConfigServer configServer,
LocalisationService localisationService,
WatermarkLocale watermarkLocale)
: base(logger, configServer, localisationService, watermarkLocale) // You must provide the parameters the overridden type requires
{ }
public override void Initialize()
{
// We add a log message to the init method
_logger.Success("This is a watermark mod override!");
// This runs the original method (optional)
base.Initialize();
}
}
}
+13
View File
@@ -0,0 +1,13 @@
{
"Name": "6OverrideMethod",
"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"
}