|
|
@@ -0,0 +1,52 @@ |
|
|
|
using System.Globalization; |
|
|
|
using System.Reflection; |
|
|
|
using HarmonyLib; |
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
namespace CLre.Fixes |
|
|
|
{ |
|
|
|
[Bugfix(name = "ExclusionImprovement", |
|
|
|
description = "Sync exclusion zone collision check with visual location", |
|
|
|
more = "https://trello.com/c/Ue4yIqWQ/11-placing-material-in-restricted-areas", |
|
|
|
component = BugfixType.HarmonyPatch, id = 2)] |
|
|
|
[HarmonyPatch] |
|
|
|
class ExclusionZoneCollisionEngine_TestExclusionZoneCollision_Patch |
|
|
|
{ |
|
|
|
[HarmonyPrefix] |
|
|
|
public static void BeforeMethodCall(ref Vector3 structurePosition, ref bool __result) |
|
|
|
{ |
|
|
|
if (ResourcePlacementPreviewEngine_GetLerpPosition_Patch.quantizedPosition != Vector3.zero) |
|
|
|
{ |
|
|
|
structurePosition = ResourcePlacementPreviewEngine_GetLerpPosition_Patch.quantizedPosition; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[HarmonyTargetMethod] |
|
|
|
public static MethodBase Target() |
|
|
|
{ |
|
|
|
return AccessTools.Method("Game.Building.ExclusionZone.ExclusionZoneCollisionEngine:TestExclusionZoneCollision"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Bugfix(name = "ExclusionImprovement", |
|
|
|
description = "Sync exclusion zone collision check with visual location", |
|
|
|
more = "https://trello.com/c/Ue4yIqWQ/11-placing-material-in-restricted-areas", |
|
|
|
component = BugfixType.HarmonyPatch, id = 2)] |
|
|
|
[HarmonyPatch] |
|
|
|
class ResourcePlacementPreviewEngine_GetLerpPosition_Patch |
|
|
|
{ |
|
|
|
internal static Vector3 quantizedPosition = Vector3.zero; |
|
|
|
|
|
|
|
[HarmonyPrefix] |
|
|
|
public static void BeforeMethodCall(ref Vector3 voxelWorldPos, ref Vector3 __result) |
|
|
|
{ |
|
|
|
quantizedPosition = voxelWorldPos; |
|
|
|
} |
|
|
|
|
|
|
|
[HarmonyTargetMethod] |
|
|
|
public static MethodBase Target() |
|
|
|
{ |
|
|
|
return AccessTools.Method("Game.Handhelds.ResourcePlacementPreviewEngine:GetLerpPosition"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |