Modding: Added validation to event uniques

Fixes tutorial
This commit is contained in:
yairm210 2024-11-01 12:02:36 +02:00
parent 3ef5442c38
commit 42eb0fb040
3 changed files with 15 additions and 9 deletions

View File

@ -8,7 +8,7 @@
{"text":"Click on a unit Click on a destination Click the arrow popup."}, {"text":"Click on a unit Click on a destination Click the arrow popup."},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [Units] is greater than [0]>", "Only available <if tutorials are enabled> <when number of [Units] is more than [0]>",
"Unavailable <if tutorial [Move unit] is completed>" "Unavailable <if tutorial [Move unit] is completed>"
] ]
}, },
@ -21,7 +21,7 @@
{"text":"Select the Settler → Click on 'Found city'."}, {"text":"Select the Settler → Click on 'Found city'."},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [Settler] is greater than [0]>", "Only available <if tutorials are enabled> <when number of [[Settler] Units] is more than [0]>",
"Unavailable <if tutorial [Found city] is completed>" "Unavailable <if tutorial [Found city] is completed>"
] ]
}, },
@ -34,7 +34,7 @@
{"text":"Click the city button twice."}, {"text":"Click the city button twice."},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [Cities] is greater than [0]>", "Only available <if tutorials are enabled> <when number of [Cities] is more than [0]>",
"Unavailable <if tutorial [Enter city screen] is completed>" "Unavailable <if tutorial [Enter city screen] is completed>"
] ]
}, },
@ -60,7 +60,7 @@
{"text":"Enter city screen → Click on a unit or building → Click 'add to queue'."}, {"text":"Enter city screen → Click on a unit or building → Click 'add to queue'."},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [Cities] is greater than [0]>", "Only available <if tutorials are enabled> <when number of [Cities] is more than [0]>",
"Unavailable <if tutorial [Pick construction] is completed>" "Unavailable <if tutorial [Pick construction] is completed>"
] ]
}, },
@ -86,7 +86,7 @@
{"text":"Enter city screen → Click the assigned tile to unassign → Click an unassigned tile to assign population."}, {"text":"Enter city screen → Click the assigned tile to unassign → Click an unassigned tile to assign population."},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [Cities] is greater than [0]>", "Only available <if tutorials are enabled> <when number of [Cities] is more than [0]>",
"Unavailable <if tutorial [Reassign worked tiles] is completed>" "Unavailable <if tutorial [Reassign worked tiles] is completed>"
] ]
}, },
@ -99,7 +99,7 @@
{"text":"Explore the map until you encounter another civilization!"}, {"text":"Explore the map until you encounter another civilization!"},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [turns] is greater than [1]>", "Only available <if tutorials are enabled> <when number of [turns] is more than [1]>",
"Unavailable <if tutorial [Meet another civilization] is completed>" "Unavailable <if tutorial [Meet another civilization] is completed>"
], ],
"choices": [ "choices": [
@ -131,7 +131,7 @@
{"text":"Construct a Worker unit → Move it to a Plains or Grassland tile → Click 'Construct improvement' → Choose the farm → Leave the worker there until it's finished."}, {"text":"Construct a Worker unit → Move it to a Plains or Grassland tile → Click 'Construct improvement' → Choose the farm → Leave the worker there until it's finished."},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [Cities] is greater than [0]>", "Only available <if tutorials are enabled> <when number of [Cities] is more than [0]>",
"Unavailable <if tutorial [Construct an improvement] is completed>" "Unavailable <if tutorial [Construct an improvement] is completed>"
] ]
}, },
@ -144,7 +144,7 @@
{"text":"Construct roads between your capital and another city. Or, automate your worker and let him get to that eventually."}, {"text":"Construct roads between your capital and another city. Or, automate your worker and let him get to that eventually."},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [Cities] is greater than [1]>", "Only available <if tutorials are enabled> <when number of [Cities] is more than [1]>",
"Unavailable <if tutorial [Create a trade route] is completed>" "Unavailable <if tutorial [Create a trade route] is completed>"
] ]
}, },
@ -170,7 +170,7 @@
{"text":"Select an air unit → Select another city within range → Move the unit to the other city."}, {"text":"Select an air unit → Select another city within range → Move the unit to the other city."},
], ],
"uniques": [ "uniques": [
"Only available <if tutorials are enabled> <when number of [[Air] Units] is greater than [0]>", "Only available <if tutorials are enabled> <when number of [[Air] Units] is more than [0]>",
"Unavailable <if tutorial [Move an air unit] is completed>" "Unavailable <if tutorial [Move an air unit] is completed>"
] ]
}, },

View File

@ -255,6 +255,7 @@ class RulesetValidator(val ruleset: Ruleset) {
uniqueValidator.checkUniques(choice, lines, true, tryFixUnknownUniques) uniqueValidator.checkUniques(choice, lines, true, tryFixUnknownUniques)
} }
uniqueValidator.checkUniques(event, lines, true, tryFixUnknownUniques)
} }
} }

View File

@ -3382,6 +3382,11 @@ If your mod renames Coast or Lakes, do not use this with one of these as paramet
Applicable to: MetaModifier Applicable to: MetaModifier
??? example "&lt;for every adjacent [tileFilter]&gt;"
Example: "&lt;for every adjacent [Farm]&gt;"
Applicable to: MetaModifier
??? example "&lt;for every [amount] [countable]&gt;" ??? example "&lt;for every [amount] [countable]&gt;"
Example: "&lt;for every [3] [1000]&gt;" Example: "&lt;for every [3] [1000]&gt;"