34 lines
1.4 KiB
C#
34 lines
1.4 KiB
C#
using Unity.NetCode;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>
|
|
/// Client -> server request to deposit into or withdraw from the shared storage container. A one-off
|
|
/// action, so it is an RPC (not a per-tick predicted input). Op is stored as a byte (see
|
|
/// <see cref="StorageOp"/>) rather than an enum to keep the generated serializer trivial and avoid the
|
|
/// cross-assembly enum-codegen hazard. No target entity is carried: M5 has a single shared container,
|
|
/// which the server resolves as a singleton (entity refs are not stable across worlds).
|
|
/// </summary>
|
|
public struct StorageOpRequest : IRpcCommand
|
|
{
|
|
/// <summary>Operation code (see <see cref="StorageOp"/>): 0 = deposit, 1 = withdraw.</summary>
|
|
public byte Op;
|
|
|
|
/// <summary>Item to deposit/withdraw.</summary>
|
|
public ushort ItemId;
|
|
|
|
/// <summary>Quantity to deposit/withdraw (server clamps withdraw to available).</summary>
|
|
public int Count;
|
|
}
|
|
|
|
/// <summary>Operation codes for <see cref="StorageOpRequest.Op"/> (byte to keep RPC serialization trivial).</summary>
|
|
public static class StorageOp
|
|
{
|
|
/// <summary>Add items to the shared container.</summary>
|
|
public const byte Deposit = 0;
|
|
|
|
/// <summary>Remove items from the shared container.</summary>
|
|
public const byte Withdraw = 1;
|
|
}
|
|
}
|