first commit
This commit is contained in:
24
NitroxPatcher/Patches/Dynamic/Survival_Eat_Patch.cs
Normal file
24
NitroxPatcher/Patches/Dynamic/Survival_Eat_Patch.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Reflection;
|
||||
using NitroxClient.Communication.Abstract;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.Helper;
|
||||
using NitroxModel.Packets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxPatcher.Patches.Dynamic;
|
||||
|
||||
/// <summary>
|
||||
/// Let the server know when the player successfully eats an item.
|
||||
/// </summary>
|
||||
public sealed partial class Survival_Eat_Patch : NitroxPatch, IDynamicPatch
|
||||
{
|
||||
private static readonly MethodInfo TARGET_METHOD = Reflect.Method((Survival t) => t.Eat(default(GameObject)));
|
||||
|
||||
public static void Postfix(bool __result, GameObject useObj)
|
||||
{
|
||||
if (__result && useObj.TryGetIdOrWarn(out NitroxId id))
|
||||
{
|
||||
Resolve<IPacketSender>().Send(new EntityDestroyed(id));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user