@sharpee/world-model 0.9.107 → 0.9.110
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/constants/directions.d.ts +1 -89
- package/constants/directions.d.ts.map +1 -1
- package/constants/directions.js +2 -162
- package/constants/directions.js.map +1 -1
- package/entities/entity-types.d.ts +4 -0
- package/entities/entity-types.d.ts.map +1 -1
- package/entities/entity-types.js +6 -0
- package/entities/entity-types.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/traits/combatant/combatantTrait.d.ts +3 -0
- package/traits/combatant/combatantTrait.d.ts.map +1 -1
- package/traits/combatant/combatantTrait.js +2 -0
- package/traits/combatant/combatantTrait.js.map +1 -1
- package/traits/concealment/concealedStateTrait.d.ts +59 -0
- package/traits/concealment/concealedStateTrait.d.ts.map +1 -0
- package/traits/concealment/concealedStateTrait.js +63 -0
- package/traits/concealment/concealedStateTrait.js.map +1 -0
- package/traits/concealment/concealedVisibilityBehavior.d.ts +27 -0
- package/traits/concealment/concealedVisibilityBehavior.d.ts.map +1 -0
- package/traits/concealment/concealedVisibilityBehavior.js +44 -0
- package/traits/concealment/concealedVisibilityBehavior.js.map +1 -0
- package/traits/concealment/concealmentTrait.d.ts +54 -0
- package/traits/concealment/concealmentTrait.d.ts.map +1 -0
- package/traits/concealment/concealmentTrait.js +58 -0
- package/traits/concealment/concealmentTrait.js.map +1 -0
- package/traits/concealment/index.d.ts +7 -0
- package/traits/concealment/index.d.ts.map +1 -0
- package/traits/concealment/index.js +23 -0
- package/traits/concealment/index.js.map +1 -0
- package/traits/implementations.d.ts +3 -1
- package/traits/implementations.d.ts.map +1 -1
- package/traits/implementations.js +13 -2
- 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 +4 -0
- package/traits/index.js.map +1 -1
- package/traits/region/index.d.ts +6 -0
- package/traits/region/index.d.ts.map +1 -0
- package/traits/region/index.js +10 -0
- package/traits/region/index.js.map +1 -0
- package/traits/region/regionTrait.d.ts +49 -0
- package/traits/region/regionTrait.d.ts.map +1 -0
- package/traits/region/regionTrait.js +43 -0
- package/traits/region/regionTrait.js.map +1 -0
- package/traits/room/roomBehavior.js +1 -1
- package/traits/room/roomBehavior.js.map +1 -1
- package/traits/room/roomTrait.d.ts +3 -3
- package/traits/room/roomTrait.d.ts.map +1 -1
- package/traits/room/roomTrait.js +2 -2
- package/traits/room/roomTrait.js.map +1 -1
- package/traits/scene/index.d.ts +6 -0
- package/traits/scene/index.d.ts.map +1 -0
- package/traits/scene/index.js +10 -0
- package/traits/scene/index.js.map +1 -0
- package/traits/scene/sceneTrait.d.ts +57 -0
- package/traits/scene/sceneTrait.d.ts.map +1 -0
- package/traits/scene/sceneTrait.js +48 -0
- package/traits/scene/sceneTrait.js.map +1 -0
- package/traits/story-info/storyInfoTrait.d.ts +1 -1
- package/traits/story-info/storyInfoTrait.js +1 -1
- package/traits/trait-types.d.ts +4 -0
- package/traits/trait-types.d.ts.map +1 -1
- package/traits/trait-types.js +10 -1
- package/traits/trait-types.js.map +1 -1
- package/world/AuthorModel.d.ts +11 -3
- package/world/AuthorModel.d.ts.map +1 -1
- package/world/AuthorModel.js +32 -4
- package/world/AuthorModel.js.map +1 -1
- package/world/WorldModel.d.ts +135 -12
- package/world/WorldModel.d.ts.map +1 -1
- package/world/WorldModel.js +241 -14
- package/world/WorldModel.js.map +1 -1
- package/world/index.d.ts +1 -1
- package/world/index.d.ts.map +1 -1
- package/world/index.js.map +1 -1
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Language-agnostic direction constants for Interactive Fiction
|
|
3
3
|
*
|
|
4
4
|
* These constants represent spatial relationships, not English words.
|
|
5
|
-
*
|
|
6
|
-
* presented to and accepted from the player.
|
|
5
|
+
* The parser owns the mapping from English words to these constants.
|
|
7
6
|
*/
|
|
8
7
|
export declare const Direction: {
|
|
9
8
|
readonly NORTH: "NORTH";
|
|
@@ -32,91 +31,4 @@ export declare function getOppositeDirection(direction: DirectionType): Directio
|
|
|
32
31
|
* Check if a value is a valid Direction constant
|
|
33
32
|
*/
|
|
34
33
|
export declare function isDirection(value: unknown): value is DirectionType;
|
|
35
|
-
/**
|
|
36
|
-
* A single entry in a direction vocabulary.
|
|
37
|
-
*
|
|
38
|
-
* @property display - The word shown to the player (e.g., "fore")
|
|
39
|
-
* @property words - All words the parser accepts for this direction (e.g., ["fore", "f", "forward"])
|
|
40
|
-
*/
|
|
41
|
-
export interface DirectionEntry {
|
|
42
|
-
display: string;
|
|
43
|
-
words: string[];
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* A named set of direction-word mappings.
|
|
47
|
-
*
|
|
48
|
-
* Only directions present in the entries map are available to the player.
|
|
49
|
-
* A vocabulary that omits NORTHEAST means diagonal movement is not recognized.
|
|
50
|
-
*/
|
|
51
|
-
export interface DirectionVocabulary {
|
|
52
|
-
id: string;
|
|
53
|
-
entries: Partial<Record<DirectionType, DirectionEntry>>;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Pre-defined compass vocabulary (the default).
|
|
57
|
-
*/
|
|
58
|
-
export declare const CompassVocabulary: DirectionVocabulary;
|
|
59
|
-
/**
|
|
60
|
-
* Naval vocabulary — relative to the vessel.
|
|
61
|
-
*
|
|
62
|
-
* Maps cardinal directions to shipboard equivalents.
|
|
63
|
-
* Diagonals are omitted (ships don't have northeast).
|
|
64
|
-
*/
|
|
65
|
-
export declare const NavalVocabulary: DirectionVocabulary;
|
|
66
|
-
/**
|
|
67
|
-
* Minimal vocabulary — for caves, abstract spaces, interiors.
|
|
68
|
-
*
|
|
69
|
-
* Only vertical and threshold directions. No compass.
|
|
70
|
-
*/
|
|
71
|
-
export declare const MinimalVocabulary: DirectionVocabulary;
|
|
72
|
-
/**
|
|
73
|
-
* Registry of named direction vocabularies.
|
|
74
|
-
*
|
|
75
|
-
* Stories retrieve the registry from the world model and call
|
|
76
|
-
* `useVocabulary()` or `rename()` to configure direction words
|
|
77
|
-
* from a single point.
|
|
78
|
-
*/
|
|
79
|
-
export declare class DirectionVocabularyRegistry {
|
|
80
|
-
private vocabularies;
|
|
81
|
-
private active;
|
|
82
|
-
private listeners;
|
|
83
|
-
constructor();
|
|
84
|
-
/**
|
|
85
|
-
* Register a custom vocabulary.
|
|
86
|
-
*/
|
|
87
|
-
define(vocab: DirectionVocabulary): void;
|
|
88
|
-
/**
|
|
89
|
-
* Get a vocabulary by name.
|
|
90
|
-
*/
|
|
91
|
-
get(id: string): DirectionVocabulary | undefined;
|
|
92
|
-
/**
|
|
93
|
-
* Switch the active vocabulary by name.
|
|
94
|
-
* Notifies all listeners (parser, grammar) to rebuild their mappings.
|
|
95
|
-
*/
|
|
96
|
-
useVocabulary(id: string): void;
|
|
97
|
-
/**
|
|
98
|
-
* Rename a single direction in the active vocabulary.
|
|
99
|
-
* Creates a modified copy so the original named vocabulary is not mutated.
|
|
100
|
-
*/
|
|
101
|
-
rename(direction: DirectionType, entry: DirectionEntry): void;
|
|
102
|
-
/**
|
|
103
|
-
* Add alias words to a direction without replacing the existing ones.
|
|
104
|
-
*/
|
|
105
|
-
alias(direction: DirectionType, entry: DirectionEntry): void;
|
|
106
|
-
/**
|
|
107
|
-
* Get the currently active vocabulary.
|
|
108
|
-
*/
|
|
109
|
-
getActive(): DirectionVocabulary;
|
|
110
|
-
/**
|
|
111
|
-
* Get the display name for a direction in the active vocabulary.
|
|
112
|
-
* Falls back to lowercase direction constant if not in vocabulary.
|
|
113
|
-
*/
|
|
114
|
-
getDisplayName(direction: DirectionType): string;
|
|
115
|
-
/**
|
|
116
|
-
* Register a listener that is called when the active vocabulary changes.
|
|
117
|
-
* Used by the parser to rebuild direction mappings.
|
|
118
|
-
*/
|
|
119
|
-
onVocabularyChange(listener: (vocab: DirectionVocabulary) => void): void;
|
|
120
|
-
private notifyListeners;
|
|
121
|
-
}
|
|
122
34
|
//# sourceMappingURL=directions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directions.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/constants/directions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"directions.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/constants/directions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAaZ,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,aAAa,EAAE,aAAa,CAanE,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,CAE5E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAElE"}
|
package/constants/directions.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* Language-agnostic direction constants for Interactive Fiction
|
|
4
4
|
*
|
|
5
5
|
* These constants represent spatial relationships, not English words.
|
|
6
|
-
*
|
|
7
|
-
* presented to and accepted from the player.
|
|
6
|
+
* The parser owns the mapping from English words to these constants.
|
|
8
7
|
*/
|
|
9
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
9
|
+
exports.DirectionOpposites = exports.Direction = void 0;
|
|
11
10
|
exports.getOppositeDirection = getOppositeDirection;
|
|
12
11
|
exports.isDirection = isDirection;
|
|
13
12
|
exports.Direction = {
|
|
@@ -53,163 +52,4 @@ function getOppositeDirection(direction) {
|
|
|
53
52
|
function isDirection(value) {
|
|
54
53
|
return typeof value === 'string' && Object.values(exports.Direction).includes(value);
|
|
55
54
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Pre-defined compass vocabulary (the default).
|
|
58
|
-
*/
|
|
59
|
-
exports.CompassVocabulary = {
|
|
60
|
-
id: 'compass',
|
|
61
|
-
entries: {
|
|
62
|
-
[exports.Direction.NORTH]: { display: 'north', words: ['north', 'n'] },
|
|
63
|
-
[exports.Direction.SOUTH]: { display: 'south', words: ['south', 's'] },
|
|
64
|
-
[exports.Direction.EAST]: { display: 'east', words: ['east', 'e'] },
|
|
65
|
-
[exports.Direction.WEST]: { display: 'west', words: ['west', 'w'] },
|
|
66
|
-
[exports.Direction.NORTHEAST]: { display: 'northeast', words: ['northeast', 'ne'] },
|
|
67
|
-
[exports.Direction.NORTHWEST]: { display: 'northwest', words: ['northwest', 'nw'] },
|
|
68
|
-
[exports.Direction.SOUTHEAST]: { display: 'southeast', words: ['southeast', 'se'] },
|
|
69
|
-
[exports.Direction.SOUTHWEST]: { display: 'southwest', words: ['southwest', 'sw'] },
|
|
70
|
-
[exports.Direction.UP]: { display: 'up', words: ['up', 'u'] },
|
|
71
|
-
[exports.Direction.DOWN]: { display: 'down', words: ['down', 'd'] },
|
|
72
|
-
[exports.Direction.IN]: { display: 'in', words: ['in', 'inside'] },
|
|
73
|
-
[exports.Direction.OUT]: { display: 'out', words: ['out', 'outside'] },
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Naval vocabulary — relative to the vessel.
|
|
78
|
-
*
|
|
79
|
-
* Maps cardinal directions to shipboard equivalents.
|
|
80
|
-
* Diagonals are omitted (ships don't have northeast).
|
|
81
|
-
*/
|
|
82
|
-
exports.NavalVocabulary = {
|
|
83
|
-
id: 'naval',
|
|
84
|
-
entries: {
|
|
85
|
-
[exports.Direction.NORTH]: { display: 'fore', words: ['fore', 'f', 'forward', 'bow'] },
|
|
86
|
-
[exports.Direction.SOUTH]: { display: 'aft', words: ['aft', 'a', 'back', 'stern'] },
|
|
87
|
-
[exports.Direction.EAST]: { display: 'starboard', words: ['starboard', 'sb', 'right'] },
|
|
88
|
-
[exports.Direction.WEST]: { display: 'port', words: ['port', 'p', 'left'] },
|
|
89
|
-
[exports.Direction.UP]: { display: 'topside', words: ['topside', 'ts', 'up', 'u'] },
|
|
90
|
-
[exports.Direction.DOWN]: { display: 'below decks', words: ['below', 'below decks', 'bd', 'down', 'd'] },
|
|
91
|
-
[exports.Direction.IN]: { display: 'in', words: ['in', 'inside'] },
|
|
92
|
-
[exports.Direction.OUT]: { display: 'out', words: ['out', 'outside'] },
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Minimal vocabulary — for caves, abstract spaces, interiors.
|
|
97
|
-
*
|
|
98
|
-
* Only vertical and threshold directions. No compass.
|
|
99
|
-
*/
|
|
100
|
-
exports.MinimalVocabulary = {
|
|
101
|
-
id: 'minimal',
|
|
102
|
-
entries: {
|
|
103
|
-
[exports.Direction.UP]: { display: 'up', words: ['up', 'u', 'climb'] },
|
|
104
|
-
[exports.Direction.DOWN]: { display: 'down', words: ['down', 'd', 'descend'] },
|
|
105
|
-
[exports.Direction.IN]: { display: 'in', words: ['in', 'inside', 'enter', 'deeper'] },
|
|
106
|
-
[exports.Direction.OUT]: { display: 'out', words: ['out', 'outside', 'exit', 'back'] },
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Registry of named direction vocabularies.
|
|
111
|
-
*
|
|
112
|
-
* Stories retrieve the registry from the world model and call
|
|
113
|
-
* `useVocabulary()` or `rename()` to configure direction words
|
|
114
|
-
* from a single point.
|
|
115
|
-
*/
|
|
116
|
-
class DirectionVocabularyRegistry {
|
|
117
|
-
vocabularies = new Map();
|
|
118
|
-
active;
|
|
119
|
-
listeners = [];
|
|
120
|
-
constructor() {
|
|
121
|
-
// Register built-in vocabularies
|
|
122
|
-
this.vocabularies.set('compass', exports.CompassVocabulary);
|
|
123
|
-
this.vocabularies.set('naval', exports.NavalVocabulary);
|
|
124
|
-
this.vocabularies.set('minimal', exports.MinimalVocabulary);
|
|
125
|
-
this.active = exports.CompassVocabulary;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Register a custom vocabulary.
|
|
129
|
-
*/
|
|
130
|
-
define(vocab) {
|
|
131
|
-
this.vocabularies.set(vocab.id, vocab);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Get a vocabulary by name.
|
|
135
|
-
*/
|
|
136
|
-
get(id) {
|
|
137
|
-
return this.vocabularies.get(id);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Switch the active vocabulary by name.
|
|
141
|
-
* Notifies all listeners (parser, grammar) to rebuild their mappings.
|
|
142
|
-
*/
|
|
143
|
-
useVocabulary(id) {
|
|
144
|
-
const vocab = this.vocabularies.get(id);
|
|
145
|
-
if (!vocab) {
|
|
146
|
-
throw new Error(`Unknown direction vocabulary: '${id}'. Available: ${[...this.vocabularies.keys()].join(', ')}`);
|
|
147
|
-
}
|
|
148
|
-
this.active = vocab;
|
|
149
|
-
this.notifyListeners();
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Rename a single direction in the active vocabulary.
|
|
153
|
-
* Creates a modified copy so the original named vocabulary is not mutated.
|
|
154
|
-
*/
|
|
155
|
-
rename(direction, entry) {
|
|
156
|
-
// If active is a named vocabulary, clone it as 'custom'
|
|
157
|
-
if (this.active.id !== 'custom') {
|
|
158
|
-
this.active = {
|
|
159
|
-
id: 'custom',
|
|
160
|
-
entries: { ...this.active.entries }
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
this.active.entries[direction] = entry;
|
|
164
|
-
this.notifyListeners();
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Add alias words to a direction without replacing the existing ones.
|
|
168
|
-
*/
|
|
169
|
-
alias(direction, entry) {
|
|
170
|
-
if (this.active.id !== 'custom') {
|
|
171
|
-
this.active = {
|
|
172
|
-
id: 'custom',
|
|
173
|
-
entries: { ...this.active.entries }
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
const existing = this.active.entries[direction];
|
|
177
|
-
if (existing) {
|
|
178
|
-
// Merge words, use new display name
|
|
179
|
-
const mergedWords = [...new Set([...existing.words, ...entry.words])];
|
|
180
|
-
this.active.entries[direction] = { display: entry.display, words: mergedWords };
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
this.active.entries[direction] = entry;
|
|
184
|
-
}
|
|
185
|
-
this.notifyListeners();
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Get the currently active vocabulary.
|
|
189
|
-
*/
|
|
190
|
-
getActive() {
|
|
191
|
-
return this.active;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Get the display name for a direction in the active vocabulary.
|
|
195
|
-
* Falls back to lowercase direction constant if not in vocabulary.
|
|
196
|
-
*/
|
|
197
|
-
getDisplayName(direction) {
|
|
198
|
-
const entry = this.active.entries[direction];
|
|
199
|
-
return entry?.display ?? direction.toLowerCase();
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Register a listener that is called when the active vocabulary changes.
|
|
203
|
-
* Used by the parser to rebuild direction mappings.
|
|
204
|
-
*/
|
|
205
|
-
onVocabularyChange(listener) {
|
|
206
|
-
this.listeners.push(listener);
|
|
207
|
-
}
|
|
208
|
-
notifyListeners() {
|
|
209
|
-
for (const listener of this.listeners) {
|
|
210
|
-
listener(this.active);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
exports.DirectionVocabularyRegistry = DirectionVocabularyRegistry;
|
|
215
55
|
//# sourceMappingURL=directions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directions.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/constants/directions.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"directions.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/constants/directions.ts"],"names":[],"mappings":";AAAA;;;;;GAKG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CAAC,SAAS,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,iBAAS,CAAC,CAAC,QAAQ,CAAC,KAAsB,CAAC,CAAC;AAChG,CAAC"}
|
|
@@ -21,6 +21,10 @@ export declare const EntityType: {
|
|
|
21
21
|
readonly SCENERY: "scenery";
|
|
22
22
|
/** A directional exit (rarely used as entity) */
|
|
23
23
|
readonly EXIT: "exit";
|
|
24
|
+
/** A geographic grouping of rooms (ADR-149) */
|
|
25
|
+
readonly REGION: "region";
|
|
26
|
+
/** A temporal phase of the story (ADR-149) */
|
|
27
|
+
readonly SCENE: "scene";
|
|
24
28
|
/** Generic object type (default) */
|
|
25
29
|
readonly OBJECT: "object";
|
|
26
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-types.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/entities/entity-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,UAAU;IACrB,mCAAmC;;IAGnC,wCAAwC;;IAGxC,gCAAgC;;IAGhC,kCAAkC;;IAGlC,+CAA+C;;IAG/C,sDAAsD;;IAGtD,mDAAmD;;IAGnD,iDAAiD;;IAGjD,oCAAoC;;CAE5B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,UAAU,CAE7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"entity-types.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/entities/entity-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,UAAU;IACrB,mCAAmC;;IAGnC,wCAAwC;;IAGxC,gCAAgC;;IAGhC,kCAAkC;;IAGlC,+CAA+C;;IAG/C,sDAAsD;;IAGtD,mDAAmD;;IAGnD,iDAAiD;;IAGjD,+CAA+C;;IAG/C,8CAA8C;;IAG9C,oCAAoC;;CAE5B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,UAAU,CAE7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAgB5D"}
|
package/entities/entity-types.js
CHANGED
|
@@ -26,6 +26,10 @@ exports.EntityType = {
|
|
|
26
26
|
SCENERY: 'scenery',
|
|
27
27
|
/** A directional exit (rarely used as entity) */
|
|
28
28
|
EXIT: 'exit',
|
|
29
|
+
/** A geographic grouping of rooms (ADR-149) */
|
|
30
|
+
REGION: 'region',
|
|
31
|
+
/** A temporal phase of the story (ADR-149) */
|
|
32
|
+
SCENE: 'scene',
|
|
29
33
|
/** Generic object type (default) */
|
|
30
34
|
OBJECT: 'object'
|
|
31
35
|
};
|
|
@@ -49,6 +53,8 @@ function getEntityTypePrefix(type) {
|
|
|
49
53
|
[exports.EntityType.SUPPORTER]: 's',
|
|
50
54
|
[exports.EntityType.SCENERY]: 'y',
|
|
51
55
|
[exports.EntityType.EXIT]: 'e',
|
|
56
|
+
[exports.EntityType.REGION]: 'rg',
|
|
57
|
+
[exports.EntityType.SCENE]: 'sc',
|
|
52
58
|
[exports.EntityType.OBJECT]: 'o'
|
|
53
59
|
};
|
|
54
60
|
return prefixMap[type] || 'o';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-types.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/entities/entity-types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"entity-types.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/entities/entity-types.ts"],"names":[],"mappings":";;;AAiDA,oCAEC;AAMD,kDAgBC;AAzED;;;;;GAKG;AACU,QAAA,UAAU,GAAG;IACxB,mCAAmC;IACnC,IAAI,EAAE,MAAM;IAEZ,wCAAwC;IACxC,IAAI,EAAE,MAAM;IAEZ,gCAAgC;IAChC,IAAI,EAAE,MAAM;IAEZ,kCAAkC;IAClC,KAAK,EAAE,OAAO;IAEd,+CAA+C;IAC/C,SAAS,EAAE,WAAW;IAEtB,sDAAsD;IACtD,SAAS,EAAE,WAAW;IAEtB,mDAAmD;IACnD,OAAO,EAAE,SAAS;IAElB,iDAAiD;IACjD,IAAI,EAAE,MAAM;IAEZ,+CAA+C;IAC/C,MAAM,EAAE,QAAQ;IAEhB,8CAA8C;IAC9C,KAAK,EAAE,OAAO;IAEd,oCAAoC;IACpC,MAAM,EAAE,QAAQ;CACR,CAAC;AAOX;;GAEG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAU,CAAC,CAAC,QAAQ,CAAC,IAAkB,CAAC,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAAgB;IAClD,MAAM,SAAS,GAA+B;QAC5C,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,GAAG;QACtB,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,GAAG;QACtB,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,GAAG;QACtB,CAAC,kBAAU,CAAC,KAAK,CAAC,EAAE,GAAG;QACvB,CAAC,kBAAU,CAAC,SAAS,CAAC,EAAE,GAAG;QAC3B,CAAC,kBAAU,CAAC,SAAS,CAAC,EAAE,GAAG;QAC3B,CAAC,kBAAU,CAAC,OAAO,CAAC,EAAE,GAAG;QACzB,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,GAAG;QACtB,CAAC,kBAAU,CAAC,MAAM,CAAC,EAAE,IAAI;QACzB,CAAC,kBAAU,CAAC,KAAK,CAAC,EAAE,IAAI;QACxB,CAAC,kBAAU,CAAC,MAAM,CAAC,EAAE,GAAG;KACzB,CAAC;IAEF,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;AAChC,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export * from './traits/npc';
|
|
|
32
32
|
export * from './traits/vehicle';
|
|
33
33
|
export * from './traits/story-info';
|
|
34
34
|
export * from './traits/character-model';
|
|
35
|
+
export * from './traits/concealment';
|
|
35
36
|
export * from './extensions';
|
|
36
37
|
export * from './world';
|
|
37
38
|
export * from './scope';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/world-model/src/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/world-model/src/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,eAAe,CAAC"}
|
package/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __exportStar(require("./traits/npc"), exports);
|
|
|
55
55
|
__exportStar(require("./traits/vehicle"), exports);
|
|
56
56
|
__exportStar(require("./traits/story-info"), exports);
|
|
57
57
|
__exportStar(require("./traits/character-model"), exports);
|
|
58
|
+
__exportStar(require("./traits/concealment"), exports);
|
|
58
59
|
// Extension system
|
|
59
60
|
__exportStar(require("./extensions"), exports);
|
|
60
61
|
// World model
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,gBAAgB;AAChB,6CAA2B;AAE3B,iBAAiB;AACjB,8CAA4B;AAE5B,YAAY;AACZ,8CAA4B;AAE5B,8CAA8C;AAC9C,6CAA2B;AAC3B,+CAA6B;AAE7B,SAAS;AACT,iDAA+B;AAC/B,uDAAqC;AACrC,2DAAyC;AAEzC,2BAA2B;AAC3B,oDAAkC;AAClC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,iDAA+B;AAC/B,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,4DAA0C;AAC1C,oDAAkC;AAClC,oDAAkC;AAClC,+CAA6B;AAC7B,mDAAiC;AACjC,sDAAoC;AACpC,2DAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,gBAAgB;AAChB,6CAA2B;AAE3B,iBAAiB;AACjB,8CAA4B;AAE5B,YAAY;AACZ,8CAA4B;AAE5B,8CAA8C;AAC9C,6CAA2B;AAC3B,+CAA6B;AAE7B,SAAS;AACT,iDAA+B;AAC/B,uDAAqC;AACrC,2DAAyC;AAEzC,2BAA2B;AAC3B,oDAAkC;AAClC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,iDAA+B;AAC/B,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,4DAA0C;AAC1C,oDAAkC;AAClC,oDAAkC;AAClC,+CAA6B;AAC7B,mDAAiC;AACjC,sDAAoC;AACpC,2DAAyC;AACzC,uDAAqC;AAErC,mBAAmB;AACnB,+CAA6B;AAE7B,cAAc;AACd,0CAAwB;AAExB,eAAe;AACf,0CAAwB;AAExB,mFAAmF;AACnF,iDAA+B;AAE/B,uCAAuC;AACvC,iDAA+B;AAE/B,wBAAwB;AACxB,gDAA8B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/world-model",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.110",
|
|
4
4
|
"description": "World model for Sharpee IF platform - entities, traits, and behaviors",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/core": "^0.9.
|
|
16
|
-
"@sharpee/if-domain": "^0.9.
|
|
15
|
+
"@sharpee/core": "^0.9.110",
|
|
16
|
+
"@sharpee/if-domain": "^0.9.110"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"interactive-fiction",
|
|
@@ -37,6 +37,8 @@ export interface ICombatantData {
|
|
|
37
37
|
dropsInventory?: boolean;
|
|
38
38
|
/** Experience points awarded when defeated */
|
|
39
39
|
experienceValue?: number;
|
|
40
|
+
/** Whether this combatant is undead/spirit (affects blessed weapon bonus) */
|
|
41
|
+
isUndead?: boolean;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
44
|
* Combatant trait indicates an entity can engage in combat.
|
|
@@ -64,6 +66,7 @@ export declare class CombatantTrait implements ITrait, ICombatantData {
|
|
|
64
66
|
canRetaliate: boolean;
|
|
65
67
|
dropsInventory: boolean;
|
|
66
68
|
experienceValue: number;
|
|
69
|
+
isUndead: boolean;
|
|
67
70
|
constructor(data?: ICombatantData);
|
|
68
71
|
/**
|
|
69
72
|
* Computed property to check if combatant is alive based on health
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combatantTrait.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/combatant/combatantTrait.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,mDAAmD;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,0CAA0C;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"combatantTrait.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/combatant/combatantTrait.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAA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,EAAE,OAAO,CAAC;gBAEN,IAAI,GAAE,cAAmB;IAsBrC;;OAEG;IACH,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;IAOtC;;OAEG;IACH,MAAM,IAAI,IAAI;IAOd;;OAEG;IACH,IAAI,IAAI,IAAI;IAMZ;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAiBnC;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAQ3B"}
|
|
@@ -31,6 +31,7 @@ class CombatantTrait {
|
|
|
31
31
|
canRetaliate;
|
|
32
32
|
dropsInventory;
|
|
33
33
|
experienceValue;
|
|
34
|
+
isUndead;
|
|
34
35
|
constructor(data = {}) {
|
|
35
36
|
// Set defaults and merge with provided data
|
|
36
37
|
this.health = data.health ?? data.maxHealth ?? 10;
|
|
@@ -50,6 +51,7 @@ class CombatantTrait {
|
|
|
50
51
|
this.canRetaliate = data.canRetaliate ?? true;
|
|
51
52
|
this.dropsInventory = data.dropsInventory ?? true;
|
|
52
53
|
this.experienceValue = data.experienceValue ?? 0;
|
|
54
|
+
this.isUndead = data.isUndead ?? false;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Computed property to check if combatant is alive based on health
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combatantTrait.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/combatant/combatantTrait.ts"],"names":[],"mappings":";AAAA;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"combatantTrait.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/combatant/combatantTrait.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA4DH;;;;;GAKG;AACH,MAAa,cAAc;IACzB,MAAM,CAAU,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,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,CAAC;QAEzD,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC;QACd,CAAC;QAED,wDAAwD;QACxD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC;YACxC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,MAAc;QACjB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;YAC7D,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC;gBACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC;;AAxHH,wCAyHC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Concealed state trait — dynamic trait applied to actors when hiding (ADR-148)
|
|
3
|
+
*
|
|
4
|
+
* Added by the hiding action, removed by the revealing action or implicit reveal.
|
|
5
|
+
* Presence of this trait IS the concealed state — no boolean flag needed.
|
|
6
|
+
*
|
|
7
|
+
* Registers the if.scope.visible capability to block VisibilityBehavior.canSee().
|
|
8
|
+
* When an NPC calls canSee() on a concealed actor, the capability behavior
|
|
9
|
+
* returns { valid: false }, making the actor invisible.
|
|
10
|
+
*
|
|
11
|
+
* Public interface: ConcealedStateTrait, IConcealedStateTrait, isConcealed, getConcealmentState.
|
|
12
|
+
* Owner context: @sharpee/world-model / traits
|
|
13
|
+
*/
|
|
14
|
+
import { ITrait } from '../trait';
|
|
15
|
+
import { IFEntity } from '../../entities';
|
|
16
|
+
import { ConcealmentPosition, ConcealmentQuality } from './concealmentTrait';
|
|
17
|
+
/**
|
|
18
|
+
* Data interface for the concealed state.
|
|
19
|
+
*/
|
|
20
|
+
export interface IConcealedStateTrait {
|
|
21
|
+
/** The entity the actor is hiding behind/under/on/inside */
|
|
22
|
+
targetId: string;
|
|
23
|
+
/** How the actor is hiding */
|
|
24
|
+
position: ConcealmentPosition;
|
|
25
|
+
/** Snapshot of the hiding spot's quality at time of concealment */
|
|
26
|
+
quality: ConcealmentQuality;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Dynamic trait applied to an actor to mark them as concealed.
|
|
30
|
+
*
|
|
31
|
+
* The trait registers the `if.scope.visible` capability so that
|
|
32
|
+
* VisibilityBehavior.canSee() automatically returns false for
|
|
33
|
+
* concealed actors.
|
|
34
|
+
*/
|
|
35
|
+
export declare class ConcealedStateTrait implements ITrait, IConcealedStateTrait {
|
|
36
|
+
static readonly type = "if.trait.concealed_state";
|
|
37
|
+
readonly type = "if.trait.concealed_state";
|
|
38
|
+
/** Registers the visibility capability — concealed actors block canSee() */
|
|
39
|
+
static readonly capabilities: readonly ["if.scope.visible"];
|
|
40
|
+
targetId: string;
|
|
41
|
+
position: ConcealmentPosition;
|
|
42
|
+
quality: ConcealmentQuality;
|
|
43
|
+
constructor(data: IConcealedStateTrait);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if an entity is concealed.
|
|
47
|
+
*
|
|
48
|
+
* @param entity - The entity to check
|
|
49
|
+
* @returns True if the entity has ConcealedStateTrait
|
|
50
|
+
*/
|
|
51
|
+
export declare function isConcealed(entity: IFEntity): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Get the concealment details for an entity, or undefined if not concealed.
|
|
54
|
+
*
|
|
55
|
+
* @param entity - The entity to check
|
|
56
|
+
* @returns The concealment state, or undefined
|
|
57
|
+
*/
|
|
58
|
+
export declare function getConcealmentState(entity: IFEntity): IConcealedStateTrait | undefined;
|
|
59
|
+
//# sourceMappingURL=concealedStateTrait.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concealedStateTrait.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/concealment/concealedStateTrait.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,QAAQ,EAAE,mBAAmB,CAAC;IAE9B,mEAAmE;IACnE,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,YAAW,MAAM,EAAE,oBAAoB;IACtE,MAAM,CAAC,QAAQ,CAAC,IAAI,8BAA8B;IAClD,QAAQ,CAAC,IAAI,8BAA8B;IAE3C,4EAA4E;IAC5E,MAAM,CAAC,QAAQ,CAAC,YAAY,gCAAoC;IAEhE,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,OAAO,EAAE,kBAAkB,CAAC;gBAEhB,IAAI,EAAE,oBAAoB;CAKvC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAErD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,oBAAoB,GAAG,SAAS,CAItF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Concealed state trait — dynamic trait applied to actors when hiding (ADR-148)
|
|
4
|
+
*
|
|
5
|
+
* Added by the hiding action, removed by the revealing action or implicit reveal.
|
|
6
|
+
* Presence of this trait IS the concealed state — no boolean flag needed.
|
|
7
|
+
*
|
|
8
|
+
* Registers the if.scope.visible capability to block VisibilityBehavior.canSee().
|
|
9
|
+
* When an NPC calls canSee() on a concealed actor, the capability behavior
|
|
10
|
+
* returns { valid: false }, making the actor invisible.
|
|
11
|
+
*
|
|
12
|
+
* Public interface: ConcealedStateTrait, IConcealedStateTrait, isConcealed, getConcealmentState.
|
|
13
|
+
* Owner context: @sharpee/world-model / traits
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ConcealedStateTrait = void 0;
|
|
17
|
+
exports.isConcealed = isConcealed;
|
|
18
|
+
exports.getConcealmentState = getConcealmentState;
|
|
19
|
+
const VisibilityBehavior_1 = require("../../world/VisibilityBehavior");
|
|
20
|
+
/**
|
|
21
|
+
* Dynamic trait applied to an actor to mark them as concealed.
|
|
22
|
+
*
|
|
23
|
+
* The trait registers the `if.scope.visible` capability so that
|
|
24
|
+
* VisibilityBehavior.canSee() automatically returns false for
|
|
25
|
+
* concealed actors.
|
|
26
|
+
*/
|
|
27
|
+
class ConcealedStateTrait {
|
|
28
|
+
static type = 'if.trait.concealed_state';
|
|
29
|
+
type = 'if.trait.concealed_state';
|
|
30
|
+
/** Registers the visibility capability — concealed actors block canSee() */
|
|
31
|
+
static capabilities = [VisibilityBehavior_1.VISIBILITY_CAPABILITY];
|
|
32
|
+
targetId;
|
|
33
|
+
position;
|
|
34
|
+
quality;
|
|
35
|
+
constructor(data) {
|
|
36
|
+
this.targetId = data.targetId;
|
|
37
|
+
this.position = data.position;
|
|
38
|
+
this.quality = data.quality;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ConcealedStateTrait = ConcealedStateTrait;
|
|
42
|
+
/**
|
|
43
|
+
* Check if an entity is concealed.
|
|
44
|
+
*
|
|
45
|
+
* @param entity - The entity to check
|
|
46
|
+
* @returns True if the entity has ConcealedStateTrait
|
|
47
|
+
*/
|
|
48
|
+
function isConcealed(entity) {
|
|
49
|
+
return entity.has(ConcealedStateTrait.type);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the concealment details for an entity, or undefined if not concealed.
|
|
53
|
+
*
|
|
54
|
+
* @param entity - The entity to check
|
|
55
|
+
* @returns The concealment state, or undefined
|
|
56
|
+
*/
|
|
57
|
+
function getConcealmentState(entity) {
|
|
58
|
+
const trait = entity.get(ConcealedStateTrait.type);
|
|
59
|
+
if (!trait)
|
|
60
|
+
return undefined;
|
|
61
|
+
return trait;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=concealedStateTrait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concealedStateTrait.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/concealment/concealedStateTrait.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAoDH,kCAEC;AAQD,kDAIC;AA9DD,uEAAuE;AAiBvE;;;;;;GAMG;AACH,MAAa,mBAAmB;IAC9B,MAAM,CAAU,IAAI,GAAG,0BAA0B,CAAC;IACzC,IAAI,GAAG,0BAA0B,CAAC;IAE3C,4EAA4E;IAC5E,MAAM,CAAU,YAAY,GAAG,CAAC,0CAAqB,CAAU,CAAC;IAEhE,QAAQ,CAAS;IACjB,QAAQ,CAAsB;IAC9B,OAAO,CAAqB;IAE5B,YAAY,IAA0B;QACpC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;;AAfH,kDAgBC;AAED;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,MAAgB;IAC1C,OAAO,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,MAAgB;IAClD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,OAAO,KAAwC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visibility behavior for concealed actors (ADR-148)
|
|
3
|
+
*
|
|
4
|
+
* Default behavior: a concealed actor is invisible to all observers.
|
|
5
|
+
* Stories can override this for specific NPC types via capability dispatch
|
|
6
|
+
* (e.g., alert guards can see through poor/fair concealment).
|
|
7
|
+
*
|
|
8
|
+
* Public interface: ConcealedVisibilityBehavior, registerConcealedVisibilityBehavior.
|
|
9
|
+
* Owner context: @sharpee/world-model / traits / concealment
|
|
10
|
+
*/
|
|
11
|
+
import { CapabilityBehavior } from '../../capabilities/capability-behavior';
|
|
12
|
+
/**
|
|
13
|
+
* Default visibility behavior for concealed actors.
|
|
14
|
+
*
|
|
15
|
+
* Blocks canSee() for all observers. The observerId is available in the
|
|
16
|
+
* validate call for story-level overrides that need to check who is looking.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ConcealedVisibilityBehavior: CapabilityBehavior;
|
|
19
|
+
/**
|
|
20
|
+
* Register the default visibility behavior for concealed actors.
|
|
21
|
+
*
|
|
22
|
+
* Call this during platform initialization. Stories that need NPC detection
|
|
23
|
+
* can register their own behavior for specific trait types using the same
|
|
24
|
+
* capability dispatch override pattern.
|
|
25
|
+
*/
|
|
26
|
+
export declare function registerConcealedVisibilityBehavior(): void;
|
|
27
|
+
//# sourceMappingURL=concealedVisibilityBehavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concealedVisibilityBehavior.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/concealment/concealedVisibilityBehavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAK5E;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,kBAUzC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,mCAAmC,IAAI,IAAI,CAM1D"}
|