Log inGet started
World

First Light: Betocsin

Branchmain
Branchesmain
Commit065ea629bf

README.md

Blocks

The lozenged masonry of First Light: Betocsin, and the two hero pieces beside it — the tocsin and the crane that brings the courses in.

local Blocks = require("game.blocks.Blocks")

local e = Blocks.spawnSlab({ course = 1, a = 2.4, b = 2.4, cu = 0, cv = 0, tone = 1 })
Blocks.reshape(e, a, b, cu, cv, course)   -- after a trim, the same entity
Blocks.markPerfect(course, true)          -- a gilt line along that course's arris
local off = Blocks.spawnOffcut(spec)      -- the overhang, thrown off the tower
Blocks.spawnPlinth(parent)                -- the ruined stump the tower stands on

Every course is a parallelogram prism cut to the lozenge game.core defines — edges a along Core.U and b along Core.V, COURSE_HEIGHT tall — with a chamfered arris top and bottom, which is what makes one course read as its own stone. tone is 1 or 2: the alternating tinctures of the lozengy field. Sizes are quantised to a centimetre so a tower's worth of trims shares a handful of meshes.

The hero pieces

They stand themselves up the first time a course is seated and drive themselves from Core.state, so nothing has to call them:

local crane = Blocks.spawnCrane(parent)   -- a handle, not an entity
crane:setHang(cu, cv, y)                  -- put the hook exactly here for a moment
crane:swingTo("u", t)                     -- ... or on the swing axis
crane:release()                           -- back to following Core.state.swing

Blocks.spawnBell(parent)                  -- the bell, its frame and its clapper
Blocks.hoistBell(t)                       -- 0 fallen on the plinth, 1 hung on the last course
Blocks.ringBell(quality)                  -- swing it; the clapper lags behind
Blocks.setBellGlint(dawn)                 -- how hard first light is on the bronze

setHang and swingTo are momentary: stop calling them and the crane hands itself back to Core.state.swing after about half a second.

What it is made of

  • game.blocks.Geo — the mesh builders (the chamfered prism, the revolve, the sawn box, and the merge that makes a whole timber bay one mesh).
  • stonecut.shader + masonry.material — the masonry, one material for the whole tower with the tincture per instance.
  • bellbronze.shader + bell_bronze.material — the cast bronze.
  • hewn.shader + crane_timber / crane_rope / crane_iron — the gantry.
  • game.blocks.Crane, game.blocks.Tocsin, game.blocks.Offcut — the three behaviours those pieces carry.