Skip to content

ExpansionDefinition

public sealed class ExpansionDefinition

Namespace MapExpansions

Everything the framework needs to build one expansion: where its content comes from, where it goes, which regions and named places it brings, and how it joins the main world. A consumer mod fills one and passes it to MapExpansionsApi.Register before the main menu opens.

Expansion-local coordinates are the coordinates of the source scene. The framework turns them into world coordinates with Offset and QuarterTurns; main-world coordinates stay as they are.

public string Id { get; set; }

Stable id; part of every saved identity the expansion produces. Lowercase, no spaces.

public string DisplayName { get; set; }
public string Version { get; set; }

Content version of the consumer, compared between host and clients.

public WorldSource Source { get; set; }

Type: WorldSource

The scene the expansion’s own world comes from. Null makes the expansion an edit layer over the main world: nothing is captured, it has no terrain, connections or separate views, and its offset is zero.

public Vector3 Offset { get; set; }

World position of the source scene’s origin.

public int QuarterTurns { get; set; }

Clockwise quarter turns seen from above. Terrains turn only in whole quarter turns.

public List<RegionDefinition> Regions { get; }

Type: RegionDefinition

public MapSheetDefinition Map { get; set; }

Type: MapSheetDefinition

The expansion’s part of the phone map; without it the expansion is not on the map.

public List<ConnectionDefinition> Connections { get; }

Type: ConnectionDefinition

public List<ObjectRule> Hide { get; }

Type: ObjectRule

Objects switched off when the expansion is built, in the expansion or in the main world.

public List<GroundPlate> GroundPlates { get; }

Type: GroundPlate

Large flat plates of the source that are replaced by a plate over a smaller local area.

public List<LocationDefinition> Locations { get; }

Type: LocationDefinition

Named places inside the expansion, resolved through LocationRef.

public List<BuildingDefinition> Buildings { get; }

Type: BuildingDefinition

Buildings NPCs can enter, created on every peer when the expansion is built.

public List<ParkingLotDefinition> ParkingLots { get; }

Type: ParkingLotDefinition

Parking lots for NPC cars, created on every peer when the expansion is built.

public List<DealLocationDefinition> DealLocations { get; }

Type: DealLocationDefinition

Places where customers of the expansion’s regions wait for deals.

public List<PropertyDefinition> Properties { get; }

Type: PropertyDefinition

Properties the player can buy, copied from main-world properties.

public List<WorldStateDefinition> WorldStates { get; }

Type: WorldStateDefinition

Named local states, initially dormant. One expansion per independent upgrade retains completed effects.

public PoliceStationDefinition PoliceStation { get; set; }

Type: PoliceStationDefinition

The expansion’s own police station. A player arrested in the expansion is set free there instead of at the main world’s station, and the car taken from them is parked there. Null leaves arrests to the main world.

public List<ShopDefinition> Shops { get; }

Type: ShopDefinition

Shops with a seller at the counter, each with the main-world interior and doors it copies.

public List<CopyDefinition> Copies { get; }

Type: CopyDefinition

Main-world objects copied into the expansion outside any shop, such as furniture.

public Rect VehicleArea { get; set; }

Local rectangle the vehicle graph covers, in addition to the connections. Empty means the bounds of the source terrains.

public float MinimumWorldHeight { get; set; }

The lowest height the expansion may reach in the world; lower terrain is reported on build.

public bool SeparateViews { get; set; }

Each world is drawn only while the camera is on its side, as if the other were not there: in the expansion the main world’s map is not drawn, in the main world the expansion is not drawn. The side changes in the middle of each connection’s built stretch, where neither end can be seen; the connections are always drawn. For an expansion whose source had its own backdrop, such as a ring of distant mountains, that would stand in the other world. Colliders, characters and vehicles stay as they are.

public List<string> MainViewRoots { get; }

Root objects of the main scene that are not drawn in the expansion with SeparateViews. Nothing that can move between the worlds may lie under them; objects under a rigidbody are always drawn.

public List<string> SharedViewObjects { get; }

Main-world objects drawn on both sides with everything under them, by name prefix; the sea lies under both worlds.

public LayerSource Layer { get; set; }

Type: LayerSource

The JSON layer a map editor wrote for this expansion, laid over this definition each time the world is built. A file Mods/<Id>/map.json wins over it. Null means no layer.

public ExpansionDefinition UseLayer(
System.Reflection.Assembly assembly,
string resourceName)

Sets Layer to an embedded resource of the given assembly.