SRMP-Public/SRMP/Patches/Patch_DestroyOnTouching.cs
2023-05-29 22:23:11 +02:00

25 lines
No EOL
695 B
C#

using HarmonyLib;
using MonomiPark.SlimeRancher.DataModel;
using SRMultiplayer.Networking;
using SRMultiplayer.Packets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SRMultiplayer.Patches
{
[HarmonyPatch(typeof(DestroyOnTouching))]
[HarmonyPatch("UpdateDestroyTime")]
class DestroyOnTouching_UpdateDestroyTime
{
static bool Prefix(DestroyOnTouching __instance)
{
if (!Globals.IsMultiplayer || Globals.HandlePacket) return true;
var entity = __instance.GetComponent<NetworkActor>();
return (entity != null && entity.IsLocal);
}
}
}