WallRooms
The rooms walls make on a tilemap’s grid, for heat, air, occupancy or anything else that goes by room: every patch of floor cells joined side by side (four ways; six on a hex map) without crossing a wall. Walls are the map’s solid tiles on any of its layers (as grid movers see them), its WallTiles even where they can be walked through (a door counts as shut), and solid colliders on WallLayers. A room that reaches past the map’s edge (or, with EmptyIsOutside, an empty cell) is open to the outside. Put it on the tilemap whose cells make the rooms.
Not a camera’s Room: these are found from the walls, not placed. They’re worked out again only when the walls change (a tile painted, a wall collider added, moved or taken away), and Changed says when they have, at the end of that step. A script that changes walls and wants the new rooms in the same step calls Refresh.
Each room keeps its WallRoom.Id as walls go up and come down: split in two, the bigger part keeps it; joined, the room takes the id of the one it has most of. A new room gets a new id.
Requires: Tilemap
Draws itself, along with the rest of its entity (it doesn’t set the entity’s draw order).
Properties
Section titled “Properties”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.
solidTiles: true or false = true. The map’s solid tiles (on it and its layers) are walls, as they are to grid movers. Untick it to count only WallTiles and WallLayers. (Field: on or off.)wallTiles: text = null. Tiles that are walls to rooms even where they can be walked through, on the map or any of its layers: a door’s tiles, so a door counts as shut. Tile numbers and ranges, e.g. “300-301”. Empty for none. (Tiles of the tilemap’s tilesets by number (the first tileset’s from 0, the next’s from 100, then 200…): a string of numbers and ranges like “10-15, 20”, or for a whole number one tile. The Inspector shows the tiles to click.) (Field: its own editor: Tile Numbers.)wallLayers: text = null. Collision layers whose solid colliders are walls too, over a cell’s middle, e.g. “Walls, Doors”: walls built as entities rather than painted. Grid movers (workers walking about) never are. Empty for none. (Names collision layers: their names, separated by commas.) (Field: a name.)emptyIsOutside: true or false = false. Cells with no tile on the map or any of its layers are outside, like the cells past its edge, so a room next to one is open: a floor painted in the shape of a building, or a ship’s hull with a hole in it. (Field: on or off.)message: text = null. A message sent with Game.Send whenever the rooms change, with this entity as its data. (Names a message.) (Field: a name.)show: true or false = false. Tints each closed room a color of its own (open ones aren’t tinted), to see where the walls close rooms off. (Field: on or off.)
Outputs
Section titled “Outputs”What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.
Closed(a whole number). How many rooms the walls close off: those not open to the outside.RoomArea(a whole number, read by a entity after a colon, e.g. “RoomArea:Furnace”). The area, in cells, of the room the entity called this stands in; 0 when it’s in none (on a wall, or off the map).RoomId(a whole number, read by a entity after a colon, e.g. “RoomId:Furnace”). The WallRoom.Id of the room the entity called this stands in; 0 when it’s in none.
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
closed: a whole number. How many rooms the walls close off: those not open to the outside.map: an entity with a Tilemap: its name, id or path. The tilemap whose cells make the rooms: the one on its entity (the map it’s a layer of, for a layer).
Scripts use it as WallRooms: its methods, events and values that aren’t saved with the scene.