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

30 lines
No EOL
877 B
C#

using HarmonyLib;
using SRMultiplayer.Packets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SRMultiplayer.Patches
{
[HarmonyPatch(typeof(SiloStorageActivator))]
[HarmonyPatch("OnActiveSlotChanged")]
class SiloStorageActivator_OnActiveSlotChanged
{
static void Prefix(SiloStorageActivator __instance)
{
if (!Globals.IsMultiplayer || Globals.HandlePacket) return;
var id = __instance.landPlotModel.gameObj.GetComponent<LandPlotLocation>().id;
int num = __instance.landPlotModel.siloStorageIndices[__instance.activatorIdx];
new PacketLandPlotSiloSlot()
{
ID = id,
Slot = num,
ActivatorID = __instance.activatorIdx
}.Send();
}
}
}