Table of Contents

Struct PlotIdentity

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

What identifies a plot of land: the scene it belongs to, and a key authored on it.

public readonly struct PlotIdentity : IEquatable<PlotIdentity>
Implements
Inherited Members

Remarks

A plot is a foundation area placed in a scene by a designer, so its geometry is part of the scene asset and never needs to be stored or synchronised. Only ownership is persisted, which leaves the question of what a stored row points at.

It cannot be a scene object identifier. Those are handed out fresh on every scene load and are explicitly never persisted, so a row keyed by one would attach to a different foundation after a restart. It cannot be a scene instance either: channels are several live copies of the same scene, and a plot is meant to look the same in all of them. What is left is the scene's name plus a key the designer writes on the foundation, which is stable across reloads, identical on every scene server in the cluster, and readable in a log line.

Keys are canonicalised on the way in rather than stored as typed. Guild names take the opposite approach — stored as entered, with a lowercase computed column beside them — because a guild name is shown to players and has to survive round-tripping intact. A plot key is a developer-facing identifier that is never displayed, so there is no reason to keep two forms of it, and one canonical form is what stops Riverside_01 and riverside_01 from becoming two plots that look like one.

Fields

MaxPlotKeyLength

Longest accepted plot key. Matches the column width.

public const int MaxPlotKeyLength = 64

Field Value

int

MaxSceneNameLength

Longest accepted scene name. Matches the width every other scene-name column uses.

public const int MaxSceneNameLength = 100

Field Value

int

Properties

IsValid

True when this identity names a plot rather than being an empty default.

public bool IsValid { get; }

Property Value

bool

PlotKey

The designer-authored key, canonicalised. Unique within SceneName.

public string PlotKey { get; }

Property Value

string

SceneName

The Unity scene the plot's foundation is authored in.

public string SceneName { get; }

Property Value

string

Methods

Equals(PlotIdentity)

public bool Equals(PlotIdentity other)

Parameters

other PlotIdentity

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Normalize(string)

Reduces an authored plot key to its canonical form.

public static string Normalize(string plotKey)

Parameters

plotKey string

Returns

string

Remarks

Lower-cased with the invariant culture rather than the current one. A server running under a Turkish locale would otherwise fold a dotted capital I to a dotless lowercase one, and produce a different key for the same foundation than the rest of the cluster.

ToString()

public override string ToString()

Returns

string

TryCreate(string, string, out PlotIdentity)

Builds an identity from an authored scene name and plot key.

public static bool TryCreate(string sceneName, string plotKey, out PlotIdentity identity)

Parameters

sceneName string

The scene the foundation lives in.

plotKey string

The key authored on the foundation.

identity PlotIdentity

The canonicalised identity, or the default on failure.

Returns

bool

False when either part is missing, blank, or too long for its column.

Remarks

Length is checked here, against the same limits the columns use, so an over-long key is caught while a designer still has the scene open rather than as a truncation or an insert failure much later.

Operators

operator ==(PlotIdentity, PlotIdentity)

public static bool operator ==(PlotIdentity left, PlotIdentity right)

Parameters

left PlotIdentity
right PlotIdentity

Returns

bool

operator !=(PlotIdentity, PlotIdentity)

public static bool operator !=(PlotIdentity left, PlotIdentity right)

Parameters

left PlotIdentity
right PlotIdentity

Returns

bool