Table of Contents

Interface IGamePacketRegistry

Namespace
Shard.Gameplay.Universe.Networking.GamePackets
Assembly
Shard.Gameplay.Universe.dll

Accepts gameplay packet registrations contributed by server modules during setup.

public interface IGamePacketRegistry

Remarks

A contributing module declares Shard.Gameplay:Universe as a dependency, resolves this interface, and registers callbacks from its setup method. Registration during preload or later is invalid because the Universe module freezes the registration table after every module has completed setup. Native mods use generated values and callbacks that are safe to expose through the ABI instead of this managed API.

A callback owner that returns incomplete work must stop admission and await its accepted operations during module quiescence.

Methods

Register<TPacket>(string, GamePacketCallback<TPacket>)

Assigns one generated inbound packet type to one gameplay owner.

void Register<TPacket>(string moduleId, GamePacketCallback<TPacket> callback) where TPacket : class, IToServerPacket

Parameters

moduleId string

The contributing module identifier used in startup diagnostics.

callback GamePacketCallback<TPacket>

The callback that receives the Player and decoded packet.

Type Parameters

TPacket

The generated inbound packet type.

Exceptions

ArgumentException

moduleId is empty or contains only whitespace.

ArgumentNullException

callback is null.

InvalidOperationException

The packet already has an owner, belongs to the connection endpoint, or registration has already been frozen.