Files
7d2dXG/Mods/0A-KFCommonUtilityLib/Scripts/NetPackages/NetPackageFixedReload.cs
Nathaniel Cosford e06f2bd282 Add All Mods
2025-05-29 23:33:28 +09:30

49 lines
1.1 KiB
C#

using KFCommonUtilityLib.Scripts.Utilities;
class NetPackageFixedReload : NetPackage
{
private int entityId;
private byte actionIndex;
public NetPackageFixedReload Setup(int entityId, int actionIndex)
{
this.entityId = entityId;
this.actionIndex = (byte)actionIndex;
return this;
}
public override int GetLength()
{
return 5;
}
public override void ProcessPackage(World _world, GameManager _callbacks)
{
if (_world == null)
{
return;
}
if (!_world.IsRemote())
{
MultiActionUtils.FixedItemReloadServer(entityId, actionIndex);
}
else
{
MultiActionUtils.FixedItemReloadClient(entityId, actionIndex);
}
}
public override void read(PooledBinaryReader _reader)
{
entityId = _reader.ReadInt32();
actionIndex = _reader.ReadByte();
}
public override void write(PooledBinaryWriter _writer)
{
base.write(_writer);
_writer.Write(entityId);
_writer.Write(actionIndex);
}
}