@sharpee/world-model 0.9.111 → 1.0.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/capabilities/action-interceptor.d.ts +122 -6
- package/capabilities/action-interceptor.d.ts.map +1 -1
- package/capabilities/action-interceptor.js +59 -0
- package/capabilities/action-interceptor.js.map +1 -1
- package/capabilities/index.d.ts +1 -1
- package/capabilities/index.d.ts.map +1 -1
- package/capabilities/index.js +11 -1
- package/capabilities/index.js.map +1 -1
- package/entities/entity-types.d.ts +2 -0
- package/entities/entity-types.d.ts.map +1 -1
- package/entities/entity-types.js +3 -0
- package/entities/entity-types.js.map +1 -1
- package/entities/index.d.ts +2 -0
- package/entities/index.d.ts.map +1 -1
- package/entities/index.js +3 -1
- package/entities/index.js.map +1 -1
- package/entities/wall-entity.d.ts +112 -0
- package/entities/wall-entity.d.ts.map +1 -0
- package/entities/wall-entity.js +50 -0
- package/entities/wall-entity.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/traits/acoustic/acousticDampenerTrait.d.ts +61 -0
- package/traits/acoustic/acousticDampenerTrait.d.ts.map +1 -0
- package/traits/acoustic/acousticDampenerTrait.js +38 -0
- package/traits/acoustic/acousticDampenerTrait.js.map +1 -0
- package/traits/acoustic/acousticTrait.d.ts +64 -0
- package/traits/acoustic/acousticTrait.d.ts.map +1 -0
- package/traits/acoustic/acousticTrait.js +47 -0
- package/traits/acoustic/acousticTrait.js.map +1 -0
- package/traits/acoustic/index.d.ts +3 -0
- package/traits/acoustic/index.d.ts.map +1 -0
- package/traits/acoustic/index.js +10 -0
- package/traits/acoustic/index.js.map +1 -0
- package/traits/implementations.d.ts.map +1 -1
- package/traits/implementations.js +8 -0
- package/traits/implementations.js.map +1 -1
- package/traits/index.d.ts +3 -0
- package/traits/index.d.ts.map +1 -1
- package/traits/index.js +5 -0
- package/traits/index.js.map +1 -1
- package/traits/listener/index.d.ts +2 -0
- package/traits/listener/index.d.ts.map +1 -0
- package/traits/listener/index.js +7 -0
- package/traits/listener/index.js.map +1 -0
- package/traits/listener/listenerTrait.d.ts +40 -0
- package/traits/listener/listenerTrait.d.ts.map +1 -0
- package/traits/listener/listenerTrait.js +23 -0
- package/traits/listener/listenerTrait.js.map +1 -0
- package/traits/obstructor-protocol.d.ts +96 -0
- package/traits/obstructor-protocol.d.ts.map +1 -0
- package/traits/obstructor-protocol.js +77 -0
- package/traits/obstructor-protocol.js.map +1 -0
- package/traits/room/roomTrait.d.ts +7 -0
- package/traits/room/roomTrait.d.ts.map +1 -1
- package/traits/room/roomTrait.js +2 -0
- package/traits/room/roomTrait.js.map +1 -1
- package/traits/story-info/storyInfoTrait.d.ts +6 -0
- package/traits/story-info/storyInfoTrait.d.ts.map +1 -1
- package/traits/story-info/storyInfoTrait.js +6 -0
- package/traits/story-info/storyInfoTrait.js.map +1 -1
- package/traits/trait-types.d.ts +3 -0
- package/traits/trait-types.d.ts.map +1 -1
- package/traits/trait-types.js +8 -0
- package/traits/trait-types.js.map +1 -1
- package/world/AuthorModel.d.ts +3 -0
- package/world/AuthorModel.d.ts.map +1 -1
- package/world/AuthorModel.js +7 -0
- package/world/AuthorModel.js.map +1 -1
- package/world/WorldModel.d.ts +23 -0
- package/world/WorldModel.d.ts.map +1 -1
- package/world/WorldModel.js +36 -0
- package/world/WorldModel.js.map +1 -1
- package/world/index.d.ts +4 -0
- package/world/index.d.ts.map +1 -1
- package/world/index.js +7 -1
- package/world/index.js.map +1 -1
- package/world/wall-creation.d.ts +38 -0
- package/world/wall-creation.d.ts.map +1 -0
- package/world/wall-creation.js +98 -0
- package/world/wall-creation.js.map +1 -0
- package/world/wall-validation.d.ts +45 -0
- package/world/wall-validation.d.ts.map +1 -0
- package/world/wall-validation.js +98 -0
- package/world/wall-validation.js.map +1 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acoustic dampener trait — obstructor-side sound-cost contribution
|
|
3
|
+
* (ADR-172). Attaches to entities (tapestries, peepholes, foam panels,
|
|
4
|
+
* heavy curtains) that, when referenced as a wall side's obstructor
|
|
5
|
+
* (via `IWallSideData.obstructedBy` per ADR-173), modify the wall's
|
|
6
|
+
* effective acoustic cost.
|
|
7
|
+
*
|
|
8
|
+
* Per ADR-173's generalized obstructor protocol, the wall does *not*
|
|
9
|
+
* hardcode rules about what obstructors do; the obstructor's own
|
|
10
|
+
* traits declare which capabilities it modifies. `AcousticDampenerTrait`
|
|
11
|
+
* is the first capability-specific obstructor trait (ADR-172); future
|
|
12
|
+
* capabilities (visual line-of-sight, olfactory, thermal) ship sibling
|
|
13
|
+
* traits via the same protocol without changes to wall-substrate code.
|
|
14
|
+
*
|
|
15
|
+
* Sign convention:
|
|
16
|
+
* - **Positive** `contribution` adds to the wall's effective cost
|
|
17
|
+
* (dampens — tapestry, foam panel, heavy curtain).
|
|
18
|
+
* - **Negative** `contribution` subtracts from the wall's effective
|
|
19
|
+
* cost (more permeable — peephole, hole, vent opening).
|
|
20
|
+
*
|
|
21
|
+
* Phase 2 ships only the trait shape. The wall's effective acoustic
|
|
22
|
+
* cost is computed by the propagation algorithm in `@sharpee/engine`
|
|
23
|
+
* (Phase 3), which consults this trait via the obstructor-protocol
|
|
24
|
+
* helpers shipped in ADR-173 Phase 5.
|
|
25
|
+
*
|
|
26
|
+
* Owner context: `@sharpee/world-model` — wall / spatial primitives.
|
|
27
|
+
*
|
|
28
|
+
* @see ADR-172 — Spatial Sound Propagation
|
|
29
|
+
* @see ADR-173 — Wall Adjacency Primitive (obstructor protocol)
|
|
30
|
+
*/
|
|
31
|
+
import { ITrait } from '../trait';
|
|
32
|
+
/**
|
|
33
|
+
* Acoustic dampener trait — attaches to obstructor entities (tapestry,
|
|
34
|
+
* peephole, foam panel, heavy curtain).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const tapestry = author.createEntity('tapestry', EntityType.OBJECT);
|
|
38
|
+
* tapestry.add(new AcousticDampenerTrait(2)); // +2 dampening
|
|
39
|
+
* author.moveEntity(tapestry.id, parlor.id);
|
|
40
|
+
*
|
|
41
|
+
* world.createWall({
|
|
42
|
+
* between: [parlor, library],
|
|
43
|
+
* sides: {
|
|
44
|
+
* [parlor.id]: { adjective: 'oak', obstructedBy: tapestry.id },
|
|
45
|
+
* [library.id]: { adjective: 'brick' },
|
|
46
|
+
* },
|
|
47
|
+
* });
|
|
48
|
+
*/
|
|
49
|
+
export declare class AcousticDampenerTrait implements ITrait {
|
|
50
|
+
readonly contribution: number;
|
|
51
|
+
static readonly type: "if.trait.acoustic_dampener";
|
|
52
|
+
/**
|
|
53
|
+
* Per ADR-173 taxonomy. Documentation only — not enforced; obstructors
|
|
54
|
+
* are referenced by the wall's per-side `obstructedBy` and located by
|
|
55
|
+
* room at query time per the ADR-173 obstructor protocol.
|
|
56
|
+
*/
|
|
57
|
+
static readonly slot = "obstructor";
|
|
58
|
+
readonly type: "if.trait.acoustic_dampener";
|
|
59
|
+
constructor(contribution: number);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=acousticDampenerTrait.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acousticDampenerTrait.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/acousticDampenerTrait.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,qBAAsB,YAAW,MAAM;aAUtB,YAAY,EAAE,MAAM;IAThD,MAAM,CAAC,QAAQ,CAAC,IAAI,+BAA+B;IACnD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB;IACpC,QAAQ,CAAC,IAAI,+BAA+B;gBAEhB,YAAY,EAAE,MAAM;CACjD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// packages/world-model/src/traits/acoustic/acousticDampenerTrait.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AcousticDampenerTrait = void 0;
|
|
5
|
+
const trait_types_1 = require("../trait-types");
|
|
6
|
+
/**
|
|
7
|
+
* Acoustic dampener trait — attaches to obstructor entities (tapestry,
|
|
8
|
+
* peephole, foam panel, heavy curtain).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const tapestry = author.createEntity('tapestry', EntityType.OBJECT);
|
|
12
|
+
* tapestry.add(new AcousticDampenerTrait(2)); // +2 dampening
|
|
13
|
+
* author.moveEntity(tapestry.id, parlor.id);
|
|
14
|
+
*
|
|
15
|
+
* world.createWall({
|
|
16
|
+
* between: [parlor, library],
|
|
17
|
+
* sides: {
|
|
18
|
+
* [parlor.id]: { adjective: 'oak', obstructedBy: tapestry.id },
|
|
19
|
+
* [library.id]: { adjective: 'brick' },
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
class AcousticDampenerTrait {
|
|
24
|
+
contribution;
|
|
25
|
+
static type = trait_types_1.TraitType.ACOUSTIC_DAMPENER;
|
|
26
|
+
/**
|
|
27
|
+
* Per ADR-173 taxonomy. Documentation only — not enforced; obstructors
|
|
28
|
+
* are referenced by the wall's per-side `obstructedBy` and located by
|
|
29
|
+
* room at query time per the ADR-173 obstructor protocol.
|
|
30
|
+
*/
|
|
31
|
+
static slot = 'obstructor';
|
|
32
|
+
type = trait_types_1.TraitType.ACOUSTIC_DAMPENER;
|
|
33
|
+
constructor(contribution) {
|
|
34
|
+
this.contribution = contribution;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.AcousticDampenerTrait = AcousticDampenerTrait;
|
|
38
|
+
//# sourceMappingURL=acousticDampenerTrait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acousticDampenerTrait.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/acousticDampenerTrait.ts"],"names":[],"mappings":";AAAA,oEAAoE;;;AAkCpE,gDAA2C;AAE3C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,qBAAqB;IAUJ;IAT5B,MAAM,CAAU,IAAI,GAAG,uBAAS,CAAC,iBAAiB,CAAC;IACnD;;;;OAIG;IACH,MAAM,CAAU,IAAI,GAAG,YAAY,CAAC;IAC3B,IAAI,GAAG,uBAAS,CAAC,iBAAiB,CAAC;IAE5C,YAA4B,YAAoB;QAApB,iBAAY,GAAZ,YAAY,CAAQ;IAAG,CAAC;;AAVtD,sDAWC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acoustic trait — wall-intrinsic sound-cost data (ADR-172).
|
|
3
|
+
*
|
|
4
|
+
* Per ADR-173's whole-wall-vs-per-side trait taxonomy, a wall's *base*
|
|
5
|
+
* acoustic cost (the contribution of its material — plaster vs masonry
|
|
6
|
+
* vs soundproof panel) is symmetric from both sides. It lives in the
|
|
7
|
+
* whole-wall slot: attached to the wall entity itself, not to either
|
|
8
|
+
* side's per-side data.
|
|
9
|
+
*
|
|
10
|
+
* Per-side dampening (a tapestry covering one face, a peephole drilled
|
|
11
|
+
* through one face) lives on the *obstructor* entity and uses
|
|
12
|
+
* `AcousticDampenerTrait` (the per-side capability-specific obstructor
|
|
13
|
+
* trait per ADR-173's generalized obstructor protocol).
|
|
14
|
+
*
|
|
15
|
+
* Phase 2 ships only the trait shape and its tier→cost table. The
|
|
16
|
+
* propagation algorithm in `@sharpee/engine` (Phase 3) consumes
|
|
17
|
+
* `ACOUSTIC_TIER_COSTS`.
|
|
18
|
+
*
|
|
19
|
+
* Owner context: `@sharpee/world-model` — wall / spatial primitives.
|
|
20
|
+
*
|
|
21
|
+
* @see ADR-172 — Spatial Sound Propagation
|
|
22
|
+
* @see ADR-173 — Wall Adjacency Primitive (taxonomy)
|
|
23
|
+
*/
|
|
24
|
+
import { ITrait } from '../trait';
|
|
25
|
+
/**
|
|
26
|
+
* The four discrete acoustic tiers a wall material may have. Authored
|
|
27
|
+
* qualitatively at world-load time; the propagation algorithm reads the
|
|
28
|
+
* cost via `ACOUSTIC_TIER_COSTS`.
|
|
29
|
+
*/
|
|
30
|
+
export type AcousticTier = 'thin' | 'default' | 'thick' | 'soundproof';
|
|
31
|
+
/**
|
|
32
|
+
* Platform-default acoustic costs per wall tier, in path-cost units
|
|
33
|
+
* (ADR-172). Walls without an explicit `AcousticTrait` resolve to
|
|
34
|
+
* `default`.
|
|
35
|
+
*
|
|
36
|
+
* `Infinity` for `soundproof` collapses to `silent` audibility through
|
|
37
|
+
* the standard clarity formula (`clarity = budget − cost`) without the
|
|
38
|
+
* propagation algorithm needing a special case.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ACOUSTIC_TIER_COSTS: Readonly<Record<AcousticTier, number>>;
|
|
41
|
+
/**
|
|
42
|
+
* Acoustic trait — attaches to wall entities to declare their intrinsic
|
|
43
|
+
* acoustic cost tier. Whole-wall (symmetric) per ADR-173 taxonomy.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* world.createWall({
|
|
47
|
+
* between: [parlor, library],
|
|
48
|
+
* whole: [new AcousticTrait('thick')],
|
|
49
|
+
* sides: { ... }
|
|
50
|
+
* });
|
|
51
|
+
*/
|
|
52
|
+
export declare class AcousticTrait implements ITrait {
|
|
53
|
+
readonly tier: AcousticTier;
|
|
54
|
+
static readonly type: "if.trait.acoustic";
|
|
55
|
+
/**
|
|
56
|
+
* Per ADR-173 taxonomy. Documentation only — not enforced; the wall
|
|
57
|
+
* creation API simply attaches whole-wall traits via `wall.add()`
|
|
58
|
+
* and per-side data via `wall.sides`.
|
|
59
|
+
*/
|
|
60
|
+
static readonly slot = "whole-wall";
|
|
61
|
+
readonly type: "if.trait.acoustic";
|
|
62
|
+
constructor(tier: AcousticTier);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=acousticTrait.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acousticTrait.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/acousticTrait.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAKrE,CAAC;AAEH;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,YAAW,MAAM;aAUd,IAAI,EAAE,YAAY;IAT9C,MAAM,CAAC,QAAQ,CAAC,IAAI,sBAAsB;IAC1C;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB;IACpC,QAAQ,CAAC,IAAI,sBAAsB;gBAEP,IAAI,EAAE,YAAY;CAC/C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// packages/world-model/src/traits/acoustic/acousticTrait.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AcousticTrait = exports.ACOUSTIC_TIER_COSTS = void 0;
|
|
5
|
+
const trait_types_1 = require("../trait-types");
|
|
6
|
+
/**
|
|
7
|
+
* Platform-default acoustic costs per wall tier, in path-cost units
|
|
8
|
+
* (ADR-172). Walls without an explicit `AcousticTrait` resolve to
|
|
9
|
+
* `default`.
|
|
10
|
+
*
|
|
11
|
+
* `Infinity` for `soundproof` collapses to `silent` audibility through
|
|
12
|
+
* the standard clarity formula (`clarity = budget − cost`) without the
|
|
13
|
+
* propagation algorithm needing a special case.
|
|
14
|
+
*/
|
|
15
|
+
exports.ACOUSTIC_TIER_COSTS = Object.freeze({
|
|
16
|
+
thin: 2,
|
|
17
|
+
default: 4,
|
|
18
|
+
thick: 6,
|
|
19
|
+
soundproof: Number.POSITIVE_INFINITY,
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Acoustic trait — attaches to wall entities to declare their intrinsic
|
|
23
|
+
* acoustic cost tier. Whole-wall (symmetric) per ADR-173 taxonomy.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* world.createWall({
|
|
27
|
+
* between: [parlor, library],
|
|
28
|
+
* whole: [new AcousticTrait('thick')],
|
|
29
|
+
* sides: { ... }
|
|
30
|
+
* });
|
|
31
|
+
*/
|
|
32
|
+
class AcousticTrait {
|
|
33
|
+
tier;
|
|
34
|
+
static type = trait_types_1.TraitType.ACOUSTIC;
|
|
35
|
+
/**
|
|
36
|
+
* Per ADR-173 taxonomy. Documentation only — not enforced; the wall
|
|
37
|
+
* creation API simply attaches whole-wall traits via `wall.add()`
|
|
38
|
+
* and per-side data via `wall.sides`.
|
|
39
|
+
*/
|
|
40
|
+
static slot = 'whole-wall';
|
|
41
|
+
type = trait_types_1.TraitType.ACOUSTIC;
|
|
42
|
+
constructor(tier) {
|
|
43
|
+
this.tier = tier;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.AcousticTrait = AcousticTrait;
|
|
47
|
+
//# sourceMappingURL=acousticTrait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acousticTrait.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/acousticTrait.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;AA2B5D,gDAA2C;AAS3C;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAA2C,MAAM,CAAC,MAAM,CAAC;IACvF,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,MAAM,CAAC,iBAAiB;CACrC,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IAUI;IAT5B,MAAM,CAAU,IAAI,GAAG,uBAAS,CAAC,QAAQ,CAAC;IAC1C;;;;OAIG;IACH,MAAM,CAAU,IAAI,GAAG,YAAY,CAAC;IAC3B,IAAI,GAAG,uBAAS,CAAC,QAAQ,CAAC;IAEnC,YAA4B,IAAkB;QAAlB,SAAI,GAAJ,IAAI,CAAc;IAAG,CAAC;;AAVpD,sCAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// packages/world-model/src/traits/acoustic/index.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AcousticDampenerTrait = exports.ACOUSTIC_TIER_COSTS = exports.AcousticTrait = void 0;
|
|
5
|
+
var acousticTrait_1 = require("./acousticTrait");
|
|
6
|
+
Object.defineProperty(exports, "AcousticTrait", { enumerable: true, get: function () { return acousticTrait_1.AcousticTrait; } });
|
|
7
|
+
Object.defineProperty(exports, "ACOUSTIC_TIER_COSTS", { enumerable: true, get: function () { return acousticTrait_1.ACOUSTIC_TIER_COSTS; } });
|
|
8
|
+
var acousticDampenerTrait_1 = require("./acousticDampenerTrait");
|
|
9
|
+
Object.defineProperty(exports, "AcousticDampenerTrait", { enumerable: true, get: function () { return acousticDampenerTrait_1.AcousticDampenerTrait; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAEpD,iDAAwF;AAA/E,8GAAA,aAAa,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAC3C,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementations.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/traits/implementations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAG/E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"implementations.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/traits/implementations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,O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,EACR,kBAAkB,EAGlB,mBAAmB,EAGnB,YAAY,EACZ,cAAc,EAGd,cAAc,EAGf,CAAC"}
|
|
@@ -89,6 +89,10 @@ Object.defineProperty(exports, "EnterableTrait", { enumerable: true, get: functi
|
|
|
89
89
|
// Concealment traits (ADR-148)
|
|
90
90
|
const concealmentTrait_1 = require("./concealment/concealmentTrait");
|
|
91
91
|
const concealedStateTrait_1 = require("./concealment/concealedStateTrait");
|
|
92
|
+
// Spatial sound traits (ADR-172)
|
|
93
|
+
const acousticTrait_1 = require("./acoustic/acousticTrait");
|
|
94
|
+
const acousticDampenerTrait_1 = require("./acoustic/acousticDampenerTrait");
|
|
95
|
+
const listenerTrait_1 = require("./listener/listenerTrait");
|
|
92
96
|
// System traits
|
|
93
97
|
const storyInfoTrait_1 = require("./story-info/storyInfoTrait");
|
|
94
98
|
Object.defineProperty(exports, "StoryInfoTrait", { enumerable: true, get: function () { return storyInfoTrait_1.StoryInfoTrait; } });
|
|
@@ -143,6 +147,10 @@ exports.TRAIT_IMPLEMENTATIONS = {
|
|
|
143
147
|
// Concealment traits (ADR-148)
|
|
144
148
|
[trait_types_1.TraitType.CONCEALMENT]: concealmentTrait_1.ConcealmentTrait,
|
|
145
149
|
[trait_types_1.TraitType.CONCEALED_STATE]: concealedStateTrait_1.ConcealedStateTrait,
|
|
150
|
+
// Spatial sound traits (ADR-172)
|
|
151
|
+
[trait_types_1.TraitType.ACOUSTIC]: acousticTrait_1.AcousticTrait,
|
|
152
|
+
[trait_types_1.TraitType.ACOUSTIC_DAMPENER]: acousticDampenerTrait_1.AcousticDampenerTrait,
|
|
153
|
+
[trait_types_1.TraitType.LISTENER]: listenerTrait_1.ListenerTrait,
|
|
146
154
|
// System traits
|
|
147
155
|
[trait_types_1.TraitType.STORY_INFO]: storyInfoTrait_1.StoryInfoTrait,
|
|
148
156
|
// Object property traits
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementations.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/implementations.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;
|
|
1
|
+
{"version":3,"file":"implementations.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/implementations.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAuJH,wDAEC;AAKD,kCAMC;AAlKD,+CAA0C;AAG1C,4DAA4D;AAC5D,4DAAyD;AAmKvD,8FAnKO,6BAAa,OAmKP;AAlKf,+DAA4D;AAmK1D,+FAnKO,+BAAc,OAmKP;AAlKhB,+DAA4D;AAmK1D,+FAnKO,+BAAc,OAmKP;AAlKhB,gDAA6C;AAmK3C,0FAnKO,qBAAS,OAmKP;AAlKX,4DAAyD;AAmKvD,8FAnKO,6BAAa,OAmKP;AAlKf,4DAAyD;AAmKvD,8FAnKO,6BAAa,OAmKP;AAlKf,sDAAmD;AAmKjD,4FAnKO,yBAAW,OAmKP;AAlKb,yDAAsD;AAmKpD,6FAnKO,2BAAY,OAmKP;AAjKd,4DAAyD;AAoKvD,8FApKO,6BAAa,OAoKP;AAnKf,4DAAyD;AAoKvD,8FApKO,6BAAa,OAoKP;AAnKf,kEAA+D;AAoK7D,gGApKO,iCAAe,OAoKP;AAnKjB,4DAAyD;AAoKvD,8FApKO,6BAAa,OAoKP;AAnKf,sEAAmE;AAoKjE,iGApKO,mCAAgB,OAoKP;AAlKlB,iBAAiB;AACjB,gDAA6C;AAoK3C,0FApKO,qBAAS,OAoKP;AAnKX,+DAA4D;AA4K1D,+FA5KO,+BAAc,OA4KP;AA3KhB,sDAAmD;AAmKjD,4FAnKO,yBAAW,OAmKP;AAlKb,mDAAgD;AAmK9C,2FAnKO,uBAAU,OAmKP;AAjKZ,eAAe;AACf,mDAAgD;AAmK9C,2FAnKO,uBAAU,OAmKP;AAjKZ,aAAa;AACb,gDAA6C;AAmK3C,0FAnKO,qBAAS,OAmKP;AAjKX,sBAAsB;AACtB,4DAAyD;AAoKvD,8FApKO,6BAAa,OAoK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,9 @@ export * from './open-inventory';
|
|
|
37
37
|
export * from './character-model';
|
|
38
38
|
export * from './concealment';
|
|
39
39
|
export * from './story-info';
|
|
40
|
+
export * from './obstructor-protocol';
|
|
41
|
+
export * from './acoustic';
|
|
42
|
+
export * from './listener';
|
|
40
43
|
export * from './register-all';
|
|
41
44
|
export * from './all-traits';
|
|
42
45
|
//# sourceMappingURL=index.d.ts.map
|
package/traits/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/traits/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAGxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AAGnC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AA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,mBAAmB,CAAC;AAGlC,cAAc,eAAe,CAAC;AAG9B,cAAc,cAAc,CAAC;AAG7B,cAAc,uBAAuB,CAAC;AAGtC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAG3B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,cAAc,CAAC"}
|
package/traits/index.js
CHANGED
|
@@ -64,6 +64,11 @@ __exportStar(require("./character-model"), exports);
|
|
|
64
64
|
__exportStar(require("./concealment"), exports);
|
|
65
65
|
// System traits
|
|
66
66
|
__exportStar(require("./story-info"), exports);
|
|
67
|
+
// Wall obstructor protocol (ADR-173 Phase 5)
|
|
68
|
+
__exportStar(require("./obstructor-protocol"), exports);
|
|
69
|
+
// Spatial sound traits (ADR-172 Phase 2)
|
|
70
|
+
__exportStar(require("./acoustic"), exports);
|
|
71
|
+
__exportStar(require("./listener"), exports);
|
|
67
72
|
// Register function
|
|
68
73
|
__exportStar(require("./register-all"), exports);
|
|
69
74
|
// All traits in one import
|
package/traits/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/index.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,sCAAsC;;;;;;;;;;;;;;;;AAEtC,mBAAmB;AACnB,0CAAwB;AACxB,gDAA8B;AAC9B,oDAAkC;AAElC,kEAAkE;AAClE,6CAA2B;AAC3B,8CAA4B;AAC5B,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,iDAA+B;AAC/B,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,+CAA6B;AAC7B,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AAExB,sBAAsB;AACtB,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,qDAAmC;AAEnC,gBAAgB;AAChB,2CAAyB;AACzB,8CAA4B;AAC5B,iDAA+B;AAC/B,8CAA4B;AAC5B,6CAA2B;AAE3B,mBAAmB;AACnB,4CAA0B;AAC1B,8CAA4B;AAE5B,aAAa;AACb,wCAAsB;AACtB,mDAAiC;AAEjC,4BAA4B;AAC5B,oDAAkC;AAElC,+BAA+B;AAC/B,gDAA8B;AAE9B,gBAAgB;AAChB,+CAA6B;AAE7B,oBAAoB;AACpB,iDAA+B;AAE/B,2BAA2B;AAC3B,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/index.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,sCAAsC;;;;;;;;;;;;;;;;AAEtC,mBAAmB;AACnB,0CAAwB;AACxB,gDAA8B;AAC9B,oDAAkC;AAElC,kEAAkE;AAClE,6CAA2B;AAC3B,8CAA4B;AAC5B,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,iDAA+B;AAC/B,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,+CAA6B;AAC7B,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB;AAExB,sBAAsB;AACtB,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,qDAAmC;AAEnC,gBAAgB;AAChB,2CAAyB;AACzB,8CAA4B;AAC5B,iDAA+B;AAC/B,8CAA4B;AAC5B,6CAA2B;AAE3B,mBAAmB;AACnB,4CAA0B;AAC1B,8CAA4B;AAE5B,aAAa;AACb,wCAAsB;AACtB,mDAAiC;AAEjC,4BAA4B;AAC5B,oDAAkC;AAElC,+BAA+B;AAC/B,gDAA8B;AAE9B,gBAAgB;AAChB,+CAA6B;AAE7B,6CAA6C;AAC7C,wDAAsC;AAEtC,yCAAyC;AACzC,6CAA2B;AAC3B,6CAA2B;AAE3B,oBAAoB;AACpB,iDAA+B;AAE/B,2BAA2B;AAC3B,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/listener/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// packages/world-model/src/traits/listener/index.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ListenerTrait = void 0;
|
|
5
|
+
var listenerTrait_1 = require("./listenerTrait");
|
|
6
|
+
Object.defineProperty(exports, "ListenerTrait", { enumerable: true, get: function () { return listenerTrait_1.ListenerTrait; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/listener/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAEpD,iDAAgD;AAAvC,8GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Listener trait — marks an entity as eligible to receive
|
|
3
|
+
* `AudibilityEvent`s from the propagation function (ADR-172).
|
|
4
|
+
*
|
|
5
|
+
* Per ADR-172 §Multi-listener dispatch:
|
|
6
|
+
* - The **player** gets this trait automatically during engine
|
|
7
|
+
* initialization (Phase 4 wires this); story authors do not add it
|
|
8
|
+
* manually.
|
|
9
|
+
* - **NPCs** opt in by attaching the trait (used by L2+ for NPC
|
|
10
|
+
* reactivity — e.g., an NPC hears a scream and runs toward it).
|
|
11
|
+
* - **Devices** may also be Listeners (an intercom microphone, a
|
|
12
|
+
* phone receiver, a recorder); see ADR-172 §Active acoustic
|
|
13
|
+
* devices (deferred composition pattern).
|
|
14
|
+
*
|
|
15
|
+
* Phase 2 ships the trait as a presence flag — no data fields. Future
|
|
16
|
+
* fields (per-listener sensitivity, deafness, kind filters) require a
|
|
17
|
+
* future ADR.
|
|
18
|
+
*
|
|
19
|
+
* Owner context: `@sharpee/world-model` — sensory primitives.
|
|
20
|
+
*
|
|
21
|
+
* @see ADR-172 — Spatial Sound Propagation
|
|
22
|
+
*/
|
|
23
|
+
import { ITrait } from '../trait';
|
|
24
|
+
/**
|
|
25
|
+
* Listener trait — presence flag. Entities carrying it are enumerated
|
|
26
|
+
* by the propagation function and receive `AudibilityEvent`s.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Engine player init (Phase 4) attaches automatically:
|
|
30
|
+
* player.add(new ListenerTrait());
|
|
31
|
+
*
|
|
32
|
+
* // Story-side NPC opt-in:
|
|
33
|
+
* const guard = author.createEntity('guard', EntityType.ACTOR);
|
|
34
|
+
* guard.add(new ListenerTrait());
|
|
35
|
+
*/
|
|
36
|
+
export declare class ListenerTrait implements ITrait {
|
|
37
|
+
static readonly type: "if.trait.listener";
|
|
38
|
+
readonly type: "if.trait.listener";
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=listenerTrait.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listenerTrait.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/listener/listenerTrait.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC;;;;;;;;;;;GAWG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C,MAAM,CAAC,QAAQ,CAAC,IAAI,sBAAsB;IAC1C,QAAQ,CAAC,IAAI,sBAAsB;CACpC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// packages/world-model/src/traits/listener/listenerTrait.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ListenerTrait = void 0;
|
|
5
|
+
const trait_types_1 = require("../trait-types");
|
|
6
|
+
/**
|
|
7
|
+
* Listener trait — presence flag. Entities carrying it are enumerated
|
|
8
|
+
* by the propagation function and receive `AudibilityEvent`s.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Engine player init (Phase 4) attaches automatically:
|
|
12
|
+
* player.add(new ListenerTrait());
|
|
13
|
+
*
|
|
14
|
+
* // Story-side NPC opt-in:
|
|
15
|
+
* const guard = author.createEntity('guard', EntityType.ACTOR);
|
|
16
|
+
* guard.add(new ListenerTrait());
|
|
17
|
+
*/
|
|
18
|
+
class ListenerTrait {
|
|
19
|
+
static type = trait_types_1.TraitType.LISTENER;
|
|
20
|
+
type = trait_types_1.TraitType.LISTENER;
|
|
21
|
+
}
|
|
22
|
+
exports.ListenerTrait = ListenerTrait;
|
|
23
|
+
//# sourceMappingURL=listenerTrait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listenerTrait.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/listener/listenerTrait.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;AA0B5D,gDAA2C;AAE3C;;;;;;;;;;;GAWG;AACH,MAAa,aAAa;IACxB,MAAM,CAAU,IAAI,GAAG,uBAAS,CAAC,QAAQ,CAAC;IACjC,IAAI,GAAG,uBAAS,CAAC,QAAQ,CAAC;;AAFrC,sCAGC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generalized obstructor-protocol query helpers (ADR-173).
|
|
3
|
+
*
|
|
4
|
+
* A wall side may declare an `obstructedBy` reference to another entity in
|
|
5
|
+
* the same room. That obstructor's *own traits* declare the capabilities it
|
|
6
|
+
* modifies — `AcousticDampenerTrait` for sound (ADR-172), future
|
|
7
|
+
* `BreachBlockerTrait` for breaching, future `VisualConduitTrait` for
|
|
8
|
+
* line-of-sight, and so on. The wall is the aggregator: capability consumers
|
|
9
|
+
* call into this module to ask "is there a contribution from this side's
|
|
10
|
+
* obstructor for this capability?", and the wall walks both sides for the
|
|
11
|
+
* cross-side sum AC-9 + AC-10 in ADR-173 require.
|
|
12
|
+
*
|
|
13
|
+
* Per ADR-173 §"obstruction is automatically lifted when the obstructor
|
|
14
|
+
* moves", the obstructor's *current* location is re-checked at query time —
|
|
15
|
+
* the wall does not store an obstruction flag. Move the bookcase aside and
|
|
16
|
+
* the obstruction lifts without explicit event handling. Authors who want
|
|
17
|
+
* custom side-effects on movement use ADR-052 event handlers in the usual
|
|
18
|
+
* way; the default protocol behavior is purely query-time.
|
|
19
|
+
*
|
|
20
|
+
* Public interface: `getCurrentObstructor`, `findTraitOnObstructor`,
|
|
21
|
+
* `findTraitsOnObstructors`. The latter two implement the obstructor-trait
|
|
22
|
+
* protocol; the first is the underlying location-aware lookup useful for
|
|
23
|
+
* non-trait queries (e.g. a future BREACH action rendering "the bookcase
|
|
24
|
+
* blocks your access" without consulting any trait).
|
|
25
|
+
*
|
|
26
|
+
* Owner context: `@sharpee/world-model` — wall / spatial primitives.
|
|
27
|
+
*/
|
|
28
|
+
import type { EntityId } from "../../core/index";
|
|
29
|
+
import type { IFEntity } from '../entities/if-entity';
|
|
30
|
+
import type { WallEntity } from '../entities/wall-entity';
|
|
31
|
+
import type { ITrait } from './trait';
|
|
32
|
+
/**
|
|
33
|
+
* Narrow world-model surface required to evaluate obstructors. Implemented
|
|
34
|
+
* by `WorldModel`; passed in by callers so the helper has no implicit
|
|
35
|
+
* dependency on the full world API.
|
|
36
|
+
*/
|
|
37
|
+
export interface IObstructorQueryWorld {
|
|
38
|
+
getEntity(id: string): IFEntity | undefined;
|
|
39
|
+
getLocation(id: string): string | undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns the entity currently obstructing a wall side, or undefined when
|
|
43
|
+
* no obstructor is in effect.
|
|
44
|
+
*
|
|
45
|
+
* Returns undefined when:
|
|
46
|
+
* - the side has no `obstructedBy` declared
|
|
47
|
+
* - the obstructor entity no longer exists in the world
|
|
48
|
+
* - the obstructor is not currently located in the side's room (it was
|
|
49
|
+
* moved aside, taken into inventory, etc.)
|
|
50
|
+
*
|
|
51
|
+
* The runtime location check is the load-bearing semantics: ADR-173 keeps
|
|
52
|
+
* obstruction state implicit so that PUSH BOOKCASE / TAKE TAPESTRY lift
|
|
53
|
+
* obstruction without further bookkeeping.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getCurrentObstructor(wall: WallEntity, side: EntityId, world: IObstructorQueryWorld): IFEntity | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the capability-specific trait carried by the given side's current
|
|
58
|
+
* obstructor, or undefined if no contribution applies.
|
|
59
|
+
*
|
|
60
|
+
* Returns undefined when:
|
|
61
|
+
* - no obstructor is currently present on this side
|
|
62
|
+
* (per `getCurrentObstructor`)
|
|
63
|
+
* - the obstructor lacks the requested trait
|
|
64
|
+
*
|
|
65
|
+
* AC-10 (ADR-173): an obstructor lacking the trait contributes zero to that
|
|
66
|
+
* capability — callers that sum contributions treat undefined as 0.
|
|
67
|
+
*/
|
|
68
|
+
export declare function findTraitOnObstructor<T extends ITrait>(wall: WallEntity, side: EntityId, traitType: string, world: IObstructorQueryWorld): T | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Result of a cross-side obstructor-trait scan: one entry per side that has
|
|
71
|
+
* a current obstructor carrying the requested trait. The `side` field is
|
|
72
|
+
* the room id of the obstructed side (i.e. the room the obstructor sits
|
|
73
|
+
* in); the `obstructor` is the resolved entity; `trait` is the matching
|
|
74
|
+
* trait instance.
|
|
75
|
+
*/
|
|
76
|
+
export interface IObstructorTraitMatch<T extends ITrait> {
|
|
77
|
+
side: EntityId;
|
|
78
|
+
obstructor: IFEntity;
|
|
79
|
+
trait: T;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Walks both sides of the wall and returns the matching capability-specific
|
|
83
|
+
* trait for each side that has one.
|
|
84
|
+
*
|
|
85
|
+
* Returns an empty array when neither side has an obstructor with the
|
|
86
|
+
* requested trait — the AC-10 zero-contribution case for the cross-side
|
|
87
|
+
* aggregation pattern.
|
|
88
|
+
*
|
|
89
|
+
* This is the helper ADR-172's acoustic-cost formula consults to sum
|
|
90
|
+
* `AcousticDampenerTrait.acousticCostModifier` across both sides
|
|
91
|
+
* (AC-9 in ADR-173, AC-7 in ADR-172). Future capabilities follow the same
|
|
92
|
+
* shape — pass the trait type the capability declares, sum contributions
|
|
93
|
+
* the way that capability cares about.
|
|
94
|
+
*/
|
|
95
|
+
export declare function findTraitsOnObstructors<T extends ITrait>(wall: WallEntity, traitType: string, world: IObstructorQueryWorld): IObstructorTraitMatch<T>[];
|
|
96
|
+
//# sourceMappingURL=obstructor-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"obstructor-protocol.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/traits/obstructor-protocol.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC5C,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,qBAAqB,GAC3B,QAAQ,GAAG,SAAS,CAUtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,qBAAqB,GAC3B,CAAC,GAAG,SAAS,CAIf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,MAAM;IACrD,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;CACV;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,EACtD,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,qBAAqB,GAC3B,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAU5B"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// packages/world-model/src/traits/obstructor-protocol.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getCurrentObstructor = getCurrentObstructor;
|
|
5
|
+
exports.findTraitOnObstructor = findTraitOnObstructor;
|
|
6
|
+
exports.findTraitsOnObstructors = findTraitsOnObstructors;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the entity currently obstructing a wall side, or undefined when
|
|
9
|
+
* no obstructor is in effect.
|
|
10
|
+
*
|
|
11
|
+
* Returns undefined when:
|
|
12
|
+
* - the side has no `obstructedBy` declared
|
|
13
|
+
* - the obstructor entity no longer exists in the world
|
|
14
|
+
* - the obstructor is not currently located in the side's room (it was
|
|
15
|
+
* moved aside, taken into inventory, etc.)
|
|
16
|
+
*
|
|
17
|
+
* The runtime location check is the load-bearing semantics: ADR-173 keeps
|
|
18
|
+
* obstruction state implicit so that PUSH BOOKCASE / TAKE TAPESTRY lift
|
|
19
|
+
* obstruction without further bookkeeping.
|
|
20
|
+
*/
|
|
21
|
+
function getCurrentObstructor(wall, side, world) {
|
|
22
|
+
const sideData = wall.getSide(side);
|
|
23
|
+
if (!sideData?.obstructedBy)
|
|
24
|
+
return undefined;
|
|
25
|
+
const obstructor = world.getEntity(sideData.obstructedBy);
|
|
26
|
+
if (!obstructor)
|
|
27
|
+
return undefined;
|
|
28
|
+
if (world.getLocation(obstructor.id) !== side)
|
|
29
|
+
return undefined;
|
|
30
|
+
return obstructor;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the capability-specific trait carried by the given side's current
|
|
34
|
+
* obstructor, or undefined if no contribution applies.
|
|
35
|
+
*
|
|
36
|
+
* Returns undefined when:
|
|
37
|
+
* - no obstructor is currently present on this side
|
|
38
|
+
* (per `getCurrentObstructor`)
|
|
39
|
+
* - the obstructor lacks the requested trait
|
|
40
|
+
*
|
|
41
|
+
* AC-10 (ADR-173): an obstructor lacking the trait contributes zero to that
|
|
42
|
+
* capability — callers that sum contributions treat undefined as 0.
|
|
43
|
+
*/
|
|
44
|
+
function findTraitOnObstructor(wall, side, traitType, world) {
|
|
45
|
+
const obstructor = getCurrentObstructor(wall, side, world);
|
|
46
|
+
if (!obstructor)
|
|
47
|
+
return undefined;
|
|
48
|
+
return obstructor.get(traitType);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Walks both sides of the wall and returns the matching capability-specific
|
|
52
|
+
* trait for each side that has one.
|
|
53
|
+
*
|
|
54
|
+
* Returns an empty array when neither side has an obstructor with the
|
|
55
|
+
* requested trait — the AC-10 zero-contribution case for the cross-side
|
|
56
|
+
* aggregation pattern.
|
|
57
|
+
*
|
|
58
|
+
* This is the helper ADR-172's acoustic-cost formula consults to sum
|
|
59
|
+
* `AcousticDampenerTrait.acousticCostModifier` across both sides
|
|
60
|
+
* (AC-9 in ADR-173, AC-7 in ADR-172). Future capabilities follow the same
|
|
61
|
+
* shape — pass the trait type the capability declares, sum contributions
|
|
62
|
+
* the way that capability cares about.
|
|
63
|
+
*/
|
|
64
|
+
function findTraitsOnObstructors(wall, traitType, world) {
|
|
65
|
+
const matches = [];
|
|
66
|
+
for (const side of wall.between) {
|
|
67
|
+
const obstructor = getCurrentObstructor(wall, side, world);
|
|
68
|
+
if (!obstructor)
|
|
69
|
+
continue;
|
|
70
|
+
const trait = obstructor.get(traitType);
|
|
71
|
+
if (!trait)
|
|
72
|
+
continue;
|
|
73
|
+
matches.push({ side, obstructor, trait });
|
|
74
|
+
}
|
|
75
|
+
return matches;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=obstructor-protocol.js.map
|