Scripting API
Scripting API
WorldTilemaps
Struct in Abyss.Core, from Abyss.Core.
Tilemaps, as a game drives them from its code: an entity's Tilemap given its tiles by where they are, one or many at once, read, cleared, and given its tile set.
public readonly struct WorldTilemapsRemarks
A cell is a whole number of tiles along X and up Y from its Tilemap's entity, the cell at 0, 0 filling the square from its origin to one tile along each; WorldTilemaps.CellAt says which cell a point of the world is over. Many tiles set at once — a level built from code — write the Tilemap's tiles once, and each square of 16 by 16 cells changed is made again once, at the next frame.
Constructors
WorldTilemaps
public WorldTilemaps(World world)Tilemaps, as a game drives them from its code: an entity's Tilemap given its tiles by where they are, one or many at once, read, cleared, and given its tile set.
Parameters
world: The world they are in.
A cell is a whole number of tiles along X and up Y from its Tilemap's entity, the cell at 0, 0 filling the square from its origin to one tile along each; WorldTilemaps.CellAt says which cell a point of the world is over. Many tiles set at once — a level built from code — write the Tilemap's tiles once, and each square of 16 by 16 cells changed is made again once, at the next frame.
Methods
SetTile
public void SetTile(ulong entity, int x, int y, Tile tile)Puts tile in the cell at x, y of the Tilemap on an entity; Tile.None empties it.
Parameters
entityxytile
Exceptions
AbyssException: The id packs no entity, the entity is gone, it carries no Tilemap, or its tiles cannot be read (AbyssStatus.InvalidTiles).
SetTiles
public void SetTiles(ulong entity, ReadOnlySpan<PlacedTile> tiles)Puts each of tiles in its cell of the Tilemap on an entity, writing its tiles once.
Parameters
entitytiles
Exceptions
AbyssException: AsWorldTilemaps.SetTilesays.
TileAt
public Tile TileAt(ulong entity, int x, int y)What the cell at x, y of the Tilemap on an entity holds: Tile.None for nothing.
Parameters
entityxy
Exceptions
AbyssException: AsWorldTilemaps.SetTilesays.
Tiles
public IReadOnlyList<PlacedTile> Tiles(ulong entity)Every cell of the Tilemap on an entity holding a tile, and its tile.
Parameters
entity
Exceptions
AbyssException: AsWorldTilemaps.SetTilesays.
Fill
public int Fill(ulong entity, int x, int y, Tile tile)Fills the cells of the Tilemap on an entity joined by their sides to the cell at x, y, holding what it holds, with tile — Tile.None empties them — writing its tiles once: how many changed.
Parameters
entityxytile
Exceptions
AbyssException: AsWorldTilemaps.SetTilesays.
Empty cells are joined no further than the smallest rectangle round the Tilemap's tiles and the cell, so a fill outside its tiles does not go on for ever.
Clear
public void Clear(ulong entity)Takes every tile off the Tilemap on an entity.
Parameters
entity
Exceptions
AbyssException: The id packs no entity, the entity is gone, or it carries no Tilemap.
TileSize
public Vector2 TileSize(ulong entity)How wide and tall a tile of the Tilemap on an entity is, in units: its Tile Size each way that says one, and its tile set's own where it says zero — a tile's pixels over its Pixels Per Unit, as a sprite of the slice would be drawn — or a unit while its tile set's slices are not known.
Parameters
entity
Exceptions
AbyssException: The id packs no entity, the entity is gone, or it carries no Tilemap.
CellAt
public (int X, int Y) CellAt(ulong entity, Vector3 point)The cell of the Tilemap on an entity that the world's point point is over: what a character stands on, or what was clicked.
Parameters
entitypoint
Exceptions
AbyssException: The id packs no entity, the entity is gone, it carries no Tilemap, or its tiles are no size across (AbyssStatus.InvalidTiles).
OutlineVersion
public ulong OutlineVersion(ulong entity)The version of the outline of the Tilemap on an entity as Physics 2D meets it, which changes only as the outline does: as its tiles, its tile set's collisions or its tile size change.
Parameters
entity
Exceptions
AbyssException: AsWorldTilemaps.SetTilesays.
Outlines
public IReadOnlyList<TileOutline> Outlines(ulong entity, out ulong version)The outline of the Tilemap on an entity as Physics 2D meets it, and its version: a loop round each region of solid tiles joined by their sides, each straight run one piece, and a line along the top of each row of one-way tiles, in the Tilemap's own units. A tile's slice says how it is met (SpriteSlice.Collision); while the world knows none of the tile set's slices, every tile is solid.
Parameters
entityversion
Exceptions
AbyssException: AsWorldTilemaps.SetTilesays.
TileNamed
public Tile TileNamed(ulong entity, string name)The slice called name of the tile set of the Tilemap on an entity, as a tile, as it is.
Parameters
entityname
Exceptions
AbyssException: The Tilemap has no tile set from a file, the world has not been given its slices, or it has no slice of that name, which says the names it has (AbyssStatus.InvalidSpriteSheet); or the id packs no entity, the entity is gone, or it carries no Tilemap.
SetTileset
public void SetTileset(ulong entity, ImageId image)Gives the Tilemap on an entity image as its tile set, default for none.
Parameters
entityimage
Exceptions
AbyssException: The image is not one, the id packs no entity, the entity is gone, or it carries no Tilemap.
A scene keeps it as one of the Tilemap's choices, tileset, as a sprite keeps its image.
Tileset
public ImageId Tileset(ulong entity)The image the Tilemap on an entity takes its tiles from: default for none, and for one the engine neither made nor read.
Parameters
entity
Exceptions
AbyssException: The id packs no entity, the entity is gone, or it carries no Tilemap.
