Skip to content

CopyDefinition

public sealed class CopyDefinition

Namespace MapExpansions

A main-world object copied into the expansion, such as a shop’s interior or its doors. The copy keeps the template’s place relative to Frame, and the frame stands at At: when the expansion holds the same building as the main world, the frame is the main building and At the expansion’s, so an interior lands in the expansion’s walls as it stood in the main world’s. Networked parts below the template (doors) are spawned by the host, so they open and close for everyone.

public string Id { get; set; }

Stable id inside the expansion; networked parts of the copy are registered under it.

public string Template { get; set; }

Path of the template in the main world, from a scene root or from any object: “Pawn shop/Interior” is the child “Interior” of the first object called “Pawn shop”. Objects of expansions never match.

public string Resource { get; set; }

A vanilla Resources GameObject path, used with VisualOnly for static decoration.

public string ResourceRoot { get; set; }

Optional visual child path below the loaded Resources prefab.

public bool VisualOnly { get; set; }

Strips scripts, network components, audio and physics bodies from the inactive copy using the source whitelist.

public bool? LightsOn { get; set; }

Overrides the native lights after stripping visual-only copies; null keeps their source state.

public float? LightRange { get; set; }

Overrides the reach of the copy’s native lights in metres; null keeps their source range. A lamp copied close to an outer wall needs less than the room it came from.

public float? LightIntensity { get; set; }

Overrides the brightness of the copy’s native lights; null keeps their source value. A shorter reach also dims what the lamp still reaches.

public string LightSwitch { get; set; }

Path of a main-world ModularSwitch. The copy’s lamps and their glowing surfaces then follow that switch on every peer, starting from its current state; a visual-only copy has no lamp script the switch could reach.

public string Frame { get; set; }

The main-world object whose place At gives. Empty means the template itself.

public LocalPoint At { get; set; }

Type: LocalPoint

Where the frame stands, in expansion-local coordinates. Not used when Onto is set.

public string Onto { get; set; }

Path of an object of the expansion’s source the frame stands on instead of At, such as the expansion’s own static door a working door replaces: “Pawn shop/Metal Glass Door (Static)”. The frame takes its place and its full rotation, tilt included, moved by OntoOffset and turned by OntoRotation in that object’s own axes.

public Vector3 OntoOffset { get; set; }

Offset of the frame from Onto, in that object’s axes.

public Vector3 OntoRotation { get; set; }

Euler angles that turn the frame against Onto, in that object’s axes.

public float Scale { get; set; }

Scale of the copy against the main world, for an expansion building built smaller.

public bool OwnMesh { get; set; }

The template’s own renderer and collider come along. False takes only what lies below it, for a shell whose contents are fitted into the expansion’s own shell.

public bool IndependentMesh { get; set; }

Extracts each batched renderer’s selected submeshes, so repeated copies draw independently.

public List<string> Exclude { get; private set; }

Paths below the template that are left out of the copy, such as a door to a room the expansion lacks.

public List<BoxDefinition> Boxes { get; private set; }

Type: BoxDefinition

Boxes added to the copy, in the main world’s coordinates like the template: panels with a loaded material for a side the original leaves open, and invisible blocks for a collider that would reach through the expansion’s walls.

public IEnumerable<BoxDefinition> Panels { get; }

Type: BoxDefinition

The panels among Boxes.

public IEnumerable<BoxDefinition> Blocks { get; }

Type: BoxDefinition

The blocks among Boxes.

public WorldSide TemplateSide { get; set; }

Type: WorldSide

Which world Template and Frame are found in.

public string Model { get; set; }

A glTF binary file to place instead of a template: “kiosk.glb” is Mods/<expansion>/models/kiosk.glb or an embedded resource of the layer’s assembly whose name ends in “.kiosk.glb”. Every peer builds it itself.

public ModelCollider Collider { get; set; }

Type: ModelCollider

Which collider a Model gets.

public string Prefab { get; set; }

Item id of a buildable game item to place instead of a template, such as “floorlamp”. The host spawns it for everyone; it stays out of the save and cannot be picked up.

public bool? Obstacle { get; set; }

Whether NPCs walk around the copy: a NavMesh obstacle carves its outline out of the walkable ground. Null takes the default: on for models, game prefabs and copies a layer adds, off for the copies of the code definition.

public CopyDefinition()

CopyDefinition(string, string, string, LocalPoint)

Section titled “CopyDefinition(string, string, string, LocalPoint)”
public CopyDefinition(
string id,
string template,
string frame,
LocalPoint at)

Types: LocalPoint

public static CopyDefinition OfModel(
string id,
string file,
LocalPoint at,
ModelCollider collider = ModelCollider.Mesh)

Types: LocalPoint, ModelCollider

A glTF model placed at a point of the expansion.

public static CopyDefinition OfPrefab(
string id,
string itemId,
LocalPoint at)

Types: LocalPoint

A buildable game item placed at a point of the expansion, spawned by the host.

public static CopyDefinition OnObject(
string id,
string template,
string frame,
string onto,
Vector3 offset = default,
Vector3 rotation = default)

A copy whose frame stands on an object of the expansion’s source.

public CopyDefinition Panel(
Vector3 min,
Vector3 max,
string material,
string id = null)

Adds a panel to Boxes. Without an id it is “panel-1”, “panel-2” in order.

public CopyDefinition Block(Vector3 min, Vector3 max, string id = null)

Adds a block to Boxes. Without an id it is “block-1”, “block-2” in order.