Renamed "OnUpdate" interface

Added OnUpdate example mod

Expanded `OnUpdateOrder` options
This commit is contained in:
Chomp
2025-02-08 12:29:56 +00:00
parent ac7b2daeba
commit c9c1af653b
12 changed files with 70 additions and 22 deletions
@@ -8,7 +8,7 @@ using SptCommon.Annotations;
namespace Core.Callbacks;
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.DialogueCallbacks)]
[Injectable(InjectableTypeOverride = typeof(IOnUpdate), TypePriority = OnUpdateOrder.DialogueCallbacks)]
[Injectable(InjectableTypeOverride = typeof(DialogueCallbacks))]
public class DialogueCallbacks(
HashUtil _hashUtil,
@@ -16,7 +16,7 @@ public class DialogueCallbacks(
HttpResponseUtil _httpResponseUtil,
DialogueController _dialogueController
)
: OnUpdate
: IOnUpdate
{
public bool OnUpdate(long timeSinceLastRun)
{
+2 -2
View File
@@ -9,12 +9,12 @@ using SptCommon.Annotations;
namespace Core.Callbacks;
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.HideoutCallbacks)]
[Injectable(InjectableTypeOverride = typeof(IOnUpdate), TypePriority = OnUpdateOrder.HideoutCallbacks)]
[Injectable(InjectableTypeOverride = typeof(HideoutCallbacks))]
public class HideoutCallbacks(
HideoutController _hideoutController,
ConfigServer _configServer
) : OnUpdate
) : IOnUpdate
{
private readonly HideoutConfig _hideoutConfig = _configServer.GetConfig<HideoutConfig>();
@@ -11,7 +11,7 @@ using SptCommon.Annotations;
namespace Core.Callbacks;
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.InsuranceCallbacks)]
[Injectable(InjectableTypeOverride = typeof(IOnUpdate), TypePriority = OnUpdateOrder.InsuranceCallbacks)]
[Injectable(InjectableTypeOverride = typeof(InsuranceCallbacks))]
public class InsuranceCallbacks(
InsuranceController _insuranceController,
@@ -19,7 +19,7 @@ public class InsuranceCallbacks(
HttpResponseUtil _httpResponseUtil,
ConfigServer _configServer
)
: OnUpdate
: IOnUpdate
{
private readonly InsuranceConfig _insuranceConfig = _configServer.GetConfig<InsuranceConfig>();
+2 -2
View File
@@ -12,7 +12,7 @@ using SptCommon.Annotations;
namespace Core.Callbacks;
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.RagfairCallbacks)]
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.RagfairCallbacks)]
[Injectable(InjectableTypeOverride = typeof(IOnUpdate), TypePriority = OnUpdateOrder.RagfairCallbacks)]
[Injectable(InjectableTypeOverride = typeof(RagfairCallbacks))]
public class RagfairCallbacks(
HttpResponseUtil _httpResponseUtil,
@@ -21,7 +21,7 @@ public class RagfairCallbacks(
RagfairTaxService _ragfairTaxService,
RagfairPriceService _ragfairPriceService,
ConfigServer _configServer
) : IOnLoad, OnUpdate
) : IOnLoad, IOnUpdate
{
private readonly RagfairConfig _ragfairConfig = _configServer.GetConfig<RagfairConfig>();
+2 -2
View File
@@ -7,13 +7,13 @@ using SptCommon.Annotations;
namespace Core.Callbacks;
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.SaveCallbacks)]
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.SaveCallbacks)]
[Injectable(InjectableTypeOverride = typeof(IOnUpdate), TypePriority = OnUpdateOrder.SaveCallbacks)]
public class SaveCallbacks(
SaveServer _saveServer,
ConfigServer _configServer,
BackupService _backupService
)
: IOnLoad, OnUpdate
: IOnLoad, IOnUpdate
{
private readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
+2 -2
View File
@@ -9,13 +9,13 @@ using SptCommon.Annotations;
namespace Core.Callbacks;
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.TraderCallbacks)]
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.TraderCallbacks)]
[Injectable(InjectableTypeOverride = typeof(IOnUpdate), TypePriority = OnUpdateOrder.TraderCallbacks)]
[Injectable(InjectableTypeOverride = typeof(TraderCallbacks))]
public class TraderCallbacks(
HttpResponseUtil _httpResponseUtil,
TraderController _traderController,
ConfigServer _configServer
) : IOnLoad, OnUpdate
) : IOnLoad, IOnUpdate
{
private readonly TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
@@ -1,6 +1,6 @@
namespace Core.DI;
public interface OnUpdate
public interface IOnUpdate
{
bool OnUpdate(long timeSinceLastRun);
string GetRoute();
+3 -1
View File
@@ -2,10 +2,12 @@ namespace Core.DI;
public static class OnUpdateOrder
{
public const int DialogueCallbacks = 0;
public const int PreSptUpdate = 0;
public const int DialogueCallbacks = 1;
public const int HideoutCallbacks = 100;
public const int TraderCallbacks = 200;
public const int RagfairCallbacks = 300;
public const int InsuranceCallbacks = 400;
public const int SaveCallbacks = 500;
public const int PostSptUpdate = 9999;
}