@sharpee/helpers 1.0.0 → 1.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/README.md +71 -0
- package/augment.d.ts.map +1 -1
- package/augment.js +1 -1
- package/builders/actor.d.ts +2 -2
- package/builders/actor.d.ts.map +1 -1
- package/builders/actor.js +1 -1
- package/builders/container.d.ts +2 -2
- package/builders/container.d.ts.map +1 -1
- package/builders/container.js +1 -1
- package/builders/door.d.ts +3 -3
- package/builders/door.d.ts.map +1 -1
- package/builders/door.js +2 -2
- package/builders/object.d.ts +13 -3
- package/builders/object.d.ts.map +1 -1
- package/builders/object.js +16 -2
- package/builders/object.js.map +1 -1
- package/builders/room.d.ts +2 -2
- package/builders/room.d.ts.map +1 -1
- package/builders/room.js +1 -1
- package/create-helpers.d.ts +1 -1
- package/create-helpers.d.ts.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @sharpee/helpers
|
|
2
|
+
|
|
3
|
+
Fluent entity builder helpers for the Sharpee Interactive Fiction platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sharpee/helpers
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Concise, chainable builders that take the boilerplate out of constructing entities and their traits:
|
|
14
|
+
|
|
15
|
+
- **`world.helpers()`** - Importing the package augments `WorldModel`, exposing `room`, `object`, `container`, `actor`, and `door` builders.
|
|
16
|
+
- **Fluent traits** - Set descriptions, aliases, locations, and common traits without hand-assembling `IdentityTrait`, `SceneryTrait`, etc.
|
|
17
|
+
- **`.plural()`** - Marks an object as grammatically plural so messages agree in number ("the goats **are** fixed in place").
|
|
18
|
+
- **Direct use** - `createHelpers()` and the `EntityHelpers` / builder classes are exported for use outside the augmentation.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import '@sharpee/helpers'; // side-effect import: activates world.helpers()
|
|
24
|
+
import { WorldModel } from '@sharpee/world-model';
|
|
25
|
+
|
|
26
|
+
function initializeWorld(world: WorldModel): void {
|
|
27
|
+
const { room, object, container, actor } = world.helpers();
|
|
28
|
+
|
|
29
|
+
const kitchen = room('Kitchen')
|
|
30
|
+
.description('A warm kitchen.')
|
|
31
|
+
.build();
|
|
32
|
+
|
|
33
|
+
const knife = object('bread knife')
|
|
34
|
+
.description('A sharp bread knife.')
|
|
35
|
+
.aliases('knife', 'blade')
|
|
36
|
+
.in(kitchen)
|
|
37
|
+
.build();
|
|
38
|
+
|
|
39
|
+
// grammatically plural scenery
|
|
40
|
+
object('pygmy goats')
|
|
41
|
+
.description('Three goats chew contentedly.')
|
|
42
|
+
.plural()
|
|
43
|
+
.scenery()
|
|
44
|
+
.in(kitchen)
|
|
45
|
+
.build();
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Object builder methods
|
|
50
|
+
|
|
51
|
+
| Method | Effect |
|
|
52
|
+
|--------|--------|
|
|
53
|
+
| `description(text)` | Sets the object description |
|
|
54
|
+
| `aliases(...names)` | Adds alternative parser names |
|
|
55
|
+
| `in(entity)` | Places the object in a location |
|
|
56
|
+
| `scenery()` | Marks as scenery (non-portable) |
|
|
57
|
+
| `plural()` | Marks as grammatically plural |
|
|
58
|
+
| `lightSource(opts?)` | Adds a `LightSourceTrait` |
|
|
59
|
+
| `addTrait(trait)` | Adds any custom `ITrait` |
|
|
60
|
+
| `skipValidation()` | Bypasses placement validation (uses `AuthorModel`) |
|
|
61
|
+
| `build()` | Creates and returns the `IFEntity` |
|
|
62
|
+
|
|
63
|
+
## Related Packages
|
|
64
|
+
|
|
65
|
+
- [@sharpee/world-model](https://www.npmjs.com/package/@sharpee/world-model) - Entity, trait, and behavior system
|
|
66
|
+
- [@sharpee/queries](https://www.npmjs.com/package/@sharpee/queries) - LINQ-style entity queries
|
|
67
|
+
- [@sharpee/sharpee](https://www.npmjs.com/package/@sharpee/sharpee) - Full platform bundle
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|
package/augment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augment.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"augment.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/helpers/src/augment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAiB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKhE,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,UAAU;QAClB,+DAA+D;QAC/D,OAAO,IAAI,aAAa,CAAC;KAC1B;CACF"}
|
package/augment.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
const world_model_1 = require("
|
|
13
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
14
14
|
const create_helpers_1 = require("./create-helpers");
|
|
15
15
|
// as any: justified — prototype augmentation via declaration merging (type safety
|
|
16
16
|
// is provided by the declare module block above; TypeScript does not allow direct
|
package/builders/actor.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
8
8
|
*/
|
|
9
|
-
import { IFEntity } from
|
|
10
|
-
import type { IWorldModel, ITrait } from
|
|
9
|
+
import { IFEntity } from '@sharpee/world-model';
|
|
10
|
+
import type { IWorldModel, ITrait } from '@sharpee/world-model';
|
|
11
11
|
/**
|
|
12
12
|
* Fluent builder for creating actor entities (players and NPCs).
|
|
13
13
|
*
|
package/builders/actor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/helpers/src/builders/actor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,QAAQ,EAKT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAY;IAUrB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,IAAI;IAVd,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAC,CAAwB;IAC3C,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,OAAO,CAAgB;gBAGrB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM;IAGtB;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/B;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAKjC;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAKlB;;;;;OAKG;IACH,SAAS,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,IAAI;IAKjD;;;;;OAKG;IACH,EAAE,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAK5B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B;;;;OAIG;IACH,cAAc,IAAI,IAAI;IAKtB;;;;OAIG;IACH,KAAK,IAAI,QAAQ;CA8BlB"}
|
package/builders/actor.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.ActorBuilder = void 0;
|
|
12
|
-
const world_model_1 = require("
|
|
12
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
13
13
|
/**
|
|
14
14
|
* Fluent builder for creating actor entities (players and NPCs).
|
|
15
15
|
*
|
package/builders/container.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
8
8
|
*/
|
|
9
|
-
import { IFEntity } from
|
|
10
|
-
import type { IWorldModel, ITrait } from
|
|
9
|
+
import { IFEntity } from '@sharpee/world-model';
|
|
10
|
+
import type { IWorldModel, ITrait } from '@sharpee/world-model';
|
|
11
11
|
/**
|
|
12
12
|
* Fluent builder for creating container entities.
|
|
13
13
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/helpers/src/builders/container.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,QAAQ,EAMT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAgB;IAUzB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,IAAI;IAVd,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAuB;IACzC,OAAO,CAAC,SAAS,CAAC,CAAyC;IAC3D,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,OAAO,CAAgB;gBAGrB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM;IAGtB;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/B;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAKjC;;;;;OAKG;IACH,EAAE,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAK5B;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IAK/C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,IAAI;IAKjE;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B;;;;OAIG;IACH,cAAc,IAAI,IAAI;IAKtB;;;;OAIG;IACH,KAAK,IAAI,QAAQ;CAiClB"}
|
package/builders/container.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.ContainerBuilder = void 0;
|
|
12
|
-
const world_model_1 = require("
|
|
12
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
13
13
|
/**
|
|
14
14
|
* Fluent builder for creating container entities.
|
|
15
15
|
*
|
package/builders/door.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
7
7
|
*/
|
|
8
|
-
import { IFEntity } from
|
|
9
|
-
import type { IWorldModel, ITrait } from
|
|
10
|
-
import type { DirectionType } from
|
|
8
|
+
import { IFEntity } from '@sharpee/world-model';
|
|
9
|
+
import type { IWorldModel, ITrait } from '@sharpee/world-model';
|
|
10
|
+
import type { DirectionType } from '@sharpee/world-model';
|
|
11
11
|
/**
|
|
12
12
|
* Fluent builder for creating door entities.
|
|
13
13
|
*
|
package/builders/door.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"door.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"door.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/helpers/src/builders/door.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAOT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,qBAAa,WAAW;IAWpB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,IAAI;IAXd,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,MAAM,CAAC,CAAW;IAC1B,OAAO,CAAC,MAAM,CAAC,CAAW;IAC1B,OAAO,CAAC,UAAU,CAAC,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAC,CAAuB;IACzC,OAAO,CAAC,SAAS,CAAC,CAAyC;IAC3D,OAAO,CAAC,OAAO,CAAgB;gBAGrB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM;IAGtB;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/B;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAKjC;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI;IAOzE;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IAK/C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,IAAI;IAKjE;;;;;OAKG;IACH,KAAK,IAAI,QAAQ;CAuClB"}
|
package/builders/door.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.DoorBuilder = void 0;
|
|
11
|
-
const world_model_1 = require("
|
|
12
|
-
const world_model_2 = require("
|
|
11
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
12
|
+
const world_model_2 = require("@sharpee/world-model");
|
|
13
13
|
/**
|
|
14
14
|
* Fluent builder for creating door entities.
|
|
15
15
|
*
|
package/builders/object.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ObjectBuilder — fluent builder for object entities.
|
|
3
3
|
*
|
|
4
|
-
* Public interface: description, aliases, in, scenery, lightSource,
|
|
4
|
+
* Public interface: description, aliases, in, scenery, plural, lightSource,
|
|
5
5
|
* skipValidation, build.
|
|
6
6
|
*
|
|
7
7
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
8
8
|
*/
|
|
9
|
-
import { IFEntity } from
|
|
10
|
-
import type { IWorldModel, ITrait } from
|
|
9
|
+
import { IFEntity } from '@sharpee/world-model';
|
|
10
|
+
import type { IWorldModel, ITrait } from '@sharpee/world-model';
|
|
11
11
|
/**
|
|
12
12
|
* Fluent builder for creating object entities.
|
|
13
13
|
*
|
|
@@ -27,6 +27,7 @@ export declare class ObjectBuilder {
|
|
|
27
27
|
private _aliases?;
|
|
28
28
|
private _location?;
|
|
29
29
|
private _scenery;
|
|
30
|
+
private _grammaticalNumber?;
|
|
30
31
|
private _lightSource?;
|
|
31
32
|
private _skipValidation;
|
|
32
33
|
private _traits;
|
|
@@ -58,6 +59,15 @@ export declare class ObjectBuilder {
|
|
|
58
59
|
* @returns this (for chaining)
|
|
59
60
|
*/
|
|
60
61
|
scenery(): this;
|
|
62
|
+
/**
|
|
63
|
+
* Mark the object as grammatically plural (e.g. "pygmy goats", "direction
|
|
64
|
+
* signs"). Sets the identity's `grammaticalNumber` to `'plural'` so message
|
|
65
|
+
* templates render agreeing verbs ("the goats are fixed in place") and
|
|
66
|
+
* pronouns ("take them").
|
|
67
|
+
*
|
|
68
|
+
* @returns this (for chaining)
|
|
69
|
+
*/
|
|
70
|
+
plural(): this;
|
|
61
71
|
/**
|
|
62
72
|
* Add light source trait.
|
|
63
73
|
*
|
package/builders/object.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/helpers/src/builders/object.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,QAAQ,EAKT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;IAWtB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,IAAI;IAXd,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,kBAAkB,CAAC,CAAwB;IACnD,OAAO,CAAC,YAAY,CAAC,CAA0C;IAC/D,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,OAAO,CAAgB;gBAGrB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM;IAGtB;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/B;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAKjC;;;;;OAKG;IACH,EAAE,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAK5B;;;;OAIG;IACH,OAAO,IAAI,IAAI;IAKf;;;;;;;OAOG;IACH,MAAM,IAAI,IAAI;IAKd;;;;;OAKG;IACH,WAAW,CAAC,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,IAAI;IAKrE;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B;;;;;OAKG;IACH,cAAc,IAAI,IAAI;IAKtB;;;;OAIG;IACH,KAAK,IAAI,QAAQ;CA8BlB"}
|
package/builders/object.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* ObjectBuilder — fluent builder for object entities.
|
|
4
4
|
*
|
|
5
|
-
* Public interface: description, aliases, in, scenery, lightSource,
|
|
5
|
+
* Public interface: description, aliases, in, scenery, plural, lightSource,
|
|
6
6
|
* skipValidation, build.
|
|
7
7
|
*
|
|
8
8
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.ObjectBuilder = void 0;
|
|
12
|
-
const world_model_1 = require("
|
|
12
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
13
13
|
/**
|
|
14
14
|
* Fluent builder for creating object entities.
|
|
15
15
|
*
|
|
@@ -29,6 +29,7 @@ class ObjectBuilder {
|
|
|
29
29
|
_aliases;
|
|
30
30
|
_location;
|
|
31
31
|
_scenery = false;
|
|
32
|
+
_grammaticalNumber;
|
|
32
33
|
_lightSource;
|
|
33
34
|
_skipValidation = false;
|
|
34
35
|
_traits = [];
|
|
@@ -75,6 +76,18 @@ class ObjectBuilder {
|
|
|
75
76
|
this._scenery = true;
|
|
76
77
|
return this;
|
|
77
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Mark the object as grammatically plural (e.g. "pygmy goats", "direction
|
|
81
|
+
* signs"). Sets the identity's `grammaticalNumber` to `'plural'` so message
|
|
82
|
+
* templates render agreeing verbs ("the goats are fixed in place") and
|
|
83
|
+
* pronouns ("take them").
|
|
84
|
+
*
|
|
85
|
+
* @returns this (for chaining)
|
|
86
|
+
*/
|
|
87
|
+
plural() {
|
|
88
|
+
this._grammaticalNumber = 'plural';
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
78
91
|
/**
|
|
79
92
|
* Add light source trait.
|
|
80
93
|
*
|
|
@@ -116,6 +129,7 @@ class ObjectBuilder {
|
|
|
116
129
|
name: this.name,
|
|
117
130
|
description: this._description,
|
|
118
131
|
aliases: this._aliases,
|
|
132
|
+
grammaticalNumber: this._grammaticalNumber,
|
|
119
133
|
}));
|
|
120
134
|
if (this._scenery) {
|
|
121
135
|
entity.add(new world_model_1.SceneryTrait());
|
package/builders/object.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/helpers/src/builders/object.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,sDAM8B;AAG9B;;;;;;;;;;;GAWG;AACH,MAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/helpers/src/builders/object.ts"],"names":[],"mappings":"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"}
|
package/builders/room.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
7
7
|
*/
|
|
8
|
-
import { IFEntity } from
|
|
9
|
-
import type { IWorldModel, ITrait } from
|
|
8
|
+
import { IFEntity } from '@sharpee/world-model';
|
|
9
|
+
import type { IWorldModel, ITrait } from '@sharpee/world-model';
|
|
10
10
|
/**
|
|
11
11
|
* Fluent builder for creating room entities.
|
|
12
12
|
*
|
package/builders/room.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"room.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/helpers/src/builders/room.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAGT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;;;;;;GASG;AACH,qBAAa,WAAW;IAOpB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,IAAI;IAPd,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAgB;gBAGrB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM;IAGtB;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/B;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAKjC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAKZ;;;;OAIG;IACH,KAAK,IAAI,QAAQ;CAalB"}
|
package/builders/room.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.RoomBuilder = void 0;
|
|
11
|
-
const world_model_1 = require("
|
|
11
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
12
12
|
/**
|
|
13
13
|
* Fluent builder for creating room entities.
|
|
14
14
|
*
|
package/create-helpers.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
8
8
|
*/
|
|
9
|
-
import type { IWorldModel } from
|
|
9
|
+
import type { IWorldModel } from '@sharpee/world-model';
|
|
10
10
|
import { RoomBuilder } from './builders/room';
|
|
11
11
|
import { ObjectBuilder } from './builders/object';
|
|
12
12
|
import { ContainerBuilder } from './builders/container';
|
package/create-helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-helpers.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"create-helpers.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/helpers/src/create-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAChC,8BAA8B;IAC9B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IACpC,gCAAgC;IAChC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC1C,6CAA6C;IAC7C,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;IAClC,2BAA2B;IAC3B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CAQ/D"}
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/helpers/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,WAAW,CAAC;AAGnB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/helpers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Fluent entity builder helpers for Sharpee Interactive Fiction Platform",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/world-model": "^1.
|
|
15
|
+
"@sharpee/world-model": "^1.1.0"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"interactive-fiction",
|