first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
using System.Reflection;
using NitroxClient.GameLogic;
using NitroxClient.GameLogic.Spawning.Metadata.Extractor;
using NitroxModel.DataStructures;
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
using NitroxModel.DataStructures.Util;
using NitroxModel.Helper;
namespace NitroxPatcher.Patches.Dynamic;
/// <summary>
/// Syncs metadata when a fish changes its breeding state if the local player is simulating the said fish.
/// </summary>
public sealed partial class WaterParkCreature_ResetBreedTime_Patch : NitroxPatch, IDynamicPatch
{
public static readonly MethodInfo TARGET_METHOD = Reflect.Method((WaterParkCreature t) => t.ResetBreedTime());
public static void Postfix(WaterParkCreature __instance)
{
if (!__instance.TryGetNitroxId(out NitroxId creatureId) ||
!Resolve<SimulationOwnership>().HasAnyLockType(creatureId))
{
return;
}
Optional<WaterParkCreatureMetadata> metadata = Resolve<WaterParkCreatureMetadataExtractor>().Extract(__instance);
if (metadata.HasValue)
{
Resolve<Entities>().BroadcastMetadataUpdate(creatureId, metadata.Value);
}
}
}