first commit
This commit is contained in:
32
NitroxPatcher/Patches/Dynamic/BuilderTool_Construct_Patch.cs
Normal file
32
NitroxPatcher/Patches/Dynamic/BuilderTool_Construct_Patch.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Reflection;
|
||||
using NitroxClient.GameLogic.Bases;
|
||||
using NitroxClient.Helpers;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.Helper;
|
||||
|
||||
namespace NitroxPatcher.Patches.Dynamic;
|
||||
|
||||
public sealed partial class BuilderTool_Construct_Patch : NitroxPatch, IDynamicPatch
|
||||
{
|
||||
public static readonly MethodInfo TARGET_METHOD = Reflect.Method((BuilderTool t) => t.Construct(default, default, default));
|
||||
|
||||
public static bool Prefix(Constructable c)
|
||||
{
|
||||
if (!BuildingHandler.Main || !c.tr.parent || !c.tr.parent.TryGetNitroxId(out NitroxId parentId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isAllowed = true;
|
||||
string message = string.Empty;
|
||||
|
||||
Constructable_DeconstructionAllowed_Patch.DeconstructionAllowed(parentId, ref isAllowed, ref message);
|
||||
if (!isAllowed)
|
||||
{
|
||||
Log.InGame(message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user