BlockBuilder
namespace Griff.Modules.BlockWorlds;
public sealed class BlockBuilder : ComponentDigs 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.
Blocks go down next to another block, never in mid-air or on top of someone.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”CanBuild
Section titled “CanBuild”public bool CanBuild { get; set; }Whether it can put blocks down.
CanMine
Section titled “CanMine”public bool CanMine { get; set; }Whether it can dig blocks out (with Attack).
Controllable
Section titled “Controllable”public bool Controllable { get; set; }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.
Highlight
Section titled “Highlight”public Color Highlight { get; set; }The color of the outline around the block it’s pointing at. Transparent hides it.
public string? Item { get; set; }The item it puts down. The Hotbar sets it to whatever’s picked there.
MineSpeed
Section titled “MineSpeed”public float MineSpeed { get; set; }How fast it digs: 2 breaks blocks in half the time.
PlaceAt
Section titled “PlaceAt”public ValueTuple<int, int>? PlaceAt { get; }The empty cell it would put a block in, if any.
Progress
Section titled “Progress”public float Progress { get; }How far through breaking Target it is, from 0 to 1.
public float Reach { get; set; }How far away it can reach a block, in world units from the middle of the entity.
Target
Section titled “Target”public ValueTuple<int, int>? Target { get; }The block it’s pointing at, if any, as a cell of the world’s map.
public string? World { get; set; }The name of the world’s entity. Empty uses the first Blocks map in the scene.