mirror of
https://github.com/rmroc451/TweaksAndThings.git
synced 2025-12-17 01:39:38 -06:00
2.0.0 feature updates
This commit is contained in:
34
TweaksAndThings/Patches/NoticeExtensions_PostNotice_Patch.cs
Normal file
34
TweaksAndThings/Patches/NoticeExtensions_PostNotice_Patch.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Game.Notices;
|
||||
using HarmonyLib;
|
||||
using Model;
|
||||
using Serilog;
|
||||
using System;
|
||||
|
||||
namespace RMROC451.TweaksAndThings.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(NoticeExtensions))]
|
||||
[HarmonyPatch(nameof(NoticeExtensions.PostNotice), typeof(Car), typeof(string), typeof(string))]
|
||||
[HarmonyPatchCategory("RMROC451TweaksAndThings")]
|
||||
internal class NoticeExtensions_PostNotice_Patch
|
||||
{
|
||||
private static ILogger _log => Log.ForContext<NoticeExtensions_PostNotice_Patch>();
|
||||
static void Postfix(Car car, string key, string content)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
//Log.Information($"{car.DisplayName} patch PostNotice");
|
||||
if (!string.IsNullOrEmpty(content) &&
|
||||
key.Equals("ai-wpt") &&
|
||||
content.ToLower().Contains("Arrived at Waypoint".ToLower())
|
||||
)
|
||||
{
|
||||
car.PostNotice("ai-wpt-rmroc451", null);
|
||||
}
|
||||
} catch (Exception ex)
|
||||
{
|
||||
_log.ForContext("car", car).Error(ex, "woops");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user