BlockBuilder
Digs up and puts down the blocks of a Blocks world with the mouse: hold the left button on a block to mine it (it goes in the Inventory), and click the right button to put down the Item (the one picked on the Hotbar). In first person it works on the block straight ahead.
Part of the Block Worlds module: Block worlds, Terraria style: worlds made from a seed (WorldGenerator), blocks that break, fall, glow and are kept in the save data (Blocks), digging and building (BlockBuilder), a Hotbar and Crafting, and the Sandbox template.
Blocks go down next to another block, never in mid-air or on top of someone.
Works with: Hotbar (to pick which block to put down); Inventory (holds what’s mined (one is added if there’s none))
Takes the player’s input only while it has focus (its Controllable): its Focus action hands it the input and takes it from everything else the same player plays.
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.
reach: a number = 5. How far away it can reach a block, in world units from the middle of the entity. (A distance: the Scene view draws it as a circle around the entity, with a handle to drag.) (Field: a number.)mineSpeed: a number = 1. How fast it digs: 2 breaks blocks in half the time. (Field: a number.)canMine: true or false = true. Whether it can dig blocks out (with Attack). (Field: on or off.)canBuild: true or false = true. Whether it can put blocks down. (Field: on or off.)controllable: true or false = true. Untick it to have it ignore the mouse (no digging or building, and its hotbar and crafting ignore their keys): another part of the scene has the player’s input. Its Focus action ticks it and unticks it on everything else the player plays, and another’s Focus takes it back. (Field: on or off.)item: text = “Dirt”. The item it puts down. The Hotbar sets it to whatever’s picked there. (Names an item.) (Field: a name.)world: text = null. The name of the world’s entity. Empty uses the first Blocks map in the scene. (Names an entity.) (Field: an entity’s name.)highlight: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFFB2”. The color of the outline around the block it’s pointing at. Transparent hides it. (Field: a color.)
Actions
Section titled “Actions”What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).
Focus. Gives its entity the player’s input: whatever there and inside it has focus, and everything else the same player plays loses it (a platformer’s player stops on the arrow keys while a board takes them).
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.
target: [x, y], whole numbers or null. The block it’s pointing at, if any, as a cell of the world’s map.placeAt: [x, y], whole numbers or null. The empty cell it would put a block in, if any.progress: a number. How far through breaking Target it is, from 0 to 1. (Sent in a network game.)
Scripts use it as BlockBuilder: its methods, events and values that aren’t saved with the scene.