zz
This commit is contained in:
33
GlobalShared/Patches/MyMechanicalConnectionBlockBasePatch.cs
Normal file
33
GlobalShared/Patches/MyMechanicalConnectionBlockBasePatch.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user