@its-not-rocket-science/ananke 0.1.3 → 0.1.5
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/CHANGELOG.md +217 -177
- package/dist/src/catalog.d.ts +86 -0
- package/dist/src/catalog.js +393 -0
- package/dist/src/derive.d.ts +5 -3
- package/dist/src/derive.js +10 -8
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/sim/biome.d.ts +71 -0
- package/dist/src/sim/biome.js +61 -0
- package/dist/src/sim/context.d.ts +8 -0
- package/dist/src/sim/kernel.js +7 -1
- package/dist/src/sim/step/movement.js +13 -1
- package/dist/src/sim/thermoregulation.d.ts +3 -2
- package/dist/src/sim/thermoregulation.js +6 -4
- package/docs/versioning.md +2 -2
- package/package.json +21 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,177 +1,217 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to Ananke are documented here.
|
|
4
|
-
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
-
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## [Unreleased]
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## [0.1.
|
|
14
|
-
|
|
15
|
-
###
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- `
|
|
21
|
-
|
|
22
|
-
- `
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- `
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
3
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
- **Phase
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
- **Phase
|
|
106
|
-
|
|
107
|
-
- **Phase
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- **Phase
|
|
117
|
-
|
|
118
|
-
- **Phase
|
|
119
|
-
|
|
120
|
-
- **Phase
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
- **Phase
|
|
134
|
-
|
|
135
|
-
`
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
- **Phase
|
|
140
|
-
|
|
141
|
-
`
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
- **Phase
|
|
146
|
-
|
|
147
|
-
- **Phase
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- **Phase
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
-
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Ananke are documented here.
|
|
4
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
+
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## [0.1.5] — 2026-03-21
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **CE-12 · Data-Driven Entity Catalog** (`src/catalog.ts`, `./catalog` subpath export)
|
|
18
|
+
- `registerArchetype(json)` — parse JSON archetype with base inheritance (`HUMAN_BASE`,
|
|
19
|
+
`AMATEUR_BOXER`, `SERVICE_ROBOT`, etc.) and SI → SCALE unit conversion
|
|
20
|
+
- `registerWeapon(json)` — parse JSON weapon with damage profile; `reach_m` / `readyTime_s`
|
|
21
|
+
converted to SCALE; all ratio fields → Q
|
|
22
|
+
- `registerArmour(json)` — parse JSON armour; `protects` from channel-name strings →
|
|
23
|
+
`ChannelMask`; `coverageByRegion` values → Q
|
|
24
|
+
- `getCatalogEntry(id)` / `listCatalog(kind?)` / `unregisterCatalogEntry(id)` /
|
|
25
|
+
`clearCatalog()` for lifecycle management
|
|
26
|
+
- All numeric values in JSON are real-world SI units; conversion is automatic
|
|
27
|
+
|
|
28
|
+
- **Phase 68 · Multi-Biome Physics** (`src/sim/biome.ts`)
|
|
29
|
+
- `BiomeContext` interface with `gravity_mps2`, `thermalResistanceBase`, `dragMul`,
|
|
30
|
+
`soundPropagation`, `isVacuum` overrides
|
|
31
|
+
- Built-in profiles: `BIOME_UNDERWATER`, `BIOME_LUNAR`, `BIOME_VACUUM`
|
|
32
|
+
- Gravity threads into `deriveMovementCaps` (jump height, traction); drag applied per tick
|
|
33
|
+
in movement step; thermal resistance base overrides `stepCoreTemp`; vacuum fatigue
|
|
34
|
+
accumulates in kernel (+3 Q/tick)
|
|
35
|
+
- `KernelContext.biome?` field; fully backwards-compatible (absent = Earth defaults)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## [0.1.4] — 2026-03-20
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- Subpath export `@its-not-rocket-science/ananke/species` — exposes `SpeciesDefinition`,
|
|
44
|
+
`ALL_SPECIES`, and all 14 built-in species constants for companion packages such as
|
|
45
|
+
`ananke-fantasy-species`.
|
|
46
|
+
- Subpath export `@its-not-rocket-science/ananke/polity` — exposes `createPolity`,
|
|
47
|
+
`createPolityRegistry`, `stepPolityDay`, `declareWar`, `makePeace`, `areAtWar`,
|
|
48
|
+
`Polity`, `PolityRegistry`, `PolityPair` for world-simulation consumers such as
|
|
49
|
+
`ananke-world-ui`.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## [0.1.3] — 2026-03-20
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- `src/index.ts` (CE-4) now exports only the Tier 1 stable surface defined in `STABLE_API.md`.
|
|
58
|
+
Tier 2 (experimental) and Tier 3 (internal) exports have been removed from the root barrel
|
|
59
|
+
and are accessible via direct module paths (e.g. `dist/src/sim/aging.js`).
|
|
60
|
+
- `createWorld`, `loadScenario`, `validateScenario`, `ARCHETYPE_MAP`, `ITEM_MAP` promoted to
|
|
61
|
+
Tier 1 (were incorrectly placed under Tier 3 in 0.1.2).
|
|
62
|
+
- `describeCharacter`, `formatCharacterSheet`, `formatOneLine` added to root barrel (were
|
|
63
|
+
listed as Tier 1 in `STABLE_API.md` but missing from the 0.1.2 export).
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## [0.1.2] — 2026-03-19
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
- `createWorld(seed, entities)` — Tier-1 convenience factory; builds a `WorldState` from
|
|
72
|
+
`EntitySpec[]` (archetype, weapon, armour string IDs) without manual entity construction
|
|
73
|
+
- `loadScenario(json)` / `validateScenario(json)` — JSON-driven world creation for
|
|
74
|
+
non-TypeScript consumers (Godot GDScript, Unity C#, scenario files)
|
|
75
|
+
- `ARCHETYPE_MAP` — `ReadonlyMap` of all 21 built-in archetypes (7 base + 14 species)
|
|
76
|
+
- `ITEM_MAP` — `ReadonlyMap` of all historical and starter weapons/armour
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## [0.1.1] — 2026-03-19
|
|
81
|
+
|
|
82
|
+
### Documentation
|
|
83
|
+
|
|
84
|
+
- Replace root `README.md` with a focused programmer's guide (installation, three
|
|
85
|
+
quick-start examples, core concepts, command reference, determinism rules, replay,
|
|
86
|
+
bridge, API tier table, TypeScript types, performance guidance)
|
|
87
|
+
- Preserve full original README as `docs/project-overview.md`
|
|
88
|
+
- Publish `docs/` reference suite in npm tarball: host-contract, integration-primer,
|
|
89
|
+
bridge-contract, performance, versioning, emergent-validation-report, project-overview
|
|
90
|
+
- Mark Platform Hardening PH-1 through PH-8 complete in ROADMAP
|
|
91
|
+
- Mark CE-1 (npm publish) complete; package published as `@its-not-rocket-science/ananke`
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## [0.1.0] — 2026-03-18
|
|
96
|
+
|
|
97
|
+
Initial published release. All simulation layers (2–6) complete.
|
|
98
|
+
3 023 tests passing. Coverage: statements 93.9%, branches 85.0%, functions 92.3%.
|
|
99
|
+
|
|
100
|
+
### Simulation kernel (Layer 2) — Phases 1–60
|
|
101
|
+
|
|
102
|
+
- **Phase 1** — Physical melee combat: kinetic strike/block/parry resolution, per-region
|
|
103
|
+
injury accumulation, shock/fluid-loss/consciousness tracking, movement physics, encumbrance,
|
|
104
|
+
crowd density, spatial partitioning, formation frontage cap, occlusion
|
|
105
|
+
- **Phase 2** — Grappling (leverage-based, deterministic), stamina/exhaustion model, weapon
|
|
106
|
+
dynamics (bind, reach dominance, swing momentum carry)
|
|
107
|
+
- **Phase 3** — Ranged and projectile combat: dispersion-based accuracy, penetration at range,
|
|
108
|
+
suppression, cover/occlusion, explosive AoE, hydrostatic shock and cavitation, flash blindness
|
|
109
|
+
- **Phase 4** — Perception and cognition: sensory model, decision latency, surprise mechanics,
|
|
110
|
+
deterministic AI (line infantry / skirmisher presets)
|
|
111
|
+
- **Phase 5** — Morale and psychological state: fear accumulation, routing, panic variety,
|
|
112
|
+
leader/banner auras, rally mechanic
|
|
113
|
+
- **Phase 6** — Terrain: surface friction, obstacle/cover grids, elevation, slope direction,
|
|
114
|
+
dynamic hazard cells, AI cover-seeking, elevation melee advantage
|
|
115
|
+
- **Phase 7** — Skill system: per-entity `SkillMap`, technique modifiers on physical outcomes
|
|
116
|
+
- **Phase 8** — Body plan system: universal region-based anatomy (humanoid, quadruped, theropod,
|
|
117
|
+
sauropod, avian, vermiform, centaur, octopoid); add species with a data file, no kernel changes
|
|
118
|
+
- **Phase 9** — Medical simulation: fractures, infection, permanent damage, clotting, fatal
|
|
119
|
+
fluid loss, `TreatCommand` with tiered equipment and skill-scaled treatment rates
|
|
120
|
+
- **Phase 10** — Indirect fire and artillery
|
|
121
|
+
- **Phase 11** — Technology spectrum: `TechContext`, `TechEra`, `TechCapability`,
|
|
122
|
+
`validateLoadout`; powered exoskeleton, energy weapons, reflective armour, sensor items
|
|
123
|
+
- **Phase 12** — Capability sources and effects: Clarke's Third Law unification of magic and
|
|
124
|
+
advanced technology; directional cone AoE for breath weapons / flamethrowers / gas
|
|
125
|
+
- **Phase 21** — Character generation: `generateIndividual(seed, archetype, bias?)` with
|
|
126
|
+
per-archetype variance distributions; `NarrativeBias` for story-shaped generation (Phase 62)
|
|
127
|
+
- **Phase 22** — Campaign layer: world clock, location registry, `travelCost` routing,
|
|
128
|
+
campaign-level inventory, Map-aware JSON serialisation
|
|
129
|
+
- **Phase 24** — Faction and reputation: standing, witness system, AI suppression
|
|
130
|
+
- **Phase 25** — Economy: item valuation, wear degradation, loot resolution, trade evaluation
|
|
131
|
+
- **Phase 31** — Knockback and stagger: impulse-momentum physics → stagger / prone transitions
|
|
132
|
+
- **Phase 32D** — Morale system constants
|
|
133
|
+
- **Phase 33** — Downtime and recovery: 1 Hz campaign-time bridge with tiered care levels
|
|
134
|
+
- **Phase 34** — Replay and analytics: `ReplayRecorder`, `replayTo`, `serializeReplay` /
|
|
135
|
+
`deserializeReplay`, `CollectingTrace`, metrics
|
|
136
|
+
- **Phase 35** — Arena simulation framework: scenario DSL, batch trial runner, expectation system
|
|
137
|
+
- **Phase 36** — Dialogue and negotiation: intimidation / persuasion / deception / surrender /
|
|
138
|
+
trade resolution using physical and psychological attributes
|
|
139
|
+
- **Phase 37** — Skill system extension: linguistic, musical, spatial intelligences
|
|
140
|
+
- **Phase 38** — Character description layer: `describeCharacter`, `formatCharacterSheet`,
|
|
141
|
+
`formatOneLine`, tier ratings grounded in real-world benchmarks
|
|
142
|
+
- **Phase 39** — Narrative layer: trace-to-prose event conversion, configurable verbosity
|
|
143
|
+
- **Phase 45** — Faction system expansion
|
|
144
|
+
- **Phase 47** — Personality traits
|
|
145
|
+
- **Phase 48** — Formation and squad mechanics
|
|
146
|
+
- **Phase 50** — Legend and chronicle: `LegendRegistry`, fame tracking, `ChronicleEntry`
|
|
147
|
+
- **Phase 51** — Group psychology
|
|
148
|
+
- **Phase 53** — Systemic toxicology: ingested/cumulative toxins, pharmacokinetics,
|
|
149
|
+
substance interactions, addiction and withdrawal
|
|
150
|
+
- **Phase 54** — Wound aging and long-term sequelae: PTSD-like `TraumaState`, phantom pain,
|
|
151
|
+
chronic fatigue, sepsis risk
|
|
152
|
+
- **Phase 55** — Collective non-combat activities: siege engineering, ritual/ceremony, trade
|
|
153
|
+
caravan logistics
|
|
154
|
+
- **Phase 56** — Disease and epidemic simulation: transmission routes, incubation, mortality,
|
|
155
|
+
immunity, polity-scale spread
|
|
156
|
+
- **Phase 57** — Aging and lifespan: `AgeState`, age multipliers on all attribute groups,
|
|
157
|
+
`applyAgingToAttributes`
|
|
158
|
+
- **Phase 58** — Sleep and circadian rhythm: sleep phases, debt accumulation,
|
|
159
|
+
`applySleepToAttributes`, `circadianAlertness`
|
|
160
|
+
- **Phase 59** — Mounted combat: five mount profiles, charge energy, rider height/stability,
|
|
161
|
+
forced dismount, mount fear propagation
|
|
162
|
+
- **Phase 60** — Environmental hazard zones: fire/radiation/toxic gas/acid/extreme cold,
|
|
163
|
+
linear falloff exposure, `stepHazardZone`
|
|
164
|
+
- **Phase 2ext / 3ext / 8B / 8C / 10B / 10C / 11C / 12B** — Phase extensions for thermoregulation,
|
|
165
|
+
weather, terrain enhancements, and technology calibration
|
|
166
|
+
|
|
167
|
+
### Individual scale (Layer 3) — Phases 57–58, 62
|
|
168
|
+
|
|
169
|
+
- Aging, sleep/circadian, narrative bias for character generation
|
|
170
|
+
|
|
171
|
+
### Group scale (Layer 4) — Phase 65
|
|
172
|
+
|
|
173
|
+
- **Phase 65** — Emotional contagion at polity scale: `EmotionalWave`, four built-in profiles
|
|
174
|
+
(military rout, plague panic, victory rally, charismatic address), `applyEmotionalContagion`,
|
|
175
|
+
`stepEmotionalWaves`, `netEmotionalPressure`
|
|
176
|
+
|
|
177
|
+
### Society scale (Layer 5) — Phase 66
|
|
178
|
+
|
|
179
|
+
- **Phase 66** — Generative mythology: six archetypal patterns detected from legend/chronicle log
|
|
180
|
+
(hero, monster, great_plague, divine_wrath, golden_age, trickster); `compressMythsFromHistory`,
|
|
181
|
+
`stepMythologyYear`, `aggregateFactionMythEffect`
|
|
182
|
+
|
|
183
|
+
### World scale (Layer 6) — Phases 61, 67
|
|
184
|
+
|
|
185
|
+
- **Phase 61** — Polity and world-state system: `Polity`, `PolityRegistry`, `stepPolityDay`,
|
|
186
|
+
trade, war, diplomacy, tech advancement, epidemic spread at polity scale
|
|
187
|
+
- **Phase 67** — Technology diffusion: tech eras spread via trade routes; `computeDiffusionPressure`,
|
|
188
|
+
`stepTechDiffusion`, `totalInboundPressure`
|
|
189
|
+
|
|
190
|
+
### Interface layer (Layer 1) — ROADMAP items 7–11, Phases 62–63
|
|
191
|
+
|
|
192
|
+
- **Phase 62** — Narrative Bias: `NarrativeBias` parameter for `generateIndividual`
|
|
193
|
+
- **Phase 63** — Narrative Stress Test: probability of story beats across seed distributions;
|
|
194
|
+
Deus Ex score (0.00 = plausible, 1.00 = plot armour)
|
|
195
|
+
- **Phase 64** — "What If?" alternate history engine: polity-scale scenario runner across N seeds
|
|
196
|
+
- Visual editors: Body Plan Editor, Validation Scenario Builder, Species Forge
|
|
197
|
+
(`docs/editors/`)
|
|
198
|
+
- Public Validation Dashboard: 43/43 scenarios passing (`docs/dashboard/`)
|
|
199
|
+
- Performance & Scalability Benchmarks: `tools/benchmark.ts`, `docs/performance.md`
|
|
200
|
+
- Emergent Behaviour Validation Suite: four historical scenarios, all pass (`tools/emergent-validation.ts`)
|
|
201
|
+
- Blade Runner artificial life test: 198 NPCs, 365 simulated days, 4/4 claims pass
|
|
202
|
+
- Dataset Contribution Pipeline: `docs/dataset-contribution.md`
|
|
203
|
+
|
|
204
|
+
### Infrastructure
|
|
205
|
+
|
|
206
|
+
- 3 023 Vitest tests; coverage ≥ 90% statements/lines, ≥ 80% branches, ≥ 85% functions
|
|
207
|
+
- CI: Node 20 + 22 matrix, typecheck, build, coverage, validation dashboard auto-update
|
|
208
|
+
- Fixed-point arithmetic throughout; zero `Math.random()` in `src/`
|
|
209
|
+
- `docs/integration-primer.md` — architecture, data-flow diagrams, type glossary, gotchas
|
|
210
|
+
- `docs/bridge-api.md` — 3D integration API reference
|
|
211
|
+
- `docs/ecosystem.md` — Unity/Godot adapter sketches
|
|
212
|
+
- `docs/performance.md` — benchmark methodology and tuning guide
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
[Unreleased]: https://github.com/its-not-rocket-science/ananke/compare/v0.1.0...HEAD
|
|
217
|
+
[0.1.0]: https://github.com/its-not-rocket-science/ananke/releases/tag/v0.1.0
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CE-12 — Data-Driven Entity Catalog
|
|
3
|
+
*
|
|
4
|
+
* Allows archetypes, weapons, and armour to be defined in JSON (e.g. loaded from a file
|
|
5
|
+
* or authored by non-TypeScript content creators) and registered at runtime.
|
|
6
|
+
*
|
|
7
|
+
* All numeric values in JSON are **real-world SI units**:
|
|
8
|
+
* mass_kg → real kilograms (e.g. 110)
|
|
9
|
+
* stature_m → real metres (e.g. 1.9)
|
|
10
|
+
* force_N → real Newtons (e.g. 3200)
|
|
11
|
+
* power_W → real Watts (e.g. 1400)
|
|
12
|
+
* energy_J → real Joules (e.g. 25000)
|
|
13
|
+
* time_s → real seconds (e.g. 0.22)
|
|
14
|
+
* Q-fields → ratio [0..1] (e.g. 0.65)
|
|
15
|
+
*
|
|
16
|
+
* The catalog converts these to internal fixed-point SCALE units on registration.
|
|
17
|
+
* getCatalogEntry(id) returns the already-converted typed object.
|
|
18
|
+
*/
|
|
19
|
+
import type { Archetype } from "./archetypes.js";
|
|
20
|
+
import type { Weapon, Armour } from "./equipment.js";
|
|
21
|
+
export type CatalogKind = "archetype" | "weapon" | "armour";
|
|
22
|
+
export type CatalogEntry = {
|
|
23
|
+
kind: "archetype";
|
|
24
|
+
id: string;
|
|
25
|
+
archetype: Archetype;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "weapon";
|
|
28
|
+
id: string;
|
|
29
|
+
weapon: Weapon;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "armour";
|
|
32
|
+
id: string;
|
|
33
|
+
armour: Armour;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Parse a JSON archetype definition and register it in the catalog.
|
|
37
|
+
*
|
|
38
|
+
* @param json - Raw JSON value (e.g. from JSON.parse). Must have:
|
|
39
|
+
* - `id` (string): unique catalog identifier
|
|
40
|
+
* - `base` (string, optional): name of a built-in archetype to inherit from
|
|
41
|
+
* - `overrides` (object, optional): field values to override in real SI units
|
|
42
|
+
* @returns The converted Archetype object.
|
|
43
|
+
* @throws If required fields are missing, values are out of range, or `id` already registered.
|
|
44
|
+
*/
|
|
45
|
+
export declare function registerArchetype(json: unknown): Archetype;
|
|
46
|
+
/**
|
|
47
|
+
* Parse a JSON weapon definition and register it in the catalog.
|
|
48
|
+
*
|
|
49
|
+
* @param json - Raw JSON value. Required fields:
|
|
50
|
+
* - `id`, `name` (string)
|
|
51
|
+
* - `mass_kg` (real kg), `bulk` (Q 0..1)
|
|
52
|
+
* - `damage` (object with surfaceFrac, internalFrac, structuralFrac, bleedFactor, penetrationBias)
|
|
53
|
+
* @returns The converted Weapon object.
|
|
54
|
+
* @throws If required fields are missing or `id` already registered.
|
|
55
|
+
*/
|
|
56
|
+
export declare function registerWeapon(json: unknown): Weapon;
|
|
57
|
+
/**
|
|
58
|
+
* Parse a JSON armour definition and register it in the catalog.
|
|
59
|
+
*
|
|
60
|
+
* @param json - Raw JSON value. Required fields:
|
|
61
|
+
* - `id`, `name` (string)
|
|
62
|
+
* - `mass_kg` (real kg), `bulk` (Q 0..1)
|
|
63
|
+
* - `resist_J` (real Joules), `protectedDamageMul` (Q 0..1)
|
|
64
|
+
* - `coverageByRegion` (object mapping region name → Q 0..1)
|
|
65
|
+
* @returns The converted Armour object.
|
|
66
|
+
* @throws If required fields are missing or `id` already registered.
|
|
67
|
+
*/
|
|
68
|
+
export declare function registerArmour(json: unknown): Armour;
|
|
69
|
+
/**
|
|
70
|
+
* Look up a registered entry by id.
|
|
71
|
+
* Returns the CatalogEntry or undefined if not found.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getCatalogEntry(id: string): CatalogEntry | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Return all registered ids of the given kind, or all ids when kind is omitted.
|
|
76
|
+
*/
|
|
77
|
+
export declare function listCatalog(kind?: CatalogKind): string[];
|
|
78
|
+
/**
|
|
79
|
+
* Remove a registered entry. Useful in tests.
|
|
80
|
+
* Returns true if the entry existed and was removed.
|
|
81
|
+
*/
|
|
82
|
+
export declare function unregisterCatalogEntry(id: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Remove all registered entries. Useful for resetting state in tests.
|
|
85
|
+
*/
|
|
86
|
+
export declare function clearCatalog(): void;
|