@ai-rpg-engine/starter-template 3.8.1 → 3.9.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/package.json +1 -1
- package/src/setup.ts +16 -4
- package/src/starter.test.ts +20 -0
package/package.json
CHANGED
package/src/setup.ts
CHANGED
|
@@ -150,7 +150,11 @@ export function createGame(seed?: number): Engine {
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
// Author data → runtime. JSON hosts: extractSessionContent(pack) →
|
|
153
|
-
// construct modules (
|
|
153
|
+
// construct modules (traversalCore/statusCore/combatCore/inventoryCore/
|
|
154
|
+
// cognitionCore/environmentCore/districtCore/encounterSpawn +
|
|
155
|
+
// presence/length-gated quests/dialogues/abilities/equipment — NOT
|
|
156
|
+
// buildWorldStack; see content-schema's extractSessionContent JSDoc for
|
|
157
|
+
// the full recipe, F-c9309691) →
|
|
154
158
|
// applyContentPack({ profiles, channels: createStandardChannels() }).
|
|
155
159
|
// Import createStandardChannels from @ai-rpg-engine/modules — do not
|
|
156
160
|
// auto-inject. This factory still wires named catalogs at construction;
|
|
@@ -163,9 +167,17 @@ export function createGame(seed?: number): Engine {
|
|
|
163
167
|
throw new Error(`applyContentPack failed:\n${detail}`);
|
|
164
168
|
}
|
|
165
169
|
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
// F-bc7b8ab1: no manual playerId/locationId stamp needed here —
|
|
171
|
+
// content.ts's placements[] places pack's single type:'player' entity at
|
|
172
|
+
// 'start', so applyContentPack's own identity stamp (F-67786a6c) already
|
|
173
|
+
// derived both onto the store above. Don't add one back for your own
|
|
174
|
+
// starting zone either: if your pack authors exactly one type:'player'
|
|
175
|
+
// entity with a placement, the stamp tracks it for free — a hand-written
|
|
176
|
+
// override here is the exact pattern that can silently diverge from
|
|
177
|
+
// content.ts once you move the starting zone. Only fall back manually
|
|
178
|
+
// for a pack that declares zero or several type:'player' entities (the
|
|
179
|
+
// stamp is deliberately ambiguous-safe: it never guesses):
|
|
180
|
+
// if (!engine.store.state.playerId) engine.store.state.playerId = 'player';
|
|
169
181
|
|
|
170
182
|
return engine;
|
|
171
183
|
}
|
package/src/starter.test.ts
CHANGED
|
@@ -305,3 +305,23 @@ describe('starter template — cross-instance state isolation', () => {
|
|
|
305
305
|
.not.toBe(a.world.entities['grunt'].resources);
|
|
306
306
|
});
|
|
307
307
|
});
|
|
308
|
+
|
|
309
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
310
|
+
// IDENTITY STAMP (F-bc7b8ab1)
|
|
311
|
+
// Pin, not a bug fix: this must read identically before and after removing
|
|
312
|
+
// setup.ts's post-applyContentPack `engine.store.state.playerId = 'player';
|
|
313
|
+
// engine.store.state.locationId = 'start';` lines — content.ts's
|
|
314
|
+
// placements[] places { entityId: 'player', zoneId: 'start' }, and pack
|
|
315
|
+
// carries exactly one type:'player' entity, so applyContentPack's own
|
|
316
|
+
// identity stamp (F-67786a6c) already derives the same values. The manual
|
|
317
|
+
// lines were the pre-fix-style override the stamp was written to obsolete —
|
|
318
|
+
// this is the scaffold every new game is copied from, so the leftover
|
|
319
|
+
// pattern would otherwise keep propagating into new starters.
|
|
320
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
321
|
+
describe('starter template — identity stamp owns playerId/locationId (F-bc7b8ab1)', () => {
|
|
322
|
+
it('boots with playerId "player" and locationId "start" from applyContentPack\'s own identity stamp, with no manual override line', () => {
|
|
323
|
+
const engine = createGame(1);
|
|
324
|
+
expect(engine.world.playerId).toBe('player');
|
|
325
|
+
expect(engine.world.locationId).toBe('start');
|
|
326
|
+
});
|
|
327
|
+
});
|