@adatechnology/game-interactables-household 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anderson Fernandes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,262 @@
1
- # Temporary Holding Version
1
+ # @adatechnology/game-interactables-household
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Household content pack for [`@adatechnology/game-interactables`](../game-interactables): 51 objects for houses, yards, rural homes and camping (fridge, cabinets, wardrobe,
4
+ drawers, stove, gas bottle, sinks, shower, toilet, sockets, service entrance, TV, sofa, beds, blinds, bins, mailbox, dog house, barbecue,
5
+ 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
6
+ liners, real open-top drawers, door trays, handles, hinges and gaps between doors.
7
+
8
+ Each type draws through an `api` the host passes in (the same primitives as [`@adatechnology/game-props3d`](../game-props3d), plus `part`) and
9
+ returns an `ObjectSpec` (parts, containers with slots, seats, fixtures, devices, wires, emitters, mirrors, soft volumes, colliders...) that
10
+ `@adatechnology/game-interactables` runs. Nothing here depends on a renderer or on a game; `three` is not even required.
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ pnpm add @adatechnology/game-interactables-household @adatechnology/game-interactables
16
+ ```
17
+
18
+ Browser without a bundler (the global is `GameInteractablesHousehold`):
19
+
20
+ ```html
21
+ <script src="https://unpkg.com/@adatechnology/game-interactables-household/dist/index.global.js"></script>
22
+ <script>
23
+ const hh = GameInteractablesHousehold.createHousehold({ locale: 'pt-BR', region: 'br' })
24
+ </script>
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```ts
30
+ import { createHousehold } from '@adatechnology/game-interactables-household'
31
+ import { createWorld } from '@adatechnology/game-interactables'
32
+
33
+ const hh = createHousehold({ locale: 'pt-BR', region: 'br' })
34
+ const world = createWorld({ locale: 'pt-BR', strings: hh.strings, items: hh.items, loot: hh.loot, seed: 'house-1' })
35
+
36
+ // `api` is yours. Parts become movable groups; everything else is drawn as usual.
37
+ const api: HouseholdApi = {
38
+ box: (M, material, x, y, z, w, h, d, color, ry, rx, rz) => { /* base of the box at y */ },
39
+ cylinder: (M, material, x, y, z, r, h, color, rx, rz, shape) => { /* ... */ },
40
+ leaf: () => {},
41
+ plane: (M, material, x, y, z, w, h, color, ry, rx, rz, uv) => { /* ... */ },
42
+ part(id, pivot, ry, draw) {
43
+ const group = makeGroup(id, pivot, ry) // one movable group per part
44
+ withGroup(group, draw) // everything `draw` emits is in the part frame
45
+ },
46
+ }
47
+
48
+ const item = { x: 2, z: 3, ry: 0, seed: 1, contents: { fridge: [{ type: 'milk_carton', qty: 2 }, null] } }
49
+ const spec = hh.build('fridge', item, api) // draws the static parts and the movable ones, returns the ObjectSpec
50
+ world.add('fridge-1', spec, { x: 2, y: 0, z: 3, ry: 0 })
51
+ ```
52
+
53
+ Every frame the host calls `world.update(dt)`, reads `world.partT(id, 'door_fridge')` to turn the matching group, `world.sway(...)` for soft
54
+ volumes (clothes, curtains, glass), `world.emitters()` for flames, smoke, steam and water, and `world.mirrors(...)` for reflections.
55
+
56
+ ## API
57
+
58
+ | Member | Description |
59
+ |---|---|
60
+ | `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`) |
61
+ | `hh.types` | `[{ id, name, group, w, d, h, y, solid }]`, `name` localized. `y` is the default mounting height, `solid: false` marks wall items and wires |
62
+ | `hh.items` | `ItemCatalog`, 90 household items with `size`, `weight`, `stack`, `shape`, `color`, category |
63
+ | `hh.loot` | `LootTables` for `fridge`, `freezer`, `kitchen_cabinet`, `kitchen_drawer`, `pantry`, `wardrobe`, `dresser`, `nightstand`, `bathroom_cabinet`, `under_sink`, `trash`, `mailbox`, `bbq_counter`, `garage_shelf` |
64
+ | `hh.strings` | `{ en, 'pt-BR' }`: `type.<id>`, `item.<id>`, `prompt.<x>` (with `.open` / `.closed` / `.on` / `.off` variants) and `letter.*` texts. Pass it to `createWorld({ strings })` |
65
+ | `hh.region` | Data of the region (`regions/<id>.json`): gas bottle, small gas canister, socket standard and voltage, mailbox style, clothesline style |
66
+ | `hh.build(type, item, api)` | Draws through `api` and returns the `ObjectSpec`. Deterministic for the same `item.seed` |
67
+ | `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 |
68
+ | `cornersOf`, `motionPoint`, `sweepOf` | Geometry helpers used for sweep rects and tests |
69
+
70
+ `HouseholdApi` is `PropsApi` plus `part(id, pivot, ry, draw)`: everything drawn inside `draw` is in the part's frame (relative to the pivot,
71
+ 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
72
+ `+z`, origin at the center of the footprint on the floor, `box` and `cylinder` base at `y`, `plane` centered, material keys `plain`, `metal`,
73
+ `wood`, `glass`, `fabric`, `emissive`.
74
+
75
+ ### The item
76
+
77
+ `HouseholdItem` is a props3d `PropItem` (`w`, `d`, `h`, `y`, `color`, `palette`, `seed`, `variant`, `on`, `open`, `retracted`...) plus:
78
+
79
+ | Field | Meaning |
80
+ |---|---|
81
+ | `contents` | `{ [containerId]: Array<{ type, qty, data? } \| null> }`, slot by slot. Wins over the loot table |
82
+ | `hinge` | `'left'` or `'right'`, side of the hinge of single-door types |
83
+ | `circuit` | Circuit of a `wall_socket` and of the shower heater |
84
+ | `controls` | Device ids a `wall_switch` toggles |
85
+ | `points` | `conduit_run`: polyline in object-local coordinates |
86
+ | `circuits` | `electrical_panel`: `[{ id, label? }]`, one breaker per circuit (default one circuit `main`) |
87
+ | `requires` | `gas_bottle` in a cabinet: `{ object, part }` (world-wide object id); the valve is usable only while that part is open |
88
+ | `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) |
89
+ | `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 |
90
+ | `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 |
91
+
92
+ ## Types
93
+
94
+ 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.
95
+
96
+ ### Storage with real depth
97
+
98
+ | Type | Size | What it exposes |
99
+ |---|---|---|
100
+ | `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 |
101
+ | `fridge_compact` | 0.5 x 0.55 x 0.85 | `door_fridge` plus a `door_freezer` flap hinged at the bottom; same containers |
102
+ | `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` |
103
+ | `kitchen_cabinet_wall` | 0.8 x 0.35 x 0.7, y 1.4 | `door_1`, `door_2`, shelf; container `cupboard` |
104
+ | `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` |
105
+ | `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` |
106
+ | `dresser` | 1.0 x 0.5 x 0.9 | `drawer_1..4`, legs, overhanging top; containers `drawer_n` |
107
+ | `nightstand` | 0.45 x 0.4 x 0.55 | `drawer`, `door`; containers `drawer`, `cupboard` |
108
+ | `bathroom_cabinet` | 0.6 x 0.15 x 0.75, y 1.3 | `door` carries the mirror (plane + `MirrorSpec`), glass shelves; container `cabinet` |
109
+
110
+ **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
111
+ when closed, the slide distance is 0.75 x the inner depth, slots sit on the drawer bottom and carry `part`.
112
+
113
+ ### Kitchen and bathroom
114
+
115
+ | Type | Size | What it exposes |
116
+ |---|---|---|
117
+ | `stove` | 0.6 x 0.65 x 0.9 | four burners (`burner_1..4`) and an `oven`, each with a `knob_*` part, `fuel: 'auto'`, flame emitters, `oven_door` hinged at the bottom, `gas_hose` wire to the connection point behind |
118
+ | `gas_bottle` | 0.36 x 0.36 x 0.58 | region data (BR 13 kg P13, US 20 lb), `valve` part, `gas` fuel source, damage kind `gas`, protective guard |
119
+ | `sink_kitchen` | 1.2 x 0.6 x 1.2 | basin, drainboard, `tap` fixture with `tap_handle` part and water emitter, `door_1`, `door_2`, container `under_sink` |
120
+ | `sink_bathroom` | 0.55 x 0.45 x 1.05 | basin in a vanity, same tap, `door`, container `under_sink` |
121
+ | `shower` | 0.9 x 0.9 x 2.1 | tray, tiled walls (the only colliders), head, `valve` part, `shower` fixture with `heater` device, water and steam emitters, glass: `glass_door` (sliding part) and `glass_fixed` as **soft panels, never colliders** |
122
+ | `toilet` | 0.4 x 0.7 x 0.8 | bowl, cistern, `lid` part, `flush_button` part, `flush` fixture and water emitter |
123
+ | `utility_sink` | 0.6 x 0.55 x 1.2 | deep laundry tub on a frame, washboard, `tap` and `basin` fixtures |
124
+
125
+ ### Electrical
126
+
127
+ | Type | Size | What it exposes |
128
+ |---|---|---|
129
+ | `wall_socket` | 0.08 x 0.03 x 0.08, y 0.3 | plate with the holes of the region standard (BR NBR 14136 three round holes, US NEMA 5-15); `socket` |
130
+ | `wall_switch` | 0.08 x 0.03 x 0.08, y 1.2 | `rocker` part; `switch` with `controls` from `item.controls` |
131
+ | `service_entrance` | 0.6 x 0.5 x 6.5 | concrete pole, cross arm with insulators, meter box with `meter_door`; wires: `drop` (catenary to `item.house`), `riser` conduit, `earth` cable |
132
+ | `electrical_panel` | 0.36 x 0.12 x 0.52, y 1.3 | wall breaker panel: `door`, DIN rail, one `breaker_<circuit>` rocker part per circuit (starts on, usable only with the door open) and a `toggle_breaker` interaction each |
133
+ | `power_meter` | 0.24 x 0.16 x 0.34, y 1.4 | utility meter box: dial meter behind a `door` with a glass window and a lead seal |
134
+ | `conduit_run` | - | no primitives; `item.points` becomes a `conduit` wire |
135
+ | `tv` | 1.0 x 0.22 x 0.68 | stand, bezel, back shell, screen (the only `emissive` plane), `power` part; `tv` screen device with `socket: 'auto'`, `plug`, 6 channels, cord wire |
136
+ | `microwave` | 0.5 x 0.38 x 0.3, y 0.9 | hollow cavity with turntable, `door`, `dial`; appliance device (plugged) |
137
+ | `washing_machine` | 0.6 x 0.6 x 0.85 | cabinet with drum, round `door`, `dial`; appliance device (plugged) that drives the `inlet` hose fixture (12 l/min while it runs) |
138
+
139
+ ### Seating
140
+
141
+ | Type | Size | What it exposes |
142
+ |---|---|---|
143
+ | `sofa` | 2.0 x 0.9 x 0.85 | `seat_n` (`sit`, from the width) and one `lie` seat; arms, cushions, back cushions |
144
+ | `armchair` | 0.85 x 0.85 x 0.85 | `seat_1` |
145
+ | `dining_chair` | 0.45 x 0.45 x 0.9 | `seat` |
146
+ | `bed_double`, `bed_single` | 1.6 x 2.05 x 0.95, 0.95 x 2.0 x 0.9 | `lie_1`, `lie_2` / `lie`; headboard, mattress, duvet, pillows |
147
+ | `bench` | 1.5 x 0.5 x 0.85 | slatted bench with cast-iron frame, `seat_n` from the width |
148
+
149
+ Seats face `+z` of the object (`ry = PI`, because yaw 0 is -z in `game-interactables`) and have an exit point in front (beds: beside them).
150
+
151
+ ### Windows
152
+
153
+ | Type | Size | What it exposes |
154
+ |---|---|---|
155
+ | `blinds` | 1.2 x 0.08 x 1.4, y 0.9 | one hinged part per slat (`slat_1`...) in the part group `tilt`, so a single interaction closes (slats ~80 degrees, overlapping) or opens (flat) the whole blind; a separate `raise` part (scale along y) lifts the cord ladders, rail and pull. Parts are flat groups, so the slats do not stack when raised |
156
+ | `curtain` | 1.6 x 0.1 x 1.6, y 0.7 | `panel_l`, `panel_r` (scale along x, bunching toward the end) in the part group `panels`: one interaction opens and closes both. Each has a **soft curtain** (`soft.part` = the panel, so walking through sways it); rod, rings, folds |
157
+
158
+ ### Yard
159
+
160
+ | Type | Size | What it exposes |
161
+ |---|---|---|
162
+ | `trash_bin` | 0.45 x 0.45 x 0.65 | hollow body with inner walls and floor, `lid` hinged at the back; container `bin` (loot `trash`) |
163
+ | `wheelie_bin` | 0.6 x 0.75 x 1.05 | same, with wheels and a grab bar |
164
+ | `mailbox` | 0.3 x 0.45 x 1.3 | box on a post with a `flap` hinged at the bottom; container `letters` (loot `mailbox`, default contents carry `data.text` locale keys) with a `read` interaction per slot; US style has a `flag` part. Region decides wall/post style and color |
165
+ | `dog_house` | 0.8 x 1.0 x 0.85 | real hollow interior: floor, lighter inner wall faces, cushion, optional bowl; the opening is an actual gap in the front wall with trim; gable roof |
166
+ | `bbq` | 1.5 x 0.6 x 1.9 | brick masonry with courses and mortar, ash door, charcoal bed, grill grate, stepped hood, chimney and flue; `coal` burner (`needsIgnition`, fuel `charcoal`), `coal_fire` and `coal_smoke` (at the flue top) emitters, side counter with `counter_door` and container `counter` (loot `bbq_counter`) |
167
+ | `clothesline` | 4.0 x 0.7 x 2.0 | two T posts (base plate 1 mm above the floor), three `wire_n` that start and end exactly at the tips and the center of the T arms, clothes as separate `cloth_w_i` parts each with a `soft` cloth entry (same id). Only the poles are colliders |
168
+
169
+ ### Rural homes
170
+
171
+ | Type | Size | What it exposes |
172
+ |---|---|---|
173
+ | `wood_stove` | 0.5 x 0.55 x 2.3 | cast iron body on legs, `firebox_door` hinged on the front edge (glass window, handle), hollow firebox with firebrick liner and grate, cooking top with a `pot_spot` container (one slot for a pot), flue pipe up to `item.flueHeight`; `wood` fuel, `fire` burner (`needsIgnition`), `fire_flame` emitter in the firebox and `fire_smoke` at the flue top. The lit burner is the heat source for the host |
174
+ | `fireplace` | 1.6 x 1.0 x 2.6 | brick (default) or `variant: 'stone'` surround with a firebox 45 cm deep (back wall, side faces, raised floor), stone hearth, steel lintel, wooden mantel, chimney breast and stack to `item.chimneyHeight`; grate with logs; `fire` burner (`needsIgnition`, fuel `wood`), flame in the firebox and smoke from the chimney top |
175
+ | `outhouse` | 1.1 x 1.2 x 2.3 | hollow plank booth (back, side and front walls, floor, sloped roof), `door` hinged on the front edge with a **real crescent cut**, bench with a hole over a dark pit and a `seat_lid` part, `seat` (sit). No water. Wall colliders and a door collider that turns off while the door is open |
176
+ | `well` | 1.5 x 1.6 x 2.3 | stone ring (two courses, real opening), post-and-beam frame with a gabled roof, `crank` (knob), `bucket` (slide up) and `rope` (scale), all in the part group `draw`; trough with a chute. Own tank `well_water` (20 000 l) and a `hose` fixture `water` driven by the bucket: it flows while the bucket is up, with a `water_stream` emitter |
177
+
178
+ ### Camping
179
+
180
+ | Type | Size | What it exposes |
181
+ |---|---|---|
182
+ | `cooler` | 0.62 x 0.4 x 0.42 | hollow insulated box with a lighter liner, `lid` hinged at the back (86 degrees), side handles, drain plug; container `cooler` (loot `cooler`: drinks, ice packs, sandwiches, fruit) |
183
+ | `campfire` | 1.1 x 1.1 x 0.75 | ring of stones, ash bed, leaning logs; `fire` burner (`needsIgnition`, fuel `wood`), fire and smoke emitters. With a footprint of 2 m or more it adds two log seats (`seat_1`, `seat_2`) |
184
+ | `camp_stove` | 0.36 x 0.3 x 0.17 | single burner with pot supports and wind guard, `knob` part, `burner` with `fuel: 'auto'` (nearest gas canister or bottle within 2 m), flame emitter, `gas_hose` wire |
185
+ | `gas_canister` | 0.12 x 0.12 x 0.2 | small butane canister (region data `canister`), `valve` part, `gas` fuel source; destruction: steel, `explodes` small (radius 3 m) and `contains` pressurized gas |
186
+ | `lantern_lamp` | 0.22 x 0.22 x 0.4 | kerosene / gas lantern: font, glass globe in a wire cage, bail; `lamp` device with `electric: false` toggled by the `wick` part, `lamp_flame` emitter; `variant: 'hanging'` adds a chain and drops the collider |
187
+ | `camp_chair` | 0.52 x 0.5 x 0.82 | folding chair: scissor legs, canvas seat and back, arm rests, cup holder; `seat` (sit) |
188
+ | `camp_table` | 1.2 x 0.6 x 0.72 | folding table: laminate top with an aluminium rim and scissor legs; a plain surface, no container |
189
+
190
+ `bunk_bed` (0.95 x 2.05 x 1.75, group seating) has `lie_lower` and `lie_upper`, guard rails and a ladder at the foot end.
191
+
192
+ ## Data
193
+
194
+ Everything is plain JSON in `src/data` (bundled): `types.json`, `items.json`, `loot.json`, `locales/en.json`, `locales/pt-BR.json` and
195
+ `regions/br.json`, `regions/us.json`. Region specifics are data, never a type suffix:
196
+
197
+ ```json
198
+ { "id": "br", "gas": { "kind": "P13", "capacityKg": 13 }, "socket": { "standard": "NBR 14136", "voltage": [127, 220], "hz": 60 }, "mailbox": { "style": "wall" } }
199
+ ```
200
+
201
+ ## Destruction
202
+
203
+ Every type has a default material and joint for its body (`spec.destruction`) and every movable part has its own (`part.destruction`: `material`, `joint`, `piece`), using the ids of `@adatechnology/game-destruction`. Damage, fire and blasts go through that SDK; the pack only tags. Doors are `hinge`, drawers `clip`, MDF bodies `screw`, bricks `mortar`, welded metal `weld`. The `gas_bottle` body also has `explodes` and `contains` (pressurized gas, sized from the region's cylinder). Water fixtures hold no water themselves.
204
+
205
+ | Type | Body | Parts |
206
+ | --- | --- | --- |
207
+ | fridge, fridge_compact | steel, weld | doors steel, hinge |
208
+ | kitchen cabinets, pantry, wardrobe, dresser, nightstand, bathroom cabinet | mdf, screw | doors mdf, hinge; drawers mdf, clip |
209
+ | stove | steel, weld | oven door steel, hinge; knobs plastic, clip |
210
+ | gas_bottle | steel, weld, explodes + contains gas | valve copper, screw |
211
+ | sink_kitchen, sink_bathroom, utility_sink | ceramic, glue | taps steel, screw; cabinet doors mdf, hinge |
212
+ | shower | tempered_glass, clip | glass door tempered_glass, clip; valve steel, screw |
213
+ | toilet | ceramic, bolt | lid plastic, hinge; flush button plastic, clip |
214
+ | wall_socket, wall_switch, conduit_run, power_meter, tv | plastic, screw / clip | rocker, button, door: plastic, clip / hinge |
215
+ | service_entrance, electrical_panel | steel, bolt / screw | doors steel, hinge; breakers plastic, clip |
216
+ | microwave, washing_machine | steel, screw | doors steel / tempered_glass, hinge; dials plastic, clip |
217
+ | sofa, armchair | fabric, glue | none |
218
+ | dining_chair | wood_hard, screw | none |
219
+ | bed_double, bed_single, bench | wood_soft, screw / nail | none |
220
+ | blinds | aluminium, clip | slats aluminium, clip; cord aluminium, tie |
221
+ | curtain | fabric, tie | panels fabric, tie |
222
+ | trash_bin, wheelie_bin | plastic, fused | lid plastic, hinge |
223
+ | mailbox | steel, weld | flap and flag steel, hinge |
224
+ | dog_house | plywood, nail | none |
225
+ | bbq | brick, mortar | counter door steel, hinge |
226
+ | clothesline | steel, weld | clothes fabric, tie |
227
+ | bunk_bed | wood_soft, screw | none |
228
+ | wood_stove | cast_iron, bolt | firebox door cast_iron, hinge |
229
+ | fireplace | brick, mortar (`stone` variant: stone, mortar) | none |
230
+ | outhouse | wood_soft, nail | door and seat lid wood_soft, hinge |
231
+ | well | stone, mortar | crank wood_hard, bolt; bucket wood_soft, tie; rope fabric, tie |
232
+ | cooler | plastic, fused | lid plastic, hinge |
233
+ | campfire | stone, mortar | none |
234
+ | camp_stove | steel, weld | knob plastic, clip |
235
+ | gas_canister | steel, weld, small explosion + contains gas | valve copper, screw |
236
+ | lantern_lamp | copper, screw | wick plastic, clip |
237
+ | camp_chair, camp_table | aluminium, clip | none |
238
+
239
+ ## Guarantees (tested)
240
+
241
+ For every type, with defaults and three seeds, in both regions: the build succeeds; all static primitives and all closed-part primitives stay inside
242
+ the footprint (w x d x h, 2 cm tolerance), so nothing goes through the wall; every part's `sweep` covers its open pose; ids are unique and every
243
+ reference (part, container, device, burner, fixture, seat...) resolves; slots lie inside their container volume; every loot entry fits a slot of a
244
+ container that uses its table; every locale key a spec uses exists in `en` and `pt-BR`; same seed gives identical primitives and spec.
245
+
246
+ ## Português
247
+
248
+ Pack de conteúdo de casa e quintal para o `@adatechnology/game-interactables`: geladeira, armários, guarda-roupa, gavetas, fogão, botijão de gás,
249
+ pias, chuveiro, vaso, tomadas, poste de entrada de energia, TV, sofá, camas, persianas, lixeiras, caixa de correio, casinha de cachorro,
250
+ churrasqueira e varal, além de beliche, fogão a lenha, lareira, privada de fora, poço, caixa térmica, fogueira, fogareiro, botijão pequeno, lampião e móveis de camping. Os objetos têm **profundidade real**: portas com dobradiça na borda da frente (nunca atravessam a parede), corpo oco com
251
+ forro interno mais claro, gavetas de verdade (fundo, laterais, fundo traseiro e frente), bandejas na porta, puxadores e frestas entre portas.
252
+
253
+ ```ts
254
+ const hh = createHousehold({ locale: 'pt-BR', region: 'br' })
255
+ const world = createWorld({ locale: 'pt-BR', strings: hh.strings, items: hh.items, loot: hh.loot })
256
+ const spec = hh.build('fridge', { seed: 1 }, api)
257
+ hh.types.find((t) => t.id === 'wardrobe')!.name // "Guarda-roupa"
258
+ ```
259
+
260
+ O espelho do guarda-roupa é um plano na face **externa** de uma porta (4 mm à frente), dentro da parte da porta, e acompanha o movimento. A região
261
+ (`br` ou `us`) define o botijão (P13 de 13 kg no Brasil), o padrão de tomada (NBR 14136 de três pinos, 127/220 V) e o estilo da caixa de correio.
262
+ Os dados ficam em JSON (`src/data`); os textos em `locales/pt-BR.json`.
@@ -0,0 +1,155 @@
1
+ import { ItemCatalog, LootTables, Strings, Vec3, ObjectSpec, Motion } from '@adatechnology/game-interactables';
2
+ import { PropItem, PropsApi, Primitive } from '@adatechnology/game-props3d';
3
+
4
+ /**
5
+ * The api the host implements. It is the props3d api plus `part`: everything drawn inside `draw` belongs to a movable part and is
6
+ * expressed in the part's frame (relative to `pivot`, then rotated by `ry`). The host makes one movable group per part.
7
+ */
8
+ interface HouseholdApi extends PropsApi {
9
+ part(id: string, pivot: Vec3, ry: number, draw: () => void): void;
10
+ }
11
+ interface ContentsEntry {
12
+ type: string;
13
+ qty: number;
14
+ data?: Record<string, unknown>;
15
+ }
16
+ /** A props3d item plus the household extras. Front = local +z, origin at the footprint center on the floor. */
17
+ interface HouseholdItem extends PropItem {
18
+ /** Explicit contents per container id (`{ fridge: [{ type: 'milk_carton', qty: 1 }, null] }`). Wins over the loot table. */
19
+ contents?: Record<string, Array<ContentsEntry | null>>;
20
+ /** Side of the door hinge for single-door types. Default depends on the type. */
21
+ hinge?: 'left' | 'right';
22
+ /** Circuit of the socket / lamp (`wall_socket`). */
23
+ circuit?: string;
24
+ /** Device ids a `wall_switch` controls. */
25
+ controls?: string[];
26
+ /** `gas_bottle` placed in a cabinet: the valve interaction is available only while this part (world-wide object id) is open. */
27
+ requires?: {
28
+ object: string;
29
+ part: string;
30
+ };
31
+ /** `electrical_panel`: the circuits, one breaker each. Default: a single circuit `main`. */
32
+ circuits?: Array<{
33
+ id: string;
34
+ label?: string;
35
+ }>;
36
+ /** `conduit_run`: polyline in object-local coordinates. */
37
+ points?: Vec3[];
38
+ /** `service_entrance`: where the drop wire ends (the house attachment point), object-local. */
39
+ house?: Vec3;
40
+ /** `service_entrance`: sag of the drop wire in meters. Default 0.35. */
41
+ sag?: number;
42
+ /** `wood_stove`: height (item-local, meters) of the top of the flue pipe, and of the smoke emitter. Default: the item height. */
43
+ flueHeight?: number;
44
+ /** `fireplace`: height of the chimney top and of the smoke emitter. Default: the item height. */
45
+ chimneyHeight?: number;
46
+ }
47
+ type HouseholdGroup = 'storage' | 'kitchen' | 'bathroom' | 'electrical' | 'seating' | 'window' | 'yard' | 'rural' | 'camp';
48
+ interface HouseholdTypeDef {
49
+ id: string;
50
+ group: HouseholdGroup;
51
+ /** Default footprint width (x), depth (z) and height (y), in meters. */
52
+ w: number;
53
+ d: number;
54
+ h: number;
55
+ /** Default mounting height of the base of the object. */
56
+ y: number;
57
+ /** false = no collider for the host (wall items, wires). */
58
+ solid: boolean;
59
+ }
60
+ interface HouseholdType extends HouseholdTypeDef {
61
+ /** Localized display name. */
62
+ name: string;
63
+ }
64
+ interface Region {
65
+ id: string;
66
+ gas: {
67
+ kind: string;
68
+ capacityKg: number;
69
+ diameter: number;
70
+ height: number;
71
+ color: string;
72
+ };
73
+ /** Small camping gas canister (`gas_canister`). */
74
+ canister: {
75
+ kind: string;
76
+ capacityKg: number;
77
+ diameter: number;
78
+ height: number;
79
+ color: string;
80
+ };
81
+ socket: {
82
+ standard: string;
83
+ pins: number;
84
+ layout: 'br' | 'us';
85
+ voltage: number[];
86
+ hz: number;
87
+ };
88
+ mailbox: {
89
+ style: 'wall' | 'post';
90
+ color: string;
91
+ };
92
+ clothesline: {
93
+ style: string;
94
+ wires: number;
95
+ };
96
+ }
97
+ interface HouseholdOptions {
98
+ /** `en` or `pt-BR`. Default `en`. */
99
+ locale?: string;
100
+ /** Region id (`br`, `us`). Default `br` for `pt-BR`, `us` otherwise. */
101
+ region?: string;
102
+ }
103
+ interface Household {
104
+ types: HouseholdType[];
105
+ items: ItemCatalog;
106
+ loot: LootTables;
107
+ strings: Record<'en' | 'pt-BR', Strings>;
108
+ region: Region;
109
+ locale: string;
110
+ /** Draws the object through `api` and returns its spec. Deterministic for the same `item.seed`. */
111
+ build(type: string, item: HouseholdItem, api: HouseholdApi): ObjectSpec;
112
+ }
113
+
114
+ /** Ids of every type in the pack. */
115
+ declare const HOUSEHOLD_TYPES: string[];
116
+ /** Regions that ship with the pack. */
117
+ declare const HOUSEHOLD_REGIONS: string[];
118
+ /**
119
+ * Creates the household content pack: type metadata, item catalog, loot tables, locale tables, region data and `build`.
120
+ *
121
+ * ```ts
122
+ * const hh = createHousehold({ locale: 'pt-BR', region: 'br' })
123
+ * const world = createWorld({ locale: 'pt-BR', strings: hh.strings, items: hh.items, loot: hh.loot })
124
+ * world.add('fridge-1', hh.build('fridge', { seed: 1 }, api), { x: 2, y: 0, z: 3, ry: 0 })
125
+ * ```
126
+ */
127
+ declare function createHousehold(options?: HouseholdOptions): Household;
128
+
129
+ interface RecordedPart {
130
+ id: string;
131
+ pivot: Vec3;
132
+ ry: number;
133
+ primitives: Primitive[];
134
+ }
135
+ interface HouseholdRecorder {
136
+ api: HouseholdApi;
137
+ /** Primitives that belong to no part. */
138
+ primitives: Primitive[];
139
+ /** Primitives per part id, in the part's frame. */
140
+ parts: Record<string, RecordedPart>;
141
+ }
142
+ /**
143
+ * An api that records every primitive instead of drawing it: static ones in `primitives`, the ones drawn inside `api.part(...)` under
144
+ * `parts[id]`. For tests, previews and measuring.
145
+ */
146
+ declare function createRecorder(): HouseholdRecorder;
147
+
148
+ /** The 8 (box, cylinder) or 4 (plane) corners of a primitive in its own frame. Leaves and lights return their anchor and tip. */
149
+ declare function cornersOf(p: Primitive): Vec3[];
150
+ /** Position of a point of a part (given in object-local coordinates at t = 0) when the part is at `t`. */
151
+ declare function motionPoint(p: Vec3, pivot: Vec3, m: Motion, t: number): Vec3;
152
+ /** Floor rect [x0, z0, x1, z1] covered by object-local points while the part goes from t = 0 to t = 1. */
153
+ declare function sweepOf(points: Vec3[], pivot: Vec3, m: Motion, margin?: number): [number, number, number, number];
154
+
155
+ export { type ContentsEntry, HOUSEHOLD_REGIONS, HOUSEHOLD_TYPES, type Household, type HouseholdApi, type HouseholdGroup, type HouseholdItem, type HouseholdOptions, type HouseholdRecorder, type HouseholdType, type HouseholdTypeDef, type RecordedPart, type Region, cornersOf, createHousehold, createRecorder, motionPoint, sweepOf };