Fixed plants clipping against vertical hydroponics, clarified fishery version message further

This commit is contained in:
bbradson
2024-04-28 23:05:56 +02:00
parent 052425a1f0
commit 1ca55fc7b8
7 changed files with 20 additions and 19 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -4,7 +4,7 @@
<RootNamespace>PerformanceFish</RootNamespace>
<AssemblyName>PerformanceFish</AssemblyName>
<Authors>bradson</Authors>
<Version>0.6.1.0</Version>
<Version>0.6.1.1</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<TargetFramework>net48</TargetFramework>
<LangVersion>preview</LangVersion>
@@ -101,12 +101,7 @@ public static class ActiveMods
}
private static void CheckFisheryVersion()
{
if (FisheryLib.FisheryLib.VERSION > FisheryLib.FisheryLib.CurrentlyLoadedVersion)
ErrorForOutdatedModDependency(nameof(Fishery));
else
CheckDependencyVersion(nameof(Fishery), typeof(FisheryLib.FisheryLib), "1Fishery");
}
=> CheckDependencyVersion(nameof(Fishery), typeof(FisheryLib.FisheryLib), "1Fishery");
private static void CheckHarmonyVersion()
=> CheckDependencyVersion(nameof(Harmony), typeof(Harmony), "0Harmony");
@@ -165,10 +160,6 @@ public static class ActiveMods
return firstFoundAssemblyDir ?? "Unknown";
}
private static void ErrorForOutdatedModDependency(string modName)
=> Log.Error($"Outdated {modName} mod detected. {
modName} must be updated for Performance Fish to work correctly");
private static void ThrowForMissingModDependency(string modName)
{
Log.Error($"{modName} mod is missing. Performance Fish requires this mod in order to function.");
@@ -99,11 +99,11 @@ public sealed class PrintImprovements : ClassWithFishPrepatches
if (printPlaneIndex < 0)
{
throw new InvalidOperationException(
ThrowHelper.ThrowInvalidOperationException(
"Failed to find center variable load instruction for PrintPlane call");
}
ilProcessor.InsertAt(printPlaneIndex + 1, (OpCodes.Call, methodof(AdjustCenter)));
ilProcessor.InsertRange(printPlaneIndex + 1, OpCodes.Ldarg_0, (OpCodes.Call, methodof(AdjustCenter)));
}
finally
{
@@ -111,10 +111,20 @@ public sealed class PrintImprovements : ClassWithFishPrepatches
}
}
public static Vector3 AdjustCenter(Vector3 center)
public static Vector3 AdjustCenter(Vector3 center, Plant plant)
{
if (Math.Abs(center.y - LowPlantAltitude) <= 0.001f)
center.y += 0.005f;
if (Math.Abs(center.y - LowPlantAltitude) > 0.001f)
return center;
var plantPosition = plant.PositionHeld;
var map = plant.MapHeld;
if (map.edificeGrid[plantPosition.CellToIndex(map)] is
{
def.altitudeLayer: AltitudeLayer.LowPlant
} building)
{
center.y += ((plantPosition.z - building.OccupiedRect().minZ) * 0.01f) + 0.005f;
}
return center;
}