From 6a2997693b8ffdc215084d6d32751e39978d6c9c Mon Sep 17 00:00:00 2001 From: Ben C Date: Sun, 16 Jul 2023 19:51:15 -0400 Subject: [PATCH] Add more schema badges --- docs/.vscode/extensions.json | 4 --- docs/.vscode/launch.json | 11 --------- docs/src/content/docs/ship-log.md | 41 ++++++++++++++----------------- docs/src/schema_utils.ts | 13 +++++++++- 4 files changed, 31 insertions(+), 38 deletions(-) delete mode 100644 docs/.vscode/extensions.json delete mode 100644 docs/.vscode/launch.json diff --git a/docs/.vscode/extensions.json b/docs/.vscode/extensions.json deleted file mode 100644 index 2592970b..00000000 --- a/docs/.vscode/extensions.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "recommendations": ["astro-build.astro-vscode"], - "unwantedRecommendations": [] -} diff --git a/docs/.vscode/launch.json b/docs/.vscode/launch.json deleted file mode 100644 index e368c540..00000000 --- a/docs/.vscode/launch.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "command": "./node_modules/.bin/astro dev", - "name": "Development server", - "request": "launch", - "type": "node-terminal" - } - ] -} diff --git a/docs/src/content/docs/ship-log.md b/docs/src/content/docs/ship-log.md index 944f18cf..148873b3 100644 --- a/docs/src/content/docs/ship-log.md +++ b/docs/src/content/docs/ship-log.md @@ -160,7 +160,7 @@ You can load your XML file to your planet by doing adding the following to your ### Entry Layout By default, entries in rumor mode are laid out by rows, where each row is one planet. This will not make for a perfect -layout, so you can use the `entryPositions` property in your star system config to change them +layout, so you can use the `entryPositions` property in your star system config to change them. For example, if I want to change an entry with the ID of `EXAMPLE_ENTRY` and another with the ID of `EXAMPLE_ENTRY_2`: ```json @@ -184,7 +184,7 @@ For example, if I want to change an entry with the ID of `EXAMPLE_ENTRY` and ano } ``` -To help with this, download the unity explorer mod and manually position entries, then simply use the dev tools to dump all the entries to a json string you can copy and paste into your config. +To help with this, download the unity explorer mod and manually position entries (they're located under `Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/MapMode/ScaleRoot/PanRoot`), then simply use the dev tools to dump all the entries to a json string you can copy and paste into your config. ![autoDetectiveMode](/ship_log/auto_rumor_mode.webp) _A set of entries laid out with auto mode_ @@ -210,30 +210,27 @@ would be `EXAMPLE_ENTRY_ALT.png`. ### Curiosity Colors -Colors for each curiosity is given in a list, so if I wanted the curiosity `EXAMPLE_ENTRY` to have a color of blue: +Colors for each curiosity is given in a list **within the star system config**, so if I wanted the curiosity `EXAMPLE_ENTRY` to have a color of blue: ```json { - "ShipLog": { - "xmlFile": "planets/example.xml", - "curiosities": [ - { - "id": "EXAMPLE_ENTRY", - "color": { - "r": 0, - "g": 0, - "b": 100, - "a": 255 - }, - "highlightColor": { - "r": 0, - "g": 1, - "b": 255, - "a": 255 - } + "curiosities": [ + { + "id": "EXAMPLE_ENTRY", + "color": { + "r": 0, + "g": 0, + "b": 100, + "a": 255 + }, + "highlightColor": { + "r": 0, + "g": 1, + "b": 255, + "a": 255 } - ] - } + } + ] } ``` diff --git a/docs/src/schema_utils.ts b/docs/src/schema_utils.ts index aaaa5103..12d1b03e 100644 --- a/docs/src/schema_utils.ts +++ b/docs/src/schema_utils.ts @@ -123,7 +123,18 @@ export const SchemaTools = { getAdditionalBadges: (schema: Schema) => { switch (schema.internalSchema.type) { case "JSON": - return []; + const internalSchema = schema.internalSchema.val; + const badges = []; + if (internalSchema.minimum !== undefined) { + badges.push(`Minimum: ${internalSchema.minimum}`); + } + if (internalSchema.maximum !== undefined) { + badges.push(`Maximum: ${internalSchema.maximum}`); + } + if (internalSchema.default !== undefined) { + badges.push(`Default: ${internalSchema.default}`); + } + return badges; case "XML": const node = schema.internalSchema.val; if (node.name === "xs:complexType") return [];