Files
Nitrox/NitroxPatcher/Patches/Dynamic/SeaTreader_SetNextPathPoint_Patch.cs
2025-07-06 00:23:46 +02:00

24 lines
890 B
C#

using System.Reflection;
using NitroxClient.GameLogic;
using NitroxClient.GameLogic.Spawning.Metadata.Extractor;
using NitroxModel.DataStructures;
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
using NitroxModel.Helper;
namespace NitroxPatcher.Patches.Dynamic;
public sealed partial class SeaTreader_SetNextPathPoint_Patch : NitroxPatch, IDynamicPatch
{
internal static readonly MethodInfo TARGET_METHOD = Reflect.Method((SeaTreader t) => t.SetNextPathPoint());
public static void Postfix(SeaTreader __instance)
{
if (__instance.TryGetNitroxId(out NitroxId creatureId) &&
Resolve<SimulationOwnership>().HasAnyLockType(creatureId))
{
SeaTreaderMetadata metadata = Resolve<SeaTreaderMetadataExtractor>().Extract(__instance);
Resolve<Entities>().BroadcastMetadataUpdate(creatureId, metadata);
}
}
}