Class PlotFoundation
A claimable area of land, authored into a scene by a designer.
[RequireComponent(typeof(SceneObjectNamer))]
public class PlotFoundation : Interactable, ISpawnable, IPlotFoundation, IInteractable, ISceneObject
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourNetworkBehaviourPlotFoundation
- Implements
- Inherited Members
-
NetworkBehaviour.IsSpawnedNetworkBehaviour.ComponentIndexNetworkBehaviour.NetworkObjectNetworkBehaviour.MAXIMUM_NETWORKBEHAVIOURSNetworkBehaviour.UNSET_NETWORKBEHAVIOUR_IDNetworkBehaviour.ToString()NetworkBehaviour.Reset()NetworkBehaviour.OnValidate()NetworkBehaviour.IsBehaviourReconcilingNetworkBehaviour.ClearReplicateCache()NetworkBehaviour.CreateReconcile()NetworkBehaviour.Reconcile_Reader<T>(PooledReader, ref T)NetworkBehaviour.OnStartServerCalledNetworkBehaviour.OnStartClientCalledNetworkBehaviour.OnStartNetwork()NetworkBehaviour.OnStopNetwork()NetworkBehaviour.OnStopServer()NetworkBehaviour.OnOwnershipServer(NetworkConnection)NetworkBehaviour.OnSpawnServer(NetworkConnection)NetworkBehaviour.OnDespawnServer(NetworkConnection)NetworkBehaviour.OnStartClient()NetworkBehaviour.OnStopClient()NetworkBehaviour.OnOwnershipClient(NetworkConnection)NetworkBehaviour.ClearBuffedRpcs()NetworkBehaviour.ExcludeOwnerFromUnbufferedObserversRpcsNetworkBehaviour.IsClientOnlyNetworkBehaviour.IsServerOnlyNetworkBehaviour.IsHostNetworkBehaviour.IsClientNetworkBehaviour.IsServerNetworkBehaviour.IsDeinitializingNetworkBehaviour.NetworkManagerNetworkBehaviour.ServerManagerNetworkBehaviour.ClientManagerNetworkBehaviour.ObserverManagerNetworkBehaviour.TransportManagerNetworkBehaviour.TimeManagerNetworkBehaviour.SceneManagerNetworkBehaviour.PredictionManagerNetworkBehaviour.RollbackManagerNetworkBehaviour.NetworkObserverNetworkBehaviour.IsClientInitializedNetworkBehaviour.IsClientStartedNetworkBehaviour.IsClientOnlyInitializedNetworkBehaviour.IsClientOnlyStartedNetworkBehaviour.IsServerInitializedNetworkBehaviour.IsServerStartedNetworkBehaviour.IsServerOnlyInitializedNetworkBehaviour.IsServerOnlyStartedNetworkBehaviour.IsHostInitializedNetworkBehaviour.IsHostStartedNetworkBehaviour.IsOfflineNetworkBehaviour.IsNetworkedNetworkBehaviour.GetIsNetworked()NetworkBehaviour.IsManagerReconcilingNetworkBehaviour.ObserversNetworkBehaviour.IsOwnerNetworkBehaviour.IsControllerNetworkBehaviour.HasAuthorityNetworkBehaviour.OwnerIdNetworkBehaviour.ObjectIdNetworkBehaviour.LocalConnectionNetworkBehaviour.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.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.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.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.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.nameObject.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
DefaultSize
Footprint used when none is authored, in metres.
public const float DefaultSize = 16
Field Value
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
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
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
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
Height
The plot's height in metres, floored at MinimumExtent.
public float Height { get; }
Property Value
IsBeingBuilt
True while somebody is editing this plot.
public bool IsBeingBuilt { get; }
Property Value
IsResolved
True once the server has matched this foundation to its database row.
public bool IsResolved { get; }
Property Value
Owner
Who owns this plot, as the server last resolved it.
public PlotOwner Owner { get; }
Property Value
PlotID
The database identity of this plot, or zero until registration has resolved it.
public long PlotID { get; }
Property Value
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
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
State
Where this plot is in its lifecycle, as the server last resolved it.
public PlotState State { get; }
Property Value
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
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
characterIDlongThe character asking.
characterGuildIDlongTheir guild, or zero when they are in none.
Returns
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
characterIDlongThe character granted or revoked.
permissionsPlotPermissionWhat 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
grantsDictionary<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
ownerPlotOwner
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
plotIDlongThe plot's row identity.
ownerPlotOwnerWho owns it.
statePlotStateWhere it is in its lifecycle.
grantsDictionary<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
statePlotState
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
worldPositionVector3
Returns
GrantFor(long)
What one character has been granted on this plot, or None.
public PlotPermission GrantFor(long characterID)
Parameters
characterIDlong
Returns
PermissionsFor(long, long)
Everything a character may do here right now.
public PlotPermission PermissionsFor(long characterID, long characterGuildID)
Parameters
characterIDlongThe character asking.
characterGuildIDlongTheir guild, or zero when they are in none.
Returns
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
characterIDlongThe editing character, or zero to close the session.