A cottage with its doors and windows.

3D & HD-2D

3D Doors That Open, and Framed Windows

reactor_3d_doors.js · 1,015 lines · 28 public functions

A cottage with its doors and windows.

What This Module Does

An extension of Reactor3D (reactor_3d.js), loaded after the world builder: in the game from scriptUrls, in the editor from Reactor3D.EXTENSIONS, and in Node by the core's own tail.

Classes & Namespaces

Design Notes from the Source Code

An extension of Reactor3D (reactor_3d.js), loaded after the world builder: in the game from scriptUrls, in the editor from Reactor3D.EXTENSIONS, and in Node by the core's own tail.

A door is a piece of its own, hung in a doorway (or a gap in a fence):

{ "kind": "door", "x": 52, "y": 30, "z": 0, "rot": 0, "material": "Wood", "width": 3, "style": "plank", "hinge": "left", "swing": "in", "opens": "auto", "lock": { "switch": 12 }, "message": "It's locked.", "sound": { "open": { "name": "door-open-01", "volume": 80, "pitch": 100 } }, "frame": "Wood", "tag": "inn.front" }

It stands on its cell and the width - 1 cells after it along its own across (rot 0 runs east); rot is the way its front faces (0 south, 1 west, 2 north, 3 east, as a stair's). swing "in" opens away from the front. swing: "away" (the default) opens away from whoever opens it, so a door pushed from inside swings out; "in" always away from the front, "out" always toward it. A leaf never sweeps through a character: it stops short of anyone on its side, and when that side is taken and the other is clearer it opens the other way. opens: "auto" opens for whoever walks up to it and closes behind them, "action" opens and closes with the OK button facing it, "locked" stays shut until its lock is met (a switch on, or the party holding an item; with no lock, a script unlocks it). Each sound is optional; an empty name is silence. Styles: plank, panelled, arched, double (two panelled leaves) and gate (a fence-high gate). Three cells or more hang two leaves.

A window may wear a frame: "frame": { "style": "cottage", "material": "Wood", "shutters": "#3f5f3a", "closed": false, "flowerBox": true } on the window piece; rot points its outside. Windows side by side at one level and turn are framed as one: one sill, one pair of shutters, a mullion between cells.

Drawing: casings, frames, sills, shutters and flower boxes are boxes laid with the pieces (pieceTrims: pieces of kind "trim", one mesh per chunk and material like any wall); only a door's leaves are objects of their own, so they can swing. A closed door blocks like a wall; an open one is its threshold. In the editor and in Node no door is ever shut against a walker.

View reactor_3d_doors.js on GitHub · Show internal (_) functions