Table of Contents

Class PlotStructureTemplate

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

A thing a player can build on a plot.

[CreateAssetMenu(fileName = "New Plot Structure", menuName = "FishMMO/Housing/Plot Structure", order = 1)]
public class PlotStructureTemplate : CachedScriptableObject<PlotStructureTemplate>, ICachedObject
Inheritance
Object
ScriptableObject
PlotStructureTemplate
Implements
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
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.ToString()
Object.name
Object.hideFlags

Remarks

A template rather than a free-form prefab reference, so what may be built is a decision the server makes from content it ships. A placement request names a template by ID and nothing else — the client never says which prefab to spawn, only which of the offered pieces it wants, so a forged request can only ever ask for something that already exists.

Fields

Footprint

The structure's footprint in metres, width (X) by depth (Z).

[Tooltip("Footprint in metres: width (X) by depth (Z). 1 unit = 1 metre.")]
public Vector2 Footprint

Field Value

Vector2

Remarks

Authored rather than measured from the prefab's renderers. A mesh's bounds include decoration that overhangs — eaves, a porch rail, a chimney — and a piece that cannot be placed because its guttering crosses the plot line is a piece nobody can use. This is the space the structure is meant to occupy, which is a design decision, not a geometric one.

Height

The structure's height in metres.

[Tooltip("Height in metres, measured upward from the structure's base.")]
public float Height

Field Value

float

Prefab

The prefab spawned for this structure.

[Tooltip("Prefab spawned when this structure is placed.")]
public GameObject Prefab

Field Value

GameObject

Price

What it costs to place one, in the server's currency attribute.

[Tooltip("Cost to place this structure. Zero is free.")]
public long Price

Field Value

long

Properties

SafeFootprint

The structure's footprint, floored so a mis-authored template cannot occupy nothing.

public Vector2 SafeFootprint { get; }

Property Value

Vector2

Remarks

A zero-sized structure would pass every bounds test, including from outside the plot, because an empty box is contained by everything.

SafeHeight

The structure's height, floored at the same minimum.

public float SafeHeight { get; }

Property Value

float

Methods

GetBounds(Vector3, float)

The volume this structure would occupy if placed at a point, facing a given way.

public Bounds GetBounds(Vector3 worldPosition, float yawDegrees)

Parameters

worldPosition Vector3

Where the structure's base sits.

yawDegrees float

Rotation about the vertical axis.

Returns

Bounds

Remarks

Rotation is applied by swapping the footprint's axes at right angles rather than by rotating a box. An axis-aligned box that has been rotated 45° has a larger axis-aligned extent than the structure really occupies, which would refuse placements that fit; the quarter turns are the ones that matter for buildings laid out on a grid, and they are exact.