diff --git a/src/RealTime/Core/RealTimeCore.cs b/src/RealTime/Core/RealTimeCore.cs index 581230220cfee045bf688711bf18722bfbed5af0..8f38e2c9fc8be0c03ef5e739c3e8ad659b12b22c 100644 --- a/src/RealTime/Core/RealTimeCore.cs +++ b/src/RealTime/Core/RealTimeCore.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) dymanoid. All rights reserved. // @@ -309,6 +309,7 @@ namespace RealTime.Core BuildingAIPatch.GetColor, BuildingAIPatch.CalculateUnspawnPosition, BuildingAIPatch.ProduceGoods, + BuildingAIPatch.TrySpawnBoot, ResidentAIPatch.Location, ResidentAIPatch.ArriveAtTarget, ResidentAIPatch.StartMoving, diff --git a/src/RealTime/GameConnection/Patches/BuildingAIPatch.cs b/src/RealTime/GameConnection/Patches/BuildingAIPatch.cs index 6b80fd337b6b3bf141f8ca7e2e1435bd90a41658..8e445b8cd7f852fe8d8a7857f3fd982599ba0705 100644 --- a/src/RealTime/GameConnection/Patches/BuildingAIPatch.cs +++ b/src/RealTime/GameConnection/Patches/BuildingAIPatch.cs @@ -47,6 +47,9 @@ namespace RealTime.GameConnection.Patches /// Gets the patch for the building AI method 'ProduceGoods'. public static IPatch ProduceGoods { get; } = new PlayerBuildingAI_ProduceGoods(); + /// Gets the patch for the fishing harbor AI method 'TrySpawnBoot'. + public static IPatch TrySpawnBoot { get; } = new FishingHarborAI_TrySpawnBoat(); + private sealed class CommercialBuildingA_SimulationStepActive : PatchBase { protected override MethodInfo GetMethod() => @@ -340,5 +343,19 @@ namespace RealTime.GameConnection.Patches } } } + + private sealed class FishingHarborAI_TrySpawnBoat : PatchBase + { + protected override MethodInfo GetMethod() => + typeof(FishingHarborAI).GetMethod( + nameof(FishingHarborAI.TrySpawnBoat), + BindingFlags.Instance | BindingFlags.Public, + null, + new[] { typeof(ushort), typeof(Building).MakeByRefType() }, + new ParameterModifier[0]); + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1213", Justification = "Harmony patch")] + private static bool Prefix(ref Building buildingData) => (buildingData.m_flags & Building.Flags.Active) != 0; + } } }