Skip to content

Conveyor

Belts on a grid that carry items: a factory’s lines from machine to machine. Each cell of Belts points one way and holds one item at a time; items glide along at Speed cells a second (or a cell’s own speed, for a slow chute dropping onto a fast belt) while the cell ahead is free and wait when it isn’t, so a full end backs the line up. With a Spacing items glide on smoothly several to a cell, each that far behind the one ahead, and bunch up into a pile at a full end. A belt that runs into another’s side merges, the two taking turns; a ConveyorCellKind.Split cell hands items to the belts leading out of it in turn (by item, with Filters), and an ConveyorCellKind.Under cell lets a crossing line pass under it. At a belt’s end a ConveyorPort takes what arrives into a machine, and another puts what the machine makes onto a belt; a script can put items on, take them off and read any cell.

It lies on the cells of its Map (as a grid mover steps on them), so belts line up with the floor and the walls. Items move in fixed steps of game time, so a line plays out the same at any game speed, sped up with Time.FastForward or Time.Scale. Its items are drawn by the conveyor itself, a quad or an image each, so hundreds cost no more than the sprites they look like. While it’s Solid, belts and splitters are walls to grid movers (WalkTo goes round them), and crossings and unders aren’t. It’s saved with the scene, items too, so it rewinds with everything else; in a network game the host moves the items and the players see them.

Works with: Tilemap (lies on its cells); ConveyorPort (takes items off a belt’s end into a machine, or puts them on); GridMovement (walks round solid belts and over crossings)

Draws itself (its entity draws at Order 0 unless it has a Sprite, whose order counts).

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • map: text = null. The tilemap whose cells it lies on. Empty uses the tilemap on its own entity or the one it’s inside, else the first in the scene; with none, cells are world units centered on whole numbers, as for a grid mover. (Names an entity.) (Field: an entity’s name.)
  • belts: lines of text: an array of strings, or one string with line breaks = []. Its cells, one a row: the column and row (counted as a tilemap’s are, row 0 at the top), the way it carries (right, left, up or down) and, for one that isn’t a plain belt, crossing or split, e.g. “4 2 right”, “5 2 right crossing”, “9 2 down split”. A number after the way is the cell’s own speed in cells a second, for a slow chute or a fast run in the same line: “4 2 right 0.5”, “9 2 down split 3”. Lay them from a script with Lay and LayPath, and set speeds with SetSpeed and SetRunSpeed. (Plain text: cells laid a row each, as a tilemap’s rows are, and by scripts as the game runs.) (Field: lines of text.)
  • speed: a number = 2. Cells an item moves a second, up to one a step of the game: every cell’s but those with a speed of their own (a number in its Belts row). An item crossing from a cell of one speed into another’s changes speed at the edge between them. (Field: a number.)
  • spacing: a number = 0. How close an item follows the one ahead, in cells, up to 1: with 0.25 a belt carries up to four items a cell, gliding on smoothly while there’s room ahead and closing up a quarter cell apart behind a full end, a pile you can see. 0 keeps one item a cell, each waiting in its cell’s middle until the cell ahead is free. (Field: a number.)
  • running: true or false = true. While ticked, items move and ports take and put; untick it (or switch it off) to stop the line where it is. (Field: on or off.)
  • solid: true or false = true. Belts and splitters are walls to grid movers, as solid colliders are: one walking somewhere goes round them, and crosses at a crossing. Untick it to let them walk over every belt. (Field: on or off.)
  • layer: text = null. The collision layer its belts are on, like a collider’s: a grid mover with Blocking Layers is stopped only by the layers it names, e.g. “Obstacle”. Empty is “Default”. (Only used when solid is on.) (Names a collision layer.) (Field: a name.)
  • filters: lines of text: an array of strings, or one string with line breaks = []. What a splitter sends onto each belt leading out of it, one a row: that belt’s column and row and the items, e.g. “10 4 Deck, Box”. An item goes to the belts whose filter names it (“Deck” lets “Deck 17” by), else to those with none, in turn; one with nowhere to go waits in the splitter’s middle. Set them from a script with Filter. (Plain text: a belt out of a splitter and the items it takes, a row each.) (Field: lines of text.)
  • items: lines of text: an array of strings, or one string with line breaks = []. What’s on it, one a row: the cell’s column and row and the item, e.g. “4 2 Deck”. Set it to start with items on the belts; the game keeps it up to date as they move. With a Spacing a cell can hold several, and one between cells’ middles has a part column or row: “4.25 2 Deck” is a quarter cell right of (4, 2)’s middle. (Plain text: what’s on each cell: the game writes it as the items move.) (Field: lines of text.)
  • itemSize: a number = 0.5. How big an item is drawn, as a share of a cell. (Field: a number.)
  • itemColor: a color, “#RRGGBB” or “#RRGGBBAA” = “#F2E8C9FF”. The color an item is drawn in when ItemImages has nothing for it. (Field: a color.)
  • itemImages: lines of text: an array of strings, or one string with line breaks = []. What items look like, one a row: the item, a colon, and an image (relative to Assets) or a color, e.g. “Deck: Sprites/deck.png”, “Report: #FFA300”. An item not named here uses its first word’s (“Deck 17” looks like “Deck”), else ItemColor. (Plain text: an item and the image or color it’s drawn with, a row each.) (Field: lines of text.)
  • showBelts: true or false = true. Draws each cell as a plain belt with an arrow the way it carries (crossings lighter, splitters with two arrows), for a line with no art of its own yet. Untick it when a tilemap draws the belts. (Field: on or off.)
  • beltColor: a color, “#RRGGBB” or “#RRGGBBAA” = “#3A404CFF”. The color ShowBelts draws belts in; its arrows are lighter. (Only used when showBelts is on.) (Field: a color.)
  • movingArrows: true or false = false. Slides ShowBelts’ arrows along with the items while the line runs, so the belts look like they move. (Only used when showBelts is on.) (Field: on or off.)
  • beltTiles: text = null. A tilemap (a layer of its own, say) whose animated tiles are belts: they step with this conveyor’s items instead of with time, a run’s frames making up one cell of travel, so belt art moves as fast as the items and stops with the line. (Names an entity.) (Field: an entity’s name.)
  • order: a whole number = 0. Higher draws on top, like Sprite.Order. (Field: a number.)
  • sortByY: true or false = false. Sorts each item by its own height, when the camera sorts by Y: an item lower down the screen is drawn in front of a worker standing behind it. (Field: on or off.)

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • count: a whole number. How many items are on it.

Scripts use it as Conveyor: its methods, events and values that aren’t saved with the scene.