@sharpee/event-processor 0.9.60-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/effects/effect-processor.d.ts +50 -0
- package/dist/effects/effect-processor.d.ts.map +1 -0
- package/dist/effects/effect-processor.js +255 -0
- package/dist/effects/effect-processor.js.map +1 -0
- package/dist/effects/index.d.ts +10 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/index.js +29 -0
- package/dist/effects/index.js.map +1 -0
- package/dist/effects/types.d.ts +119 -0
- package/dist/effects/types.d.ts.map +1 -0
- package/dist/effects/types.js +9 -0
- package/dist/effects/types.js.map +1 -0
- package/dist/effects/world-query.d.ts +70 -0
- package/dist/effects/world-query.d.ts.map +1 -0
- package/dist/effects/world-query.js +34 -0
- package/dist/effects/world-query.js.map +1 -0
- package/dist/handler-types.d.ts +67 -0
- package/dist/handler-types.d.ts.map +1 -0
- package/dist/handler-types.js +8 -0
- package/dist/handler-types.js.map +1 -0
- package/dist/handlers/complex-manipulation.d.ts +31 -0
- package/dist/handlers/complex-manipulation.d.ts.map +1 -0
- package/dist/handlers/complex-manipulation.js +87 -0
- package/dist/handlers/complex-manipulation.js.map +1 -0
- package/dist/handlers/device/index.d.ts +28 -0
- package/dist/handlers/device/index.d.ts.map +1 -0
- package/dist/handlers/device/index.js +172 -0
- package/dist/handlers/device/index.js.map +1 -0
- package/dist/handlers/index.d.ts +17 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +48 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/meta.d.ts +59 -0
- package/dist/handlers/meta.d.ts.map +1 -0
- package/dist/handlers/meta.js +129 -0
- package/dist/handlers/meta.js.map +1 -0
- package/dist/handlers/movement.d.ts +51 -0
- package/dist/handlers/movement.d.ts.map +1 -0
- package/dist/handlers/movement.js +176 -0
- package/dist/handlers/movement.js.map +1 -0
- package/dist/handlers/observation/index.d.ts +6 -0
- package/dist/handlers/observation/index.d.ts.map +1 -0
- package/dist/handlers/observation/index.js +22 -0
- package/dist/handlers/observation/index.js.map +1 -0
- package/dist/handlers/observation/observation-handlers.d.ts +96 -0
- package/dist/handlers/observation/observation-handlers.d.ts.map +1 -0
- package/dist/handlers/observation/observation-handlers.js +162 -0
- package/dist/handlers/observation/observation-handlers.js.map +1 -0
- package/dist/handlers/observation/sensory.d.ts +29 -0
- package/dist/handlers/observation/sensory.d.ts.map +1 -0
- package/dist/handlers/observation/sensory.js +77 -0
- package/dist/handlers/observation/sensory.js.map +1 -0
- package/dist/handlers/state-change.d.ts +47 -0
- package/dist/handlers/state-change.d.ts.map +1 -0
- package/dist/handlers/state-change.js +166 -0
- package/dist/handlers/state-change.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/processor.d.ts +62 -0
- package/dist/processor.d.ts.map +1 -0
- package/dist/processor.js +332 -0
- package/dist/processor.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation-handlers.js","sourceRoot":"","sources":["../../../src/handlers/observation/observation-handlers.ts"],"names":[],"mappings":";;AAYA,oEAqBC;AAaD,gEAQC;AAYD,0DAWC;AAsBD,gDAyBC;AAcD,oDASC;AAaD,8DASC;AAYD,wDASC;AAKD,kEAWC;AA9MD;;;;;;;;;;;GAWG;AACH,SAAgB,4BAA4B,CAAC,KAAqB,EAAE,KAAU;IAC5E,MAAM,IAAI,GAAG,KAAK,CAAC,IAIlB,CAAC;IAEF,4BAA4B;IAC5B,kDAAkD;IAElD,0BAA0B;IAC1B,kDAAkD;IAClD,sDAAsD;IACtD,GAAG;IACH,gDAAgD;IAChD,uDAAuD;IACvD,sBA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,SAAgB,2BAA2B,CAAC,KAAiB;IAC3D,mBAAmB;IACnB,KAAK,CAAC,oBAAoB,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;IAChE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;IACpE,KAAK,CAAC,oBAAoB,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CAAC;IAC/E,KAAK,CAAC,oBAAoB,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;IAEzE,qBAAqB;IACrB,KAAK,CAAC,oBAAoB,CAAC,0BAA0B,EAAE,4BAA4B,CAAC,CAAC;IACrF,KAAK,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,0BAA0B,CAAC,CAAC;IACjF,KAAK,CAAC,oBAAoB,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation event handlers
|
|
3
|
+
*
|
|
4
|
+
* These handlers process sensory observation events (search, listen, smell, touch)
|
|
5
|
+
*/
|
|
6
|
+
import { WorldModel, EventHandler } from '@sharpee/world-model';
|
|
7
|
+
/**
|
|
8
|
+
* Handle SEARCHED event - reveal concealed items
|
|
9
|
+
*/
|
|
10
|
+
export declare const handleSearched: EventHandler;
|
|
11
|
+
/**
|
|
12
|
+
* Handle LISTENED event - no world model changes needed
|
|
13
|
+
* This is primarily for message generation
|
|
14
|
+
*/
|
|
15
|
+
export declare const handleListened: EventHandler;
|
|
16
|
+
/**
|
|
17
|
+
* Handle SMELLED event - no world model changes needed
|
|
18
|
+
* This is primarily for message generation
|
|
19
|
+
*/
|
|
20
|
+
export declare const handleSmelled: EventHandler;
|
|
21
|
+
/**
|
|
22
|
+
* Handle TOUCHED event - could trigger state changes
|
|
23
|
+
*/
|
|
24
|
+
export declare const handleTouched: EventHandler;
|
|
25
|
+
/**
|
|
26
|
+
* Register all sensory observation handlers
|
|
27
|
+
*/
|
|
28
|
+
export declare function registerSensoryHandlers(world: WorldModel): void;
|
|
29
|
+
//# sourceMappingURL=sensory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensory.d.ts","sourceRoot":"","sources":["../../../src/handlers/observation/sensory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAsC,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpG;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAgB5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAI5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,YAI3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YAY3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAK/D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Observation event handlers
|
|
4
|
+
*
|
|
5
|
+
* These handlers process sensory observation events (search, listen, smell, touch)
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.handleTouched = exports.handleSmelled = exports.handleListened = exports.handleSearched = void 0;
|
|
9
|
+
exports.registerSensoryHandlers = registerSensoryHandlers;
|
|
10
|
+
const core_1 = require("@sharpee/core");
|
|
11
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
12
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
13
|
+
/**
|
|
14
|
+
* Handle SEARCHED event - reveal concealed items
|
|
15
|
+
*/
|
|
16
|
+
const handleSearched = (event, world) => {
|
|
17
|
+
const { target } = event.entities;
|
|
18
|
+
const data = (0, core_1.getUntypedEventData)(event);
|
|
19
|
+
const foundItems = Array.isArray(data?.foundItems) ? data.foundItems : [];
|
|
20
|
+
if (target && foundItems && foundItems.length > 0) {
|
|
21
|
+
// Reveal concealed items
|
|
22
|
+
foundItems.forEach(itemId => {
|
|
23
|
+
world.updateEntity(itemId, (entity) => {
|
|
24
|
+
if (entity.has(world_model_1.TraitType.IDENTITY)) {
|
|
25
|
+
const identity = entity.get(world_model_1.TraitType.IDENTITY);
|
|
26
|
+
identity.concealed = false;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.handleSearched = handleSearched;
|
|
33
|
+
/**
|
|
34
|
+
* Handle LISTENED event - no world model changes needed
|
|
35
|
+
* This is primarily for message generation
|
|
36
|
+
*/
|
|
37
|
+
const handleListened = (event, world) => {
|
|
38
|
+
// No world model changes needed for listening
|
|
39
|
+
// The event data contains information about what was heard
|
|
40
|
+
// which will be used by the message system
|
|
41
|
+
};
|
|
42
|
+
exports.handleListened = handleListened;
|
|
43
|
+
/**
|
|
44
|
+
* Handle SMELLED event - no world model changes needed
|
|
45
|
+
* This is primarily for message generation
|
|
46
|
+
*/
|
|
47
|
+
const handleSmelled = (event, world) => {
|
|
48
|
+
// No world model changes needed for smelling
|
|
49
|
+
// The event data contains information about scents detected
|
|
50
|
+
// which will be used by the message system
|
|
51
|
+
};
|
|
52
|
+
exports.handleSmelled = handleSmelled;
|
|
53
|
+
/**
|
|
54
|
+
* Handle TOUCHED event - could trigger state changes
|
|
55
|
+
*/
|
|
56
|
+
const handleTouched = (event, world) => {
|
|
57
|
+
const { target } = event.entities;
|
|
58
|
+
// In some games, touching might trigger state changes
|
|
59
|
+
// For example, touching a switch might toggle it
|
|
60
|
+
// For now, we'll just record that the object was touched
|
|
61
|
+
// Future implementations could add a "touched" flag or trigger other events
|
|
62
|
+
if (target) {
|
|
63
|
+
// Could update a "lastTouched" timestamp or similar
|
|
64
|
+
// For now, no changes needed
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.handleTouched = handleTouched;
|
|
68
|
+
/**
|
|
69
|
+
* Register all sensory observation handlers
|
|
70
|
+
*/
|
|
71
|
+
function registerSensoryHandlers(world) {
|
|
72
|
+
world.registerEventHandler(if_domain_1.IFEvents.SEARCHED, exports.handleSearched);
|
|
73
|
+
world.registerEventHandler(if_domain_1.IFEvents.LISTENED, exports.handleListened);
|
|
74
|
+
world.registerEventHandler(if_domain_1.IFEvents.SMELLED, exports.handleSmelled);
|
|
75
|
+
world.registerEventHandler(if_domain_1.IFEvents.TOUCHED, exports.handleTouched);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=sensory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensory.js","sourceRoot":"","sources":["../../../src/handlers/observation/sensory.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAmEH,0DAKC;AAtED,wCAAoE;AACpE,sDAAoG;AACpG,kDAA8C;AAE9C;;GAEG;AACI,MAAM,cAAc,GAAiB,CAAC,KAAqB,EAAE,KAAU,EAAE,EAAE;IAChF,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;IAClC,MAAM,IAAI,GAAG,IAAA,0BAAmB,EAAC,KAAK,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAsB,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtF,IAAI,MAAM,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClD,yBAAyB;QACzB,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC1B,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,MAAgB,EAAE,EAAE;gBAC9C,IAAI,MAAM,CAAC,GAAG,CAAC,uBAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAS,CAAC,QAAQ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
|
1
|
+
/**
|
|
2
|
+
* State change event handlers
|
|
3
|
+
*
|
|
4
|
+
* These handlers apply state-changing events to the world model
|
|
5
|
+
*/
|
|
6
|
+
import { WorldModel, EventHandler } from '@sharpee/world-model';
|
|
7
|
+
/**
|
|
8
|
+
* Handle OPENED event - set openable trait to open
|
|
9
|
+
*/
|
|
10
|
+
export declare const handleOpened: EventHandler;
|
|
11
|
+
/**
|
|
12
|
+
* Handle CLOSED event - set openable trait to closed
|
|
13
|
+
*/
|
|
14
|
+
export declare const handleClosed: EventHandler;
|
|
15
|
+
/**
|
|
16
|
+
* Handle LOCKED event - set lockable trait to locked
|
|
17
|
+
*/
|
|
18
|
+
export declare const handleLocked: EventHandler;
|
|
19
|
+
/**
|
|
20
|
+
* Handle UNLOCKED event - set lockable trait to unlocked
|
|
21
|
+
*/
|
|
22
|
+
export declare const handleUnlocked: EventHandler;
|
|
23
|
+
/**
|
|
24
|
+
* Handle SWITCHED_ON event - set switchable trait to on
|
|
25
|
+
*/
|
|
26
|
+
export declare const handleSwitchedOn: EventHandler;
|
|
27
|
+
/**
|
|
28
|
+
* Handle SWITCHED_OFF event - set switchable trait to off
|
|
29
|
+
*/
|
|
30
|
+
export declare const handleSwitchedOff: EventHandler;
|
|
31
|
+
/**
|
|
32
|
+
* Handle WORN event - set wearable trait to worn
|
|
33
|
+
*/
|
|
34
|
+
export declare const handleWorn: EventHandler;
|
|
35
|
+
/**
|
|
36
|
+
* Handle EATEN event - remove the eaten item
|
|
37
|
+
*/
|
|
38
|
+
export declare const handleEaten: EventHandler;
|
|
39
|
+
/**
|
|
40
|
+
* Handle DRUNK event - remove the drunk item
|
|
41
|
+
*/
|
|
42
|
+
export declare const handleDrunk: EventHandler;
|
|
43
|
+
/**
|
|
44
|
+
* Register all state change handlers
|
|
45
|
+
*/
|
|
46
|
+
export declare function registerStateChangeHandlers(world: WorldModel): void;
|
|
47
|
+
//# sourceMappingURL=state-change.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-change.d.ts","sourceRoot":"","sources":["../../src/handlers/state-change.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAkH,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGhL;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,YAa1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,YAY1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,YAY1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAY5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAgB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAgB/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,YAUxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,YAKzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,YAKzB,CAAC;AAEF;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAUnE"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* State change event handlers
|
|
4
|
+
*
|
|
5
|
+
* These handlers apply state-changing events to the world model
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.handleDrunk = exports.handleEaten = exports.handleWorn = exports.handleSwitchedOff = exports.handleSwitchedOn = exports.handleUnlocked = exports.handleLocked = exports.handleClosed = exports.handleOpened = void 0;
|
|
9
|
+
exports.registerStateChangeHandlers = registerStateChangeHandlers;
|
|
10
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
11
|
+
const if_domain_1 = require("@sharpee/if-domain");
|
|
12
|
+
/**
|
|
13
|
+
* Handle OPENED event - set openable trait to open
|
|
14
|
+
*/
|
|
15
|
+
const handleOpened = (event, world) => {
|
|
16
|
+
const { target } = event.entities;
|
|
17
|
+
if (target) {
|
|
18
|
+
world.updateEntity(target, (entity) => {
|
|
19
|
+
const openableTrait = entity.get(world_model_1.TraitType.OPENABLE);
|
|
20
|
+
if (openableTrait) {
|
|
21
|
+
openableTrait.isOpen = true;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
// TODO: Handle connected doors - DoorTrait doesn't have connectedDoor property
|
|
25
|
+
// Need to determine the door connection logic
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.handleOpened = handleOpened;
|
|
29
|
+
/**
|
|
30
|
+
* Handle CLOSED event - set openable trait to closed
|
|
31
|
+
*/
|
|
32
|
+
const handleClosed = (event, world) => {
|
|
33
|
+
const { target } = event.entities;
|
|
34
|
+
if (target) {
|
|
35
|
+
world.updateEntity(target, (entity) => {
|
|
36
|
+
const openableTrait = entity.get(world_model_1.TraitType.OPENABLE);
|
|
37
|
+
if (openableTrait) {
|
|
38
|
+
openableTrait.isOpen = false;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
// TODO: Handle connected doors
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.handleClosed = handleClosed;
|
|
45
|
+
/**
|
|
46
|
+
* Handle LOCKED event - set lockable trait to locked
|
|
47
|
+
*/
|
|
48
|
+
const handleLocked = (event, world) => {
|
|
49
|
+
const { target } = event.entities;
|
|
50
|
+
if (target) {
|
|
51
|
+
world.updateEntity(target, (entity) => {
|
|
52
|
+
const lockableTrait = entity.get(world_model_1.TraitType.LOCKABLE);
|
|
53
|
+
if (lockableTrait) {
|
|
54
|
+
lockableTrait.isLocked = true;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
// TODO: Handle connected doors
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.handleLocked = handleLocked;
|
|
61
|
+
/**
|
|
62
|
+
* Handle UNLOCKED event - set lockable trait to unlocked
|
|
63
|
+
*/
|
|
64
|
+
const handleUnlocked = (event, world) => {
|
|
65
|
+
const { target } = event.entities;
|
|
66
|
+
if (target) {
|
|
67
|
+
world.updateEntity(target, (entity) => {
|
|
68
|
+
const lockableTrait = entity.get(world_model_1.TraitType.LOCKABLE);
|
|
69
|
+
if (lockableTrait) {
|
|
70
|
+
lockableTrait.isLocked = false;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// TODO: Handle connected doors
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.handleUnlocked = handleUnlocked;
|
|
77
|
+
/**
|
|
78
|
+
* Handle SWITCHED_ON event - set switchable trait to on
|
|
79
|
+
*/
|
|
80
|
+
const handleSwitchedOn = (event, world) => {
|
|
81
|
+
const { target } = event.entities;
|
|
82
|
+
if (target) {
|
|
83
|
+
world.updateEntity(target, (entity) => {
|
|
84
|
+
const switchableTrait = entity.get(world_model_1.TraitType.SWITCHABLE);
|
|
85
|
+
if (switchableTrait) {
|
|
86
|
+
switchableTrait.isOn = true;
|
|
87
|
+
}
|
|
88
|
+
// If it's a light source, set it to lit
|
|
89
|
+
const lightTrait = entity.get(world_model_1.TraitType.LIGHT_SOURCE);
|
|
90
|
+
if (lightTrait) {
|
|
91
|
+
lightTrait.isLit = true;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.handleSwitchedOn = handleSwitchedOn;
|
|
97
|
+
/**
|
|
98
|
+
* Handle SWITCHED_OFF event - set switchable trait to off
|
|
99
|
+
*/
|
|
100
|
+
const handleSwitchedOff = (event, world) => {
|
|
101
|
+
const { target } = event.entities;
|
|
102
|
+
if (target) {
|
|
103
|
+
world.updateEntity(target, (entity) => {
|
|
104
|
+
const switchableTrait = entity.get(world_model_1.TraitType.SWITCHABLE);
|
|
105
|
+
if (switchableTrait) {
|
|
106
|
+
switchableTrait.isOn = false;
|
|
107
|
+
}
|
|
108
|
+
// If it's a light source, set it to unlit
|
|
109
|
+
const lightTrait = entity.get(world_model_1.TraitType.LIGHT_SOURCE);
|
|
110
|
+
if (lightTrait) {
|
|
111
|
+
lightTrait.isLit = false;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
exports.handleSwitchedOff = handleSwitchedOff;
|
|
117
|
+
/**
|
|
118
|
+
* Handle WORN event - set wearable trait to worn
|
|
119
|
+
*/
|
|
120
|
+
const handleWorn = (event, world) => {
|
|
121
|
+
const { target } = event.entities;
|
|
122
|
+
if (target) {
|
|
123
|
+
world.updateEntity(target, (entity) => {
|
|
124
|
+
const wearableTrait = entity.get(world_model_1.TraitType.WEARABLE);
|
|
125
|
+
if (wearableTrait) {
|
|
126
|
+
wearableTrait.worn = true;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
exports.handleWorn = handleWorn;
|
|
132
|
+
/**
|
|
133
|
+
* Handle EATEN event - remove the eaten item
|
|
134
|
+
*/
|
|
135
|
+
const handleEaten = (event, world) => {
|
|
136
|
+
const { target } = event.entities;
|
|
137
|
+
if (target) {
|
|
138
|
+
world.removeEntity(target);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
exports.handleEaten = handleEaten;
|
|
142
|
+
/**
|
|
143
|
+
* Handle DRUNK event - remove the drunk item
|
|
144
|
+
*/
|
|
145
|
+
const handleDrunk = (event, world) => {
|
|
146
|
+
const { target } = event.entities;
|
|
147
|
+
if (target) {
|
|
148
|
+
world.removeEntity(target);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
exports.handleDrunk = handleDrunk;
|
|
152
|
+
/**
|
|
153
|
+
* Register all state change handlers
|
|
154
|
+
*/
|
|
155
|
+
function registerStateChangeHandlers(world) {
|
|
156
|
+
world.registerEventHandler(if_domain_1.IFEvents.OPENED, exports.handleOpened);
|
|
157
|
+
world.registerEventHandler(if_domain_1.IFEvents.CLOSED, exports.handleClosed);
|
|
158
|
+
world.registerEventHandler(if_domain_1.IFEvents.LOCKED, exports.handleLocked);
|
|
159
|
+
world.registerEventHandler(if_domain_1.IFEvents.UNLOCKED, exports.handleUnlocked);
|
|
160
|
+
world.registerEventHandler(if_domain_1.IFEvents.SWITCHED_ON, exports.handleSwitchedOn);
|
|
161
|
+
world.registerEventHandler(if_domain_1.IFEvents.SWITCHED_OFF, exports.handleSwitchedOff);
|
|
162
|
+
world.registerEventHandler(if_domain_1.IFEvents.WORN, exports.handleWorn);
|
|
163
|
+
world.registerEventHandler(if_domain_1.IFEvents.EATEN, exports.handleEaten);
|
|
164
|
+
world.registerEventHandler(if_domain_1.IFEvents.DRUNK, exports.handleDrunk);
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=state-change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-change.js","sourceRoot":"","sources":["../../src/handlers/state-change.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA2JH,kEAUC;AAlKD,sDAAgL;AAChL,kDAA8C;AAE9C;;GAEG;AACI,MAAM,YAAY,GAAiB,CAAC,KAAqB,EAAE,KAAU,EAAE,EAAE;IAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;IAClC,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,MAAgB,EAAE,EAAE;YAC9C,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAS,CAAC,QAAQ,CAAkB,CAAC;YACtE,IAAI,aAAa,EAAE,CAAC;gBAClB,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,+EAA+E;QAC/E,8CAA8C;IAChD,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,YAAY,gBAavB;AAEF;;GAEG;AACI,MAAM,YAAY,GAAiB,CAAC,KAAqB,EAAE,KAA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,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC,CAAC;AALW,QAAA,WAAW,eAKtB;AAEF;;GAEG;AACH,SAAgB,2BAA2B,CAAC,KAAiB;IAC3D,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,MAAM,EAAE,oBAAY,CAAC,CAAC;IAC1D,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,MAAM,EAAE,oBAAY,CAAC,CAAC;IAC1D,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,MAAM,EAAE,oBAAY,CAAC,CAAC;IAC1D,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,QAAQ,EAAE,sBAAc,CAAC,CAAC;IAC9D,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,WAAW,EAAE,wBAAgB,CAAC,CAAC;IACnE,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,YAAY,EAAE,yBAAiB,CAAC,CAAC;IACrE,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,IAAI,EAAE,kBAAU,CAAC,CAAC;IACtD,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,KAAK,EAAE,mBAAW,CAAC,CAAC;IACxD,KAAK,CAAC,oBAAoB,CAAC,oBAAQ,CAAC,KAAK,EAAE,mBAAW,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sharpee/event-processor - Event application system
|
|
3
|
+
*
|
|
4
|
+
* Applies semantic events to the world model through registered handlers.
|
|
5
|
+
* Bridges the gap between event-generating actions and state mutations.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types';
|
|
8
|
+
export * from './processor';
|
|
9
|
+
export * from './handlers';
|
|
10
|
+
export * from './effects';
|
|
11
|
+
export * from './handler-types';
|
|
12
|
+
export { ISemanticEvent } from '@sharpee/core';
|
|
13
|
+
export { WorldModel, WorldChange } from '@sharpee/world-model';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @sharpee/event-processor - Event application system
|
|
4
|
+
*
|
|
5
|
+
* Applies semantic events to the world model through registered handlers.
|
|
6
|
+
* Bridges the gap between event-generating actions and state mutations.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.WorldModel = void 0;
|
|
24
|
+
__exportStar(require("./types"), exports);
|
|
25
|
+
__exportStar(require("./processor"), exports);
|
|
26
|
+
__exportStar(require("./handlers"), exports);
|
|
27
|
+
// Effects system (ADR-075)
|
|
28
|
+
__exportStar(require("./effects"), exports);
|
|
29
|
+
__exportStar(require("./handler-types"), exports);
|
|
30
|
+
var world_model_1 = require("@sharpee/world-model");
|
|
31
|
+
Object.defineProperty(exports, "WorldModel", { enumerable: true, get: function () { return world_model_1.WorldModel; } });
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B;AAE3B,2BAA2B;AAC3B,4CAA0B;AAC1B,kDAAgC;AAIhC,oDAA+D;AAAtD,yGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event processor implementation
|
|
3
|
+
*
|
|
4
|
+
* Applies semantic events to the world model through registered handlers.
|
|
5
|
+
* ADR-075: Entity handlers receive WorldQuery and return Effect[].
|
|
6
|
+
*/
|
|
7
|
+
import { ISemanticEvent } from '@sharpee/core';
|
|
8
|
+
import { WorldModel } from '@sharpee/world-model';
|
|
9
|
+
import { ProcessedEvents, ProcessorOptions } from '@sharpee/if-domain';
|
|
10
|
+
import type { StoryEventHandler } from './handler-types';
|
|
11
|
+
export type { StoryEventHandler, IGameEvent } from './handler-types';
|
|
12
|
+
export type { Effect, WorldQuery } from './effects';
|
|
13
|
+
export declare class EventProcessor {
|
|
14
|
+
private world;
|
|
15
|
+
private options;
|
|
16
|
+
private effectProcessor;
|
|
17
|
+
private worldQuery;
|
|
18
|
+
private storyHandlers;
|
|
19
|
+
constructor(world: WorldModel, options?: ProcessorOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Register a story-level event handler
|
|
22
|
+
* Multiple handlers can be registered for the same event type
|
|
23
|
+
*/
|
|
24
|
+
registerHandler(eventType: string, handler: StoryEventHandler): void;
|
|
25
|
+
/**
|
|
26
|
+
* Unregister a story-level event handler
|
|
27
|
+
*/
|
|
28
|
+
unregisterHandler(eventType: string, handler: StoryEventHandler): void;
|
|
29
|
+
/**
|
|
30
|
+
* Process a batch of events
|
|
31
|
+
*/
|
|
32
|
+
processEvents(events: ISemanticEvent[]): ProcessedEvents;
|
|
33
|
+
/**
|
|
34
|
+
* Process a single event
|
|
35
|
+
*/
|
|
36
|
+
private processSingleEvent;
|
|
37
|
+
/**
|
|
38
|
+
* Process reaction events with depth limiting
|
|
39
|
+
*/
|
|
40
|
+
private processReactions;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a result is an array of Effects (ADR-075 pattern)
|
|
43
|
+
*/
|
|
44
|
+
private isEffectArray;
|
|
45
|
+
/**
|
|
46
|
+
* Invoke entity and story handlers for an event (ADR-075)
|
|
47
|
+
*
|
|
48
|
+
* Collects effects from all handlers and processes them through EffectProcessor.
|
|
49
|
+
* Supports multiple handlers per event type.
|
|
50
|
+
* Also supports legacy handlers that return ISemanticEvent[] during migration.
|
|
51
|
+
*/
|
|
52
|
+
private invokeEntityHandlers;
|
|
53
|
+
/**
|
|
54
|
+
* Get the world model
|
|
55
|
+
*/
|
|
56
|
+
getWorld(): WorldModel;
|
|
57
|
+
/**
|
|
58
|
+
* Update processor options
|
|
59
|
+
*/
|
|
60
|
+
setOptions(options: Partial<ProcessorOptions>): void;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../src/processor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAe,eA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