Coming soon toSteam
Modding docsAPI 1

Example mod · theonaris.examples.block-mover 1.0.0

Block Mover

A building tool that nudges the selected blocks by exact steps, including into the space of other blocks, for details the normal editor does not allow.

Download Block Mover (139 KB)
Install: put the .zip (or the unpacked folder) in your mods folder: in the game, Mods → Open folder. Then start the game and allow the permissions.
Runs on both
Multiplayer required
Size 146 KB
Permissions building building.overlap net ui input audio

A small building tool that moves the selected blocks by exact steps along the creation's own axes, and lets them move into other blocks. That is how you build details the normal editor refuses: a pipe sunk halfway into a hull, overlapping armour plates, a light set into a wall.

You will learnWhere
A toolbar tool with a window that opens and closesbuilding.addTool, BuildTool:setActive
Following the selection without pollingbuilding.onSelectionChanged
Keys that are only bound while a window is openinput.bind / KeyBinding:off
Asking the server to change a creationnet.send("move", …)
Validating everything a client sendsnet.handle with a schema and a rate in server.lua, then limits and snapping
Moving blocks past the overlap checkbuilding.tryMoveInto (server, needs building.overlap)
Telling the player why a request was refusedreturn false, reason in the handler, net.on("denied", …) on the client
Choice settings"type": "choice" in mod.json

Try it

  1. Install, host or join a game with the mod, and allow the permissions.
  2. In the building editor, select one or more blocks and click ⇲ Mover.
  3. Pick a step (0.05 m is one lattice step; a block is 0.2 m) and press the arrows, or Numpad 4/6 (X), 1/7 (Y) and 2/8 (Z).

What building.moveInto does and does not allow

The server script calls building.tryMoveInto: the same move, but a refusal returns false and the reason instead of raising an error, and the script passes that reason back to the player on "denied".

The server script adds its own limits on top: at most 2 m per nudge, 20 nudges a second (net.handle's rate), and at most maxBlocks blocks at once, a server setting that belongs to the host. None of these values come from the client.

Files

mod.json
scripts/client.lua     tool, window, selection, key bindings, request
scripts/server.lua     net.handle, snapping, limits, building.tryMoveInto
ui/mover.uxml, ui/mover.uss
sounds/nudge.wav, overlap.wav, denied.wav

All files

FileSize
mod.json1 KB
README.md3 KB
scripts/client.lua4 KB
scripts/server.lua2 KB
sounds/denied.wav52 KB
sounds/nudge.wav21 KB
sounds/overlap.wav60 KB
ui/mover.uss2 KB
ui/mover.uxml1 KB