This commit is contained in:
/
2024-12-29 21:15:58 +01:00
commit 547655c326
77 changed files with 7313 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using Global.Shared.Plugin;
using HarmonyLib;
using Sandbox.Game.Entities.Blocks;
namespace Global.Patches
{
[HarmonyPatch(typeof(MyMechanicalConnectionBlockBase))]
public class MyMechanicalConnectionBlockBasePatch
{
public static bool IsCreatingSubPart;
[HarmonyPatch("RaiseAttachedEntityChanged")]
[HarmonyPrefix]
public static void RaiseAttachedEntityChanged(MyMechanicalConnectionBlockBase __instance)
{
GlobalStatic.OcTreeHandler.GridTree.Get(__instance.CubeGrid.EntityId)?.RaiseAttachedEntityChanged();
}
[HarmonyPatch("CreateTopPartAndAttach")]
[HarmonyPrefix]
public static void CreateTopPrefix(long builtBy, bool smallToLarge, bool instantBuild)
{
IsCreatingSubPart = true;
}
[HarmonyPatch("CreateTopPartAndAttach")]
[HarmonyPostfix]
public static void CreateTopPostfix(long builtBy, bool smallToLarge, bool instantBuild)
{
IsCreatingSubPart = false;
}
}
}