@alpaca-software/40kdc-data 0.3.0 → 0.3.1

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.
Files changed (51) hide show
  1. package/dist/codegen-data.js +2 -0
  2. package/dist/codegen-data.js.map +1 -1
  3. package/dist/data/bundle.generated.js +1 -1
  4. package/dist/data/bundle.generated.js.map +1 -1
  5. package/dist/data/dataset.d.ts +16 -1
  6. package/dist/data/dataset.d.ts.map +1 -1
  7. package/dist/data/dataset.js +25 -0
  8. package/dist/data/dataset.js.map +1 -1
  9. package/dist/data/index.d.ts +4 -0
  10. package/dist/data/index.d.ts.map +1 -1
  11. package/dist/data/index.js +4 -0
  12. package/dist/data/index.js.map +1 -1
  13. package/dist/data/types.d.ts +5 -1
  14. package/dist/data/types.d.ts.map +1 -1
  15. package/dist/data/types.js +2 -0
  16. package/dist/data/types.js.map +1 -1
  17. package/dist/gen-conformance.js +158 -0
  18. package/dist/gen-conformance.js.map +1 -1
  19. package/dist/generated.d.ts +156 -36
  20. package/dist/generated.d.ts.map +1 -1
  21. package/dist/generated.js.map +1 -1
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +4 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/migrate-terrain.d.ts +2 -0
  27. package/dist/migrate-terrain.d.ts.map +1 -0
  28. package/dist/migrate-terrain.js +297 -0
  29. package/dist/migrate-terrain.js.map +1 -0
  30. package/dist/runner.d.ts.map +1 -1
  31. package/dist/runner.js +26 -0
  32. package/dist/runner.js.map +1 -1
  33. package/dist/terrain/index.d.ts +11 -0
  34. package/dist/terrain/index.d.ts.map +1 -0
  35. package/dist/terrain/index.js +9 -0
  36. package/dist/terrain/index.js.map +1 -0
  37. package/dist/terrain/resolve.d.ts +122 -0
  38. package/dist/terrain/resolve.d.ts.map +1 -0
  39. package/dist/terrain/resolve.js +221 -0
  40. package/dist/terrain/resolve.js.map +1 -0
  41. package/dist/terrain/solve.d.ts +56 -0
  42. package/dist/terrain/solve.d.ts.map +1 -0
  43. package/dist/terrain/solve.js +80 -0
  44. package/dist/terrain/solve.js.map +1 -0
  45. package/dist/validate.d.ts.map +1 -1
  46. package/dist/validate.js +1 -0
  47. package/dist/validate.js.map +1 -1
  48. package/package.json +2 -1
  49. package/schemas/$defs/common.schema.json +43 -0
  50. package/schemas/core/terrain-layout.schema.json +42 -56
  51. package/schemas/core/terrain-template.schema.json +105 -0
@@ -2,84 +2,68 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://40kdc.dev/schemas/core/terrain-layout.schema.json",
4
4
  "title": "Terrain Layout",
5
- "description": "A recommended arrangement of terrain pieces on the board, independent of the deployment map (a deployment-pattern references the layouts it recommends via recommended_terrain_layout_ids). Geometry is the source of truth; the GW standard piece templates are expressed as explicit footprints, with an optional descriptive `template` label. Footprints are deliberately open (not enum-locked) the launch catalog and its size are unconfirmed, so this models any shape rather than a fixed set. No layout data is authored yet.",
5
+ "description": "A recommended arrangement of terrain pieces on the board, independent of the deployment map (a deployment-pattern references the layouts it recommends via recommended_terrain_layout_ids). Each piece draws its geometry from a catalog `template` (a terrain-template entity) or an inline `footprint`; geometry is the source of truth. Placement is template-centroid-anchored: `position` is the piece's centroid, which is invariant under rotation and mirror, so orientation and location are decoupled. Resolved board-space vertices are derived by the shared terrain resolver (pinned by the conformance corpus), never stored here. No layout data is authored yet beyond migrated examples.",
6
6
  "type": "object",
7
7
  "$defs": {
8
- "footprint": {
9
- "description": "A terrain piece's 2D footprint, relative to the piece's `position`. Axis-aligned rectangle, right triangle (right angle at the local origin, legs along +x/+y), or an explicit polygon. GW's standard templates (e.g. 7\"×11.5\" rectangles, 8\"×11.5\" right triangles, 6\"×4\" rectangles, 10\"×2.5\" and 6\"×2\" lines) are all expressible here; lines are thin rectangles.",
10
- "oneOf": [
11
- {
12
- "type": "object",
13
- "properties": {
14
- "type": { "const": "rectangle" },
15
- "width": { "type": "number", "exclusiveMinimum": 0 },
16
- "height": { "type": "number", "exclusiveMinimum": 0 }
17
- },
18
- "required": ["type", "width", "height"],
19
- "additionalProperties": false
20
- },
21
- {
22
- "type": "object",
23
- "properties": {
24
- "type": { "const": "right-triangle" },
25
- "width": { "type": "number", "exclusiveMinimum": 0 },
26
- "height": { "type": "number", "exclusiveMinimum": 0 }
27
- },
28
- "required": ["type", "width", "height"],
29
- "additionalProperties": false
30
- },
31
- {
32
- "type": "object",
33
- "properties": {
34
- "type": { "const": "polygon" },
35
- "points": {
36
- "type": "array",
37
- "items": { "$ref": "../defs/common.schema.json#/$defs/vec2" },
38
- "minItems": 3
39
- }
40
- },
41
- "required": ["type", "points"],
42
- "additionalProperties": false
43
- }
44
- ]
45
- },
46
- "terrain-area-keyword": {
47
- "type": "string",
48
- "enum": ["obscuring", "hidden", "plunging-fire"],
49
- "description": "An 11e terrain-area keyword. Confirmed launch set; extend as further keywords publish on dataslate."
50
- },
51
8
  "piece": {
52
9
  "type": "object",
53
- "description": "One terrain feature placed on the board.",
10
+ "description": "One terrain piece placed on the board. Geometry comes from a catalog `template` or an inline `footprint` (if both are present, `footprint` is authoritative and `template` is provenance).",
54
11
  "properties": {
12
+ "id": {
13
+ "$ref": "../defs/common.schema.json#/$defs/entity-id",
14
+ "description": "Layout-local id. Required for any piece referenced by another piece's `parent_area_id`."
15
+ },
55
16
  "name": { "type": "string", "minLength": 1, "maxLength": 128 },
56
- "footprint": { "$ref": "#/$defs/footprint" },
17
+ "piece_type": {
18
+ "type": "string",
19
+ "enum": ["area", "feature"],
20
+ "default": "area",
21
+ "description": "An `area` is a gameplay terrain zone (the 11e 'terrain area'); a `feature` is physical scenery (walls, containers, pipes) placed on an area."
22
+ },
23
+ "template": {
24
+ "$ref": "../defs/common.schema.json#/$defs/entity-id",
25
+ "description": "Id of the terrain-template this piece instances. Footprint and defaults (height, blocking, keywords) are taken from that template unless overridden here."
26
+ },
27
+ "footprint": {
28
+ "$ref": "../defs/common.schema.json#/$defs/footprint",
29
+ "description": "Inline geometry, standing in for or overriding a template footprint. Authoritative when present."
30
+ },
57
31
  "position": {
58
32
  "$ref": "../defs/common.schema.json#/$defs/vec2",
59
- "description": "Board-inch placement of the footprint's local origin."
33
+ "description": "Placement of the piece's CENTROID (the polygon area centroid of its footprint). Rotation- and mirror-invariant: changing `rotation_degrees` or `mirror` never moves this point. In board inches, unless the piece is a feature with `parent_area_id`, in which case it is in the parent area's centroid-local frame."
60
34
  },
61
35
  "rotation_degrees": {
62
36
  "type": "number",
63
37
  "minimum": 0,
64
38
  "exclusiveMaximum": 360,
65
- "description": "Clockwise rotation of the footprint about `position`. Absent or 0 means axis-aligned."
39
+ "description": "Clockwise rotation about the centroid in the y-down board frame. Absent or 0 means the template's natural orientation."
66
40
  },
67
- "template": {
41
+ "mirror": {
68
42
  "type": "string",
69
- "minLength": 1,
70
- "maxLength": 64,
71
- "description": "Optional descriptive label for the GW standard template this piece uses (e.g. 'large-ruin', 'long-wall'). Free-form, not enum-locked — the geometry in `footprint` is authoritative."
43
+ "enum": ["none", "horizontal", "vertical"],
44
+ "default": "none",
45
+ "description": "Reflection applied in the centroid-local frame before rotation: `horizontal` negates local x (left-right flip), `vertical` negates local y."
46
+ },
47
+ "parent_area_id": {
48
+ "$ref": "../defs/common.schema.json#/$defs/entity-id",
49
+ "description": "For a feature: the layout-local id of the area it sits on. The feature's `position`/`rotation_degrees`/`mirror` are composed with the parent area's placement, so moving, rotating, or mirroring the area carries the feature with it."
50
+ },
51
+ "floor": {
52
+ "type": "integer",
53
+ "minimum": 0,
54
+ "default": 0,
55
+ "description": "Ruin floor this piece occupies (0 = ground level)."
72
56
  },
73
57
  "height_inches": {
74
58
  "type": "number",
75
59
  "minimum": 0,
76
- "description": "Height of the piece in inches. Gates Plunging Fire (a piece 3\" or taller confers +1 BS on ground-level targets)."
60
+ "description": "Height of the piece in inches; overrides the template default. Gates Plunging Fire (a piece 3\" or taller confers +1 BS on ground-level targets)."
77
61
  },
78
62
  "terrain_area_keywords": {
79
63
  "type": "array",
80
64
  "uniqueItems": true,
81
- "description": "Terrain-area keywords this piece's area carries.",
82
- "items": { "$ref": "#/$defs/terrain-area-keyword" }
65
+ "description": "Terrain-area keywords this piece's area carries; overrides the template default.",
66
+ "items": { "$ref": "../defs/common.schema.json#/$defs/terrain-area-keyword" }
83
67
  },
84
68
  "link_group": {
85
69
  "type": "string",
@@ -109,7 +93,9 @@
109
93
  "additionalProperties": false
110
94
  }
111
95
  },
112
- "required": ["footprint", "position"],
96
+ "required": ["position"],
97
+ "if": { "not": { "required": ["template"] } },
98
+ "then": { "required": ["footprint"] },
113
99
  "additionalProperties": false
114
100
  }
115
101
  },
@@ -0,0 +1,105 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://40kdc.dev/schemas/core/terrain-template.schema.json",
4
+ "title": "Terrain Template",
5
+ "description": "A reusable terrain piece in the standard catalog: a gameplay area (the 11e terrain-area templates) or a scenery feature (walls, containers, pipes, floor segments). Footprints are authored in natural local inches; the terrain resolver derives each footprint's polygon area centroid and re-centers on it, so a layout piece that instances a template places its centroid via the layout's `position`. An `area` template may carry an embedded `features` list — scenery placed in the area's centroid-local frame — making the template a reusable composition (e.g. a ruin with its walls). Placing such a template places all of its features, transformed by the area's own placement.",
6
+ "type": "object",
7
+ "$defs": {
8
+ "composed-feature": {
9
+ "type": "object",
10
+ "description": "A feature placed on an area template, positioned in the area's centroid-local frame (y-down inches). When the area is placed, rotated, or mirrored, its composed features are carried along.",
11
+ "properties": {
12
+ "id": {
13
+ "$ref": "../defs/common.schema.json#/$defs/entity-id",
14
+ "description": "Composition-local id for this feature instance."
15
+ },
16
+ "template": {
17
+ "$ref": "../defs/common.schema.json#/$defs/entity-id",
18
+ "description": "Id of the feature-kind terrain-template to place."
19
+ },
20
+ "position": {
21
+ "$ref": "../defs/common.schema.json#/$defs/vec2",
22
+ "description": "The feature's centroid in the area's centroid-local frame (origin at the area centroid, y-down inches)."
23
+ },
24
+ "rotation_degrees": {
25
+ "type": "number",
26
+ "minimum": 0,
27
+ "exclusiveMaximum": 360,
28
+ "description": "Clockwise rotation of the feature about its own centroid, within the area-local frame."
29
+ },
30
+ "mirror": {
31
+ "type": "string",
32
+ "enum": ["none", "horizontal", "vertical"],
33
+ "default": "none"
34
+ },
35
+ "floor": {
36
+ "type": "integer",
37
+ "minimum": 0,
38
+ "default": 0,
39
+ "description": "Ruin floor this feature occupies (0 = ground level)."
40
+ }
41
+ },
42
+ "required": ["template", "position"],
43
+ "additionalProperties": false
44
+ }
45
+ },
46
+ "properties": {
47
+ "id": { "$ref": "../defs/common.schema.json#/$defs/entity-id" },
48
+ "name": { "type": "string", "minLength": 1, "maxLength": 128 },
49
+ "kind": {
50
+ "type": "string",
51
+ "enum": ["area", "feature"],
52
+ "description": "`area` = a gameplay terrain zone; `feature` = physical scenery placed on an area."
53
+ },
54
+ "source": {
55
+ "type": "string",
56
+ "minLength": 1,
57
+ "maxLength": 64,
58
+ "description": "Catalog or mission pack the template originates from."
59
+ },
60
+ "footprint": { "$ref": "../defs/common.schema.json#/$defs/footprint" },
61
+ "default_height_inches": {
62
+ "type": "number",
63
+ "minimum": 0,
64
+ "description": "Default height in inches for pieces instancing this template. Gates Plunging Fire (>= 3\")."
65
+ },
66
+ "default_blocking": {
67
+ "type": "boolean",
68
+ "description": "Whether the template blocks line of sight / movement by default."
69
+ },
70
+ "ground_accessible": {
71
+ "type": "boolean",
72
+ "default": true,
73
+ "description": "Whether models may be placed on the ground footprint. `false` marks an elevated-only piece (a platform reachable only on its `upper_floor`, e.g. a gantry/catwalk) or a solid obstacle with no valid placement (e.g. a generator). Meaningful for `kind: \"feature\"`."
74
+ },
75
+ "upper_floor": {
76
+ "type": "object",
77
+ "description": "An elevated platform carried by this feature (e.g. a ruin's second storey). Its footprint is authored in the SAME local frame as `footprint` and re-centered on the GROUND footprint's polygon area centroid, so the two floors stay registered when the piece is placed, rotated, or mirrored. Non-resolved metadata: the terrain resolver does not emit it; authoring/visualization tools render it as an overlay. Meaningful for `kind: \"feature\"`.",
78
+ "properties": {
79
+ "footprint": { "$ref": "../defs/common.schema.json#/$defs/footprint" },
80
+ "floor": {
81
+ "type": "integer",
82
+ "minimum": 1,
83
+ "default": 1,
84
+ "description": "Ruin floor this platform occupies (1 = first floor above ground)."
85
+ }
86
+ },
87
+ "required": ["footprint"],
88
+ "additionalProperties": false
89
+ },
90
+ "default_terrain_area_keywords": {
91
+ "type": "array",
92
+ "uniqueItems": true,
93
+ "description": "Terrain-area keywords areas of this template carry by default. Meaningful for `kind: \"area\"`.",
94
+ "items": { "$ref": "../defs/common.schema.json#/$defs/terrain-area-keyword" }
95
+ },
96
+ "features": {
97
+ "type": "array",
98
+ "description": "Composed scenery features, in the area's centroid-local frame. Only meaningful for `kind: \"area\"`.",
99
+ "items": { "$ref": "#/$defs/composed-feature" }
100
+ },
101
+ "game_version": { "$ref": "../defs/game-version-ref.schema.json" }
102
+ },
103
+ "required": ["id", "name", "kind", "footprint", "game_version"],
104
+ "additionalProperties": false
105
+ }