Renamed "OnUpdate" interface
Added OnUpdate example mod Expanded `OnUpdateOrder` options
This commit is contained in:
+7
-7
@@ -2,17 +2,17 @@
|
||||
using Core.Models.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace ExampleMods.Mods._8AddOnLoad
|
||||
namespace ExampleMods.Mods._8OnLoad
|
||||
{
|
||||
// Flag class as being OnLoad and give it a load priority, check `OnLoadOrder` for list of possible choices
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.PostSptDatabase)]
|
||||
[Injectable(InjectableTypeOverride = typeof(AddOnLoad))]
|
||||
public class AddOnLoad : IOnLoad // Must implement the IOnLoad interface
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.PostSptDatabase)] // Can also give an int value for fine-grained control
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoadExample))]
|
||||
public class OnLoadExample : IOnLoad // Must implement the IOnLoad interface
|
||||
{
|
||||
private readonly ISptLogger<AddOnLoad> _logger;
|
||||
private readonly ISptLogger<OnLoadExample> _logger;
|
||||
|
||||
public AddOnLoad(
|
||||
ISptLogger<AddOnLoad> logger)
|
||||
public OnLoadExample(
|
||||
ISptLogger<OnLoadExample> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"Name": "8AddOnLoad",
|
||||
"Name": "8OnLoadExample",
|
||||
"Version": "1.0.0",
|
||||
"SptVersion": "~4.0",
|
||||
"LoadBefore": [],
|
||||
@@ -0,0 +1,33 @@
|
||||
using Core.DI;
|
||||
using Core.Models.Utils;
|
||||
using SptCommon.Annotations;
|
||||
|
||||
namespace ExampleMods.Mods._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";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user