Table of Contents

Class PlotFoundation

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

A claimable area of land, authored into a scene by a designer.

[RequireComponent(typeof(SceneObjectNamer))]
public class PlotFoundation : Interactable, ISpawnable, IPlotFoundation, IInteractable, ISceneObject
Inheritance
Object
Component
Behaviour
MonoBehaviour
NetworkBehaviour
PlotFoundation
Implements
Inherited Members
NetworkBehaviour.IsSpawned
NetworkBehaviour.ComponentIndex
NetworkBehaviour.NetworkObject
NetworkBehaviour.MAXIMUM_NETWORKBEHAVIOURS
NetworkBehaviour.UNSET_NETWORKBEHAVIOUR_ID
NetworkBehaviour.ToString()
NetworkBehaviour.Reset()
NetworkBehaviour.OnValidate()
NetworkBehaviour.IsBehaviourReconciling
NetworkBehaviour.ClearReplicateCache()
NetworkBehaviour.CreateReconcile()
NetworkBehaviour.Reconcile_Reader<T>(PooledReader, ref T)
NetworkBehaviour.OnStartServerCalled
NetworkBehaviour.OnStartClientCalled
NetworkBehaviour.OnStartNetwork()
NetworkBehaviour.OnStopNetwork()
NetworkBehaviour.OnStopServer()
NetworkBehaviour.OnOwnershipServer(NetworkConnection)
NetworkBehaviour.OnSpawnServer(NetworkConnection)
NetworkBehaviour.OnDespawnServer(NetworkConnection)
NetworkBehaviour.OnStartClient()
NetworkBehaviour.OnStopClient()
NetworkBehaviour.OnOwnershipClient(NetworkConnection)
NetworkBehaviour.ClearBuffedRpcs()
NetworkBehaviour.ExcludeOwnerFromUnbufferedObserversRpcs
NetworkBehaviour.IsClientOnly
NetworkBehaviour.IsServerOnly
NetworkBehaviour.IsHost
NetworkBehaviour.IsClient
NetworkBehaviour.IsServer
NetworkBehaviour.IsDeinitializing
NetworkBehaviour.NetworkManager
NetworkBehaviour.ServerManager
NetworkBehaviour.ClientManager
NetworkBehaviour.ObserverManager
NetworkBehaviour.TransportManager
NetworkBehaviour.TimeManager
NetworkBehaviour.SceneManager
NetworkBehaviour.PredictionManager
NetworkBehaviour.RollbackManager
NetworkBehaviour.NetworkObserver
NetworkBehaviour.IsClientInitialized
NetworkBehaviour.IsClientStarted
NetworkBehaviour.IsClientOnlyInitialized
NetworkBehaviour.IsClientOnlyStarted
NetworkBehaviour.IsServerInitialized
NetworkBehaviour.IsServerStarted
NetworkBehaviour.IsServerOnlyInitialized
NetworkBehaviour.IsServerOnlyStarted
NetworkBehaviour.IsHostInitialized
NetworkBehaviour.IsHostStarted
NetworkBehaviour.IsOffline
NetworkBehaviour.IsNetworked
NetworkBehaviour.GetIsNetworked()
NetworkBehaviour.IsManagerReconciling
NetworkBehaviour.Observers
NetworkBehaviour.IsOwner
NetworkBehaviour.IsController
NetworkBehaviour.HasAuthority
NetworkBehaviour.OwnerId
NetworkBehaviour.ObjectId
NetworkBehaviour.LocalConnection
NetworkBehaviour.OwnerMatches(NetworkConnection)
NetworkBehaviour.Despawn(GameObject, DespawnType?)
NetworkBehaviour.Despawn(NetworkObject, DespawnType?)
NetworkBehaviour.Despawn(DespawnType?)
NetworkBehaviour.Spawn(GameObject, NetworkConnection, Scene)
NetworkBehaviour.Spawn(NetworkObject, NetworkConnection, Scene)
NetworkBehaviour.RemoveOwnership()
NetworkBehaviour.GiveOwnership(NetworkConnection)
NetworkBehaviour.GetInstance<T>()
NetworkBehaviour.TryRegisterInstance<T>(T)
NetworkBehaviour.UnregisterInstance<T>()
NetworkBehaviour.CanLog(LoggingType)
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.name
Object.hideFlags

Remarks

The object carries the plot's identity and its price; everything else about it — who owns it, whether it can be claimed at all — is resolved by the server against the database and pushed back here. Nothing about ownership is decided locally.

Foundations announce themselves through PlotFoundation.Registry rather than being discovered by a scene sweep, because a sweep would have to know when a scene had finished loading and would find nothing in an additively-loaded one that arrives later.

Fields

DefaultHeight

Height used when none is authored, in metres.

public const float DefaultHeight = 12

Field Value

float

DefaultSize

Footprint used when none is authored, in metres.

public const float DefaultSize = 16

Field Value

float

Remarks

A placeholder, not a recommendation. The standard sizes a server should offer are a design decision about how housing districts are laid out, and that has not been made yet.

MinimumExtent

Smallest footprint or height a plot may have, in metres.

public const float MinimumExtent = 1

Field Value

float

Remarks

A plot with a zero or negative edge is a plot nothing can be inside, which would read as every placement being out of bounds rather than as the authoring mistake it is.

Properties

AccessGrants

Everyone currently granted access, for the owner's guest list. Never null.

public IReadOnlyDictionary<long, PlotPermission> AccessGrants { get; }

Property Value

IReadOnlyDictionary<long, PlotPermission>

Bounds

The plot's volume in world space.

public Bounds Bounds { get; }

Property Value

Bounds

Remarks

Centred on the foundation horizontally and resting on it vertically, so the foundation's transform marks the ground at the middle of the plot — which is where a designer dragging one into a scene would expect the pivot to be.

Axis-aligned, and deliberately not rotated with the transform. A rotated plot would make every containment test a matrix operation on a path that runs per placement, and housing districts laid out on a grid gain nothing from arbitrary angles.

BuilderCharacterID

The character currently editing this plot, or zero.

public long BuilderCharacterID { get; }

Property Value

long

Dimensions

The plot's footprint in metres, width (X) by depth (Z), floored at MinimumExtent.

public Vector2 Dimensions { get; }

Property Value

Vector2

HasResolvedAccess

True once the server has loaded this plot's access list.

public bool HasResolvedAccess { get; }

Property Value

bool

Height

The plot's height in metres, floored at MinimumExtent.

public float Height { get; }

Property Value

float

IsBeingBuilt

True while somebody is editing this plot.

public bool IsBeingBuilt { get; }

Property Value

bool

IsResolved

True once the server has matched this foundation to its database row.

public bool IsResolved { get; }

Property Value

bool

Owner

Who owns this plot, as the server last resolved it.

public PlotOwner Owner { get; }

Property Value

PlotOwner

PlotID

The database identity of this plot, or zero until registration has resolved it.

public long PlotID { get; }

Property Value

long

Remarks

Zero is the honest answer during the window between a scene loading and its plots being read back from the database. Nothing may be claimed while it is zero — there is no row to claim yet.

PlotKey

The key authored on this foundation, canonicalised. Unique within its scene.

public string PlotKey { get; }

Property Value

string

Remarks

Computed on demand rather than in Awake, so the key is available to anything that asks — editor validation tooling, and tests — without depending on the object having been through its runtime lifecycle. Empty means the authored key was unusable.

Price

What it costs to claim this plot, in the server's currency attribute.

public long Price { get; }

Property Value

long

State

Where this plot is in its lifecycle, as the server last resolved it.

public PlotState State { get; }

Property Value

PlotState

Remarks

Replicated, because it decides what the foundation looks like as well as what may be done to it — an empty lot, a building site, a house, and an abandoned house are four different things to walk up to.

Title

The display title for this interactable, shown in the UI.

public override string Title { get; }

Property Value

string

TitleColor

The color of the title displayed for this interactable in the UI.

public override Color TitleColor { get; }

Property Value

Color

Methods

AllowsEntry(long, long)

True when this character may be inside the plot right now.

public bool AllowsEntry(long characterID, long characterGuildID)

Parameters

characterID long

The character asking.

characterGuildID long

Their guild, or zero when they are in none.

Returns

bool

Remarks

Two gates, and both have to pass. The first is the standing rule — the state of the plot and whatever the owner has granted. The second is the live build session: a plot being edited is closed even to people who normally hold a key, because the ground is moving under them and a visitor standing in it is a visitor inside a wall that was not there a moment ago.

The session gate is deliberately narrower than the state one. An owner may end a session without leaving Building, and their friends should not be let in the instant they stop placing things — the house is still a building site.

Access that has not loaded yet admits nobody but the owner. The alternative is admitting everybody for the seconds between a scene loading and its grants arriving, and an access rule that is off during startup is an access rule a player can wait out.

ApplyAccessGrant(long, PlotPermission)

Records one character's grant, or removes it. Server only.

public void ApplyAccessGrant(long characterID, PlotPermission permissions)

Parameters

characterID long

The character granted or revoked.

permissions PlotPermission

What they now hold; None revokes.

Remarks

A no-op before the list has loaded. Seeding a single entry into an unresolved list would turn "not loaded" into "loaded, containing exactly one person", and the resolve that followed would look like a mass revocation of everybody else.

ApplyAccessGrants(Dictionary<long, PlotPermission>)

Replaces the plot's access list with what the database holds. Server only.

public void ApplyAccessGrants(Dictionary<long, PlotPermission> grants)

Parameters

grants Dictionary<long, PlotPermission>

Remarks

Replaces wholesale rather than merging. The list read back is the complete answer, and a merge could only ever add — so a grant revoked while this server was not looking would survive every refresh, and the friend the owner thought they had locked out would keep walking in.

ApplyOwner(PlotOwner)

Records a change of ownership without re-resolving the row.

public void ApplyOwner(PlotOwner owner)

Parameters

owner PlotOwner

ApplyResolvedState(long, PlotOwner, PlotState, Dictionary<long, PlotPermission>)

Records the database identity and ownership the server resolved for this plot.

public void ApplyResolvedState(long plotID, PlotOwner owner, PlotState state, Dictionary<long, PlotPermission> grants = null)

Parameters

plotID long

The plot's row identity.

owner PlotOwner

Who owns it.

state PlotState

Where it is in its lifecycle.

grants Dictionary<long, PlotPermission>

Who has been let in, or null when that is not known yet.

ApplyState(PlotState)

Records the plot's lifecycle state. Server only.

public void ApplyState(PlotState state)

Parameters

state PlotState

ClearResolvedState()

Forgets this plot's resolved state, putting it back to unclaimable. Server only.

public void ClearResolvedState()

Remarks

Used when a scene's registration has to be redone. The access list goes back to null rather than empty, so the gap reads as "not loaded" — which closes the plot — instead of as "nobody has a key", which is the same thing until somebody is let in and then quietly is not.

Contains(Vector3)

True when a world-space point falls inside this plot.

public bool Contains(Vector3 worldPosition)

Parameters

worldPosition Vector3

Returns

bool

GrantFor(long)

What one character has been granted on this plot, or None.

public PlotPermission GrantFor(long characterID)

Parameters

characterID long

Returns

PlotPermission

PermissionsFor(long, long)

Everything a character may do here right now.

public PlotPermission PermissionsFor(long characterID, long characterGuildID)

Parameters

characterID long

The character asking.

characterGuildID long

Their guild, or zero when they are in none.

Returns

PlotPermission

Remarks

Delegated to PlotAccess rather than decided here, so the server enforcing the rule and the client greying out a button reach the answer through the same arithmetic. A house whose door refuses somebody the UI told they could enter reads as the game being broken rather than as the house being locked.

SetBuilder(long)

Opens or closes a build session. Server only.

public void SetBuilder(long characterID)

Parameters

characterID long

The editing character, or zero to close the session.