feat(03-02): implement approved event built-ins

- Add map, hero, touch, and temporary event controls
- Register exactly eight built-ins through top-level event assembly
- Cover awaited behavior and safe failure with explicit fixtures
This commit is contained in:
AncTe committed 2026-09-10 16:25:02 +08:00
1 parent e9e89fdfdb
commit 3134537d30
9 files changed
+849 -12

No files matched your search

@@ -1,6 +1,6 @@
import { IStateBase } from '@user/data-base';
import { IGameEventStore } from '@user/data-common';
import { AnonTokyoInterpreter } from 'anon-tokyo';
import { AnonTokyoInterpreter, BuiltInFunction } from 'anon-tokyo';
import { EventExecutor } from './executor';
import { IGameEventExecutor, IGameEventSystem } from './types';
@@ -8,10 +8,13 @@ export class GameEventSystem implements IGameEventSystem {
readonly executor: IGameEventExecutor;
store: IGameEventStore | null;
constructor(readonly state: IStateBase) {
constructor(
readonly state: IStateBase,
builtins: ReadonlyArray<BuiltInFunction> = []
) {
this.store = state.eventStore;
const interpreter = new AnonTokyoInterpreter({
builtInFunctions: [],
builtInFunctions: [...builtins],
globalFunctions: []
});
this.executor = new EventExecutor(interpreter, () => this.store);