Added documentation and schemas for events

This commit is contained in:
Yair Morgenstern
2024-03-09 21:54:56 +02:00
parent 1fc0f0ea68
commit ec131fe7cb
3 changed files with 58 additions and 0 deletions

View File

@ -114,6 +114,25 @@ The code below is an example of a valid "turns" definition and it specifies that
]
```
## Events.json
Events allow users to choose between options of triggers to activate.
| Attribute | Type | Default | Notes |
|-----------|----------------------|----------|-----------------------------------------------------------|
| name | String | Required | Used for triggering via "Triggers a [event] event" unique |
| text | String | None | Flavor text displayed to user |
| choices | List of EventChoices | | User can choose to trigger one of the viable choices |
Event choices are comprised of:
| Attribute | Type | Default | Notes |
|------------------|-----------------------------|------------|---------------------------------------------------------------|
| text | String | Required | Displayed to user. Should be an action name - "Do X" |
| triggeredUniques | List of trigger uniques | Required | The triggers that this choice activates upon being chosen |
| conditions | List of conditional uniques | Empty list | If any conditional is not met, this option becomes unpickable |
## ModOptions.json
<!-- [Link to original](https://github.com/yairm210/Unciv/tree/master/android/assets/jsons/Civ%20V%20-%20Gods%20&%20Kings/ModOptions.json) -->

View File

@ -66,6 +66,13 @@ Tada! Now Android Studio will recognize all Buildings.json files as belonging to
],
"url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/tileResources.json"
}
,
{
"fileMatch": [
"*/Events.json"
],
"url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/events.json"
}
]
```

View File

@ -0,0 +1,32 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"text": { "type": "string" },
"choices": {
"type": "array",
"items": {
"properties": {
"text": { "type": "string" },
"triggeredUniques": {
"$ref": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/uniques.json",
"minItems": 1
},
"conditions": {
"$ref": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/uniques.json"
}
},
"required": ["text", "triggeredUniques"],
"additionalProperties": false
}
}
},
"required": [
"name", "text"
],
"additionalProperties": false
}
}