Coming soon toSteam
Modding docsAPI 1

Example mod · theonaris.examples.sphere-block 1.0.0

Glow Sphere Block

Adds a sphere block imported from an FBX model with its own texture, icon and placement sound. Spheres light up and shift from cyan to red the faster their creation moves.

Download Glow Sphere Block (308 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 323 KB
Permissions building world audio devtools

A new building block made from an FBX model with its own texture, icon and placement sound, plus Lua logic that makes every sphere glow brighter and redder the faster its creation moves.

You will learnWhere
Declaring a block in JSON, based on one of the game's own blockscontent/blocks/glow-sphere.json
Importing a model (.fbx; .glb, .gltf and .obj work the same way)models/glow-sphere.fbx
Overriding the model's texture and giving the block a palette icon"texture", "icon"
Reacting to blocks appearing and disappearingbuilding.onPlaced, building.onRemoved
Lights, particle effects and per-player settingsworld.empty, addLight, effects.burst, mod.settings
Adding a developer console commanddevtools.command

Try it

  1. Copy this folder into your mods folder (in the game: Mods → Open folder).
  2. Start the game, open Mods, and allow its permissions the first time: Review permissions, Allow, then Apply changes. It asks because it puts lights and effects in the world (world).
  3. Enter the building editor. The Glow Sphere is in the Basic category.
  4. Build something that moves and watch the spheres go from cyan to red. Type /sphere-block.count in the developer console to count them.

How it works

The block is data

mod.json points the blocks content type at content/blocks/*.json. Each file there is one block:

{
  "id": "glow-sphere",
  "name": "Glow Sphere",
  "base": "Cube",
  "model": "/models/glow-sphere.fbx",
  "texture": "/textures/glow-sphere.png",
  "icon": "/icons/glow-sphere.png",
  "collider": "sphere"
}

The behaviour is a script

scripts/client.lua runs on each player's machine. building.onPlaced("glow-sphere", fn) calls fn for every sphere that appears, whether placed, loaded or received. A timer updates a light per sphere, nearest first and capped by a setting, since lights cost performance.

Every object a mod creates (lights, effects, sounds, console commands) is removed automatically when the mod stops. There is no clean-up code.

Files

mod.json                     identity, permissions, settings, content
content/blocks/glow-sphere.json
models/glow-sphere.fbx       1 m UV sphere
textures/glow-sphere.png     hex panels with glowing seams
icons/glow-sphere.png        palette and mod-list icon
sounds/place.wav
scripts/client.lua

Make it yours

All files

FileSize
content/blocks/glow-sphere.json407 B
icons/glow-sphere.png18 KB
mod.json1 KB
models/glow-sphere.fbx41 KB
README.md4 KB
scripts/client.lua4 KB
sounds/place.wav78 KB
textures/glow-sphere.png177 KB