Table of Contents

Struct PlayerRequestContext

Namespace
FishMMO.Server.Implementation
Assembly
FishMMO.Server.dll

The acting player behind one client request, resolved once at the top of a broadcast handler.

public readonly struct PlayerRequestContext
Inherited Members

Remarks

A struct rather than a bare out IPlayerCharacter so that what the preamble produces can grow without touching every call site again. The whole reason this type exists is that the preamble HAS grown, repeatedly, and each growth spurt was pasted: the connection check, then the first-object check, then CanAct, then a controller lookup. Thirty-odd handlers carried private copies of the sequence and the copies had already drifted apart in which checks they ran and in what order.

Deliberately NOT carrying the ingress guard key. The guard lives in per-system runtime data (IGuildSystemRuntimeData, IInteractableSystemRuntimeData, one per system), is keyed by a per-system operation enum, and its debounce interval is a serialized field on the system asset — so acquiring it here would mean passing three system-specific things through a base-class method. More to the point, a REFUSED guard is answered differently by almost every handler: some return in silence, some send a throttle reason, one re-sends the whole hotkey bar so the client stops believing its own optimistic edit. Folding that into the shared preamble is a separate change; this one moves only the part that is genuinely identical.

Fields

Character

The acting player character. Never null when IsValid.

public readonly IPlayerCharacter Character

Field Value

IPlayerCharacter

Connection

The connection the request arrived on. Never null when IsValid.

public readonly NetworkConnection Connection

Field Value

NetworkConnection

Properties

CharacterID

The acting character's database id, or 0 on a default context.

public long CharacterID { get; }

Property Value

long

IsValid

True when a character was resolved. False on a default context.

public bool IsValid { get; }

Property Value

bool

Methods

TryGet<TBehaviour>(out TBehaviour)

Resolves one of the acting character's controllers.

public bool TryGet<TBehaviour>(out TBehaviour behaviour) where TBehaviour : class, ICharacterBehaviour

Parameters

behaviour TBehaviour

Returns

bool

Type Parameters

TBehaviour

Remarks

Null-safe on a default context, so a caller that ignored the return of TryBeginPlayerRequest gets a refusal rather than a NullReferenceException.