weaschem: finish json schema for header

next up: talking about it, and the ID map...
This commit is contained in:
Starbeamrainbowlabs 2023-08-11 01:49:18 +01:00
parent fc6e50cef1
commit 4fb6d7f91c
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -33,6 +33,14 @@ The voxel-based sandbox building game [Minetest](https://minetest.net/).
The differences between a given region of the world at a given time and the same region some time later. The differences between a given region of the world at a given time and the same region some time later.
> Schematic origin
The origin of the schematic itself. This is always (0, 0, 0). Any schematic generated from the main Minetest world MUST be translated such that the negative X, Y, and Z corner of the defined region to be converted to a schematic is (0, 0, 0) in the generated schematic file.
> Offset
An offset, expressed as a `Vector3`, that MUST be applied to a schematic upon loading it back into the world, though implementers MAY offer an option to disable this (but applying the offset MUST be enabled by default).
> BNF > BNF
[Backus-Naur form](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form). Used to formally describe the file format. [Backus-Naur form](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form). Used to formally describe the file format.
@ -90,7 +98,6 @@ This JSON object follows the following JSON schema:
```json ```json
{ {
"$schema": "https://json-schema.org/draft/2020-12/schema", "$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "TODO: FILL THIS OUT",
"title": "Header", "title": "Header",
"description": "The header that contains the schematic's metadata.", "description": "The header that contains the schematic's metadata.",
"type": "object", "type": "object",
@ -103,24 +110,43 @@ This JSON object follows the following JSON schema:
"description": "A short description of the schematic.", "description": "A short description of the schematic.",
"type": "string" "type": "string"
}, },
"pos1": { "offset": {
"description": "Position 1 of the defined region that this schematic takes up. MAY be in object space, or MAY be in world space.", "description": "The offset to place the schematic at in the world, relative to the schematic origin, which is always (0, 0, 0).",
"type": "object" "$ref": "#/$defs/Vector3"
}, },
"pos2": { "size": {
"description": "Position 2 of the defined region that this schematic takes up. MAY be in object space, or MAY be in world space, but whatever space its in it MUST match pos1.", "description": "The size of the schematic, INDEXED from 0.",
"type": "object" "$ref": "#/$defs/Vector3"
}, },
"type": { "type": {
"description": "The type of schematic this is. Valid values: full, delta.", "description": "The type of schematic this is. Valid values: full, delta.",
"type": "string" "type": "string",
"pattern": "^(?:full|delta)$"
}, },
"generator": { "generator": {
"description": "The name and version of the software that generated this schematic.", "description": "The name and version of the software that generated this schematic.",
"type": "string" "type": "string"
} }
}, },
"required": [ "name", "pos1", "pos2", "type", "generator" ], "required": [ "name", "size", "offset", "type", "generator" ],
"$defs": {
"Vector3": {
"properties": {
"x": {
"description": "The x co-ordinate of the Vector3.",
"type": "integer",
},
"y": {
"description": "The y co-ordinate of the Vector3.",
"type": "integer",
},
"z": {
"description": "The z co-ordinate of the Vector3.",
"type": "integer",
}
}
}
}
} }
``` ```
@ -130,8 +156,8 @@ A specific example of a header JSON object is noted below. This example is prett
{ {
"name": "A castle", "name": "A castle",
"description": "A grand fairy tale-style castle with multiple towers.", "description": "A grand fairy tale-style castle with multiple towers.",
"pos1": { "x": 450, "y": 11, "z": 2301 }, "size": { "x": 50, "y": 25, "z": 75 },
"pos2": { "x": 1026, "y": 11, "z": 3017 }, "offset": { "x": 3, "y": 0, "z": 5 },
"type": "full", "type": "full",
"generator": "WorldEditAdditions v1.14" "generator": "WorldEditAdditions v1.14"
} }