first commit
This commit is contained in:
25
NitroxPatcher/Patches/Dynamic/BeaconLabel_SetLabel_Patch.cs
Normal file
25
NitroxPatcher/Patches/Dynamic/BeaconLabel_SetLabel_Patch.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Reflection;
|
||||
using NitroxClient.GameLogic;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.Helper;
|
||||
|
||||
namespace NitroxPatcher.Patches.Dynamic;
|
||||
|
||||
/// <summary>
|
||||
/// Adds a callback to broadcast beacon label change when edited.
|
||||
/// </summary>
|
||||
public sealed partial class BeaconLabel_OnHandClick_Patch : NitroxPatch, IDynamicPatch
|
||||
{
|
||||
private static readonly MethodInfo TARGET_METHOD = Reflect.Method((BeaconLabel t) => t.OnHandClick(default));
|
||||
|
||||
public static void Postfix(BeaconLabel __instance)
|
||||
{
|
||||
uGUI.main.userInput.callback += _ =>
|
||||
{
|
||||
if (__instance.transform.parent && __instance.transform.parent.TryGetIdOrWarn(out NitroxId id))
|
||||
{
|
||||
Resolve<Entities>().EntityMetadataChanged(__instance.transform.parent.GetComponent<Beacon>(), id);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user