@adatechnology/game-interactables-household
Household content pack for @adatechnology/game-interactables: 51 objects for houses, yards, rural homes and camping (fridge, cabinets, wardrobe,
drawers, stove, gas bottle, sinks, shower, toilet, sockets, service entrance, TV, sofa, beds, blinds, bins, mailbox, dog house, barbecue,
clothesline, bunk bed, wood stove, fireplace, outhouse, well, cooler, campfire, camp stove...) modeled with real depth: doors hinged on the front edge that never go through the wall, hollow carcasses with lighter inner
liners, real open-top drawers, door trays, handles, hinges and gaps between doors.
Each type draws through an api the host passes in (the same primitives as @adatechnology/game-props3d, plus part) and
returns an ObjectSpec (parts, containers with slots, seats, fixtures, devices, wires, emitters, mirrors, soft volumes, colliders...) that
@adatechnology/game-interactables runs. Nothing here depends on a renderer or on a game; three is not even required.
Install
pnpm add @adatechnology/game-interactables-household @adatechnology/game-interactables
Browser without a bundler (the global is GameInteractablesHousehold):
<script src="https://unpkg.com/@adatechnology/game-interactables-household/dist/index.global.js"></script>
<script>
const hh = GameInteractablesHousehold.createHousehold({ locale: 'pt-BR', region: 'br' })
</script>
Usage
import { createHousehold } from '@adatechnology/game-interactables-household'
import { createWorld } from '@adatechnology/game-interactables'
const hh = createHousehold({ locale: 'pt-BR', region: 'br' })
const world = createWorld({ locale: 'pt-BR', strings: hh.strings, items: hh.items, loot: hh.loot, seed: 'house-1' })
// `api` is yours. Parts become movable groups; everything else is drawn as usual.
const api: HouseholdApi = {
box: (M, material, x, y, z, w, h, d, color, ry, rx, rz) => { /* base of the box at y */ },
cylinder: (M, material, x, y, z, r, h, color, rx, rz, shape) => { /* ... */ },
leaf: () => {},
plane: (M, material, x, y, z, w, h, color, ry, rx, rz, uv) => { /* ... */ },
part(id, pivot, ry, draw) {
const group = makeGroup(id, pivot, ry) // one movable group per part
withGroup(group, draw) // everything `draw` emits is in the part frame
},
}
const item = { x: 2, z: 3, ry: 0, seed: 1, contents: { fridge: [{ type: 'milk_carton', qty: 2 }, null] } }
const spec = hh.build('fridge', item, api) // draws the static parts and the movable ones, returns the ObjectSpec
world.add('fridge-1', spec, { x: 2, y: 0, z: 3, ry: 0 })
Every frame the host calls world.update(dt), reads world.partT(id, 'door_fridge') to turn the matching group, world.sway(...) for soft
volumes (clothes, curtains, glass), world.emitters() for flames, smoke, steam and water, and world.mirrors(...) for reflections.
API
| Member |
Description |
createHousehold({ locale?, region? }) |
Creates the pack. locale is en (default) or pt-BR; region is br or us (default: br for pt-BR, else us) |
hh.types |
[{ id, name, group, w, d, h, y, solid, massKg }], name localized. y is the default mounting height, solid: false marks wall items and wires, massKg is the real mass of the whole object, empty (absent for what is built into the ground) |
hh.items |
ItemCatalog, the 92 household items (same ids as before) with size, weight, stack, shape, color, category (one of the 14 of game-items; the old household category is in tags) and the rest of the game-items ItemDef. They come from @adatechnology/game-items-goods; HOUSEHOLD_ITEM_IDS lists them |
hh.loot |
LootTables for fridge, freezer, kitchen_cabinet, kitchen_drawer, pantry, wardrobe, dresser, nightstand, bathroom_cabinet, under_sink, trash, mailbox, bbq_counter, garage_shelf |
hh.strings |
{ en, 'pt-BR' }: type.<id>, item.<id> (from the goods locales), prompt.<x> (with .open / .closed / .on / .off variants) and letter.* texts. Pass it to createWorld({ strings }) |
hh.region |
Data of the region (regions/<id>.json): gas bottle, small gas canister, socket standard and voltage, mailbox style, clothesline style |
hh.build(type, item, api) |
Draws through api and returns the ObjectSpec. Deterministic for the same item.seed |
createRecorder() |
{ api, primitives, parts }: records static primitives in primitives and the ones drawn inside a part under parts[id] ({ id, pivot, ry, primitives }), for tests and previews |
cornersOf, motionPoint, sweepOf |
Geometry helpers used for sweep rects and tests |
HouseholdApi is PropsApi plus part(id, pivot, ry, draw): everything drawn inside draw is in the part's frame (relative to the pivot,
rotated by ry, which is always 0 in this pack), so the host makes one movable group per part. Conventions are those of props3d: front = local
+z, origin at the center of the footprint on the floor, box and cylinder base at y, plane centered, material keys plain, metal,
wood, glass, fabric, emissive.
The item
HouseholdItem is a props3d PropItem (w, d, h, y, color, palette, seed, variant, on, open, retracted...) plus:
| Field |
Meaning |
contents |
{ [containerId]: Array<{ type, qty, data? } \| null> }, slot by slot. Wins over the loot table |
hinge |
'left' or 'right', side of the hinge of single-door types |
circuit |
Circuit of a wall_socket and of the shower heater |
controls |
Device ids a wall_switch toggles |
points |
conduit_run: polyline in object-local coordinates |
circuits |
electrical_panel: [{ id, label? }], one breaker per circuit (default one circuit main) |
requires |
gas_bottle in a cabinet: { object, part } (world-wide object id); the valve is usable only while that part is open |
flueHeight, chimneyHeight |
wood_stove / fireplace: where the flue pipe or chimney ends and the smoke emitter sits (default: the item height; pass h too when it is taller) |
house, sag |
service_entrance: where the drop wire ends (object-local) and how much it sags; variant: 'gato' is an illegal tap: a bare drop wire, no pole, riser or meter box |
variant |
fridge: 'steel'; pantry: 'garage' (open steel shelves, loot garage_shelf); blinds: 'wood', 'closed' (starts with the slats closed); dog_house: 'no_bowl'; fireplace: 'stone' (default brick); lantern_lamp: 'hanging' (chain, no collider); campfire has log seats when the footprint is at least 2 m |
Types
Dimensions are the defaults (w x d x h in meters; y = mounting height). Every part, container and seat id is stable and snake_case.
Storage with real depth
| Type |
Size |
What it exposes |
fridge |
0.7 x 0.7 x 1.8 |
door_fridge, door_freezer hinged on the front edge (97 degrees), five lighter inner faces, glass shelves, door trays as slots that follow the door; containers fridge, freezer; compressor device with cord |
fridge_compact |
0.5 x 0.55 x 0.85 |
door_fridge plus a door_freezer flap hinged at the bottom; same containers |
kitchen_cabinet_base |
0.8 x 0.6 x 0.9 |
drawer and door_1, door_2 (one door under 0.6 m), shelf; containers cupboard, drawer |
kitchen_cabinet_wall |
0.8 x 0.35 x 0.7, y 1.4 |
door_1, door_2, shelf; container cupboard |
pantry |
0.8 x 0.45 x 2.0 |
door_1, door_2, five shelves; container shelves. variant: 'garage' = open steel shelf, loot garage_shelf |
wardrobe |
1.6 x 0.6 x 2.1 |
2 doors (3 from 1.4 m), hanging rod with clothes, vertical divider, shelves, drawer_n under the doors; mirror = plane on the outer face of door 2, 4 mm proud, drawn inside that door's part, plus a MirrorSpec with part. Containers shelves, drawer_n |
dresser |
1.0 x 0.5 x 0.9 |
drawer_1..4, legs, overhanging top; containers drawer_n |
nightstand |
0.45 x 0.4 x 0.55 |
drawer, door; containers drawer, cupboard |
bathroom_cabinet |
0.6 x 0.15 x 0.75, y 1.3 |
door carries the mirror (plane + MirrorSpec), glass shelves; container cabinet |
Drawers are real open-top boxes (bottom, two sides, back and a front panel with raised center and handle). Nothing sticks out of the carcass
when closed, the slide distance is 0.75 x the inner depth, slots sit on the drawer bottom and carry part.
Kitchen and bathroom