Added "checkfilter" console commands for city, tile, and unit, for easy mod checking

This commit is contained in:
Yair Morgenstern 2024-04-28 14:25:26 +03:00
parent e78a1e9497
commit 2df8a405c7
4 changed files with 21 additions and 0 deletions

View File

@ -3,6 +3,11 @@ package com.unciv.ui.screens.devconsole
class ConsoleCityCommands : ConsoleCommandNode {
override val subcommands = hashMapOf<String, ConsoleCommand>(
"checkfilter" to ConsoleAction("city checkfilter <cityFilter>") { console, params ->
val city = console.getSelectedCity()
DevConsoleResponse.hint(city.matchesFilter(params[0]).toString())
},
"add" to ConsoleAction("city add <civName>") { console, params ->
val civ = console.getCivByName(params[0])
val selectedTile = console.getSelectedTile()

View File

@ -13,6 +13,11 @@ class ConsoleTileCommands: ConsoleCommandNode {
override val subcommands = hashMapOf<String, ConsoleCommand>(
"checkfilter" to ConsoleAction("tile checkfilter <tileFilter>") { console, params ->
val selectedTile = console.getSelectedTile()
DevConsoleResponse.hint(selectedTile.matchesFilter(params[0]).toString())
},
"setimprovement" to ConsoleAction("tile setimprovement <improvementName> [civName]") { console, params ->
val selectedTile = console.getSelectedTile()
val improvement = console.gameInfo.ruleset.tileImprovements.values.findCliInput(params[0])

View File

@ -3,6 +3,11 @@ package com.unciv.ui.screens.devconsole
class ConsoleUnitCommands : ConsoleCommandNode {
override val subcommands = hashMapOf<String, ConsoleCommand>(
"checkfilter" to ConsoleAction("unit checkfilter <unitFilter>") { console, params ->
val unit = console.getSelectedUnit()
DevConsoleResponse.hint(unit.matchesFilter(params[0]).toString())
},
"add" to ConsoleAction("unit add <civName> <unitName>") { console, params ->
val selectedTile = console.getSelectedTile()
val civ = console.getCivByName(params[0])

View File

@ -88,6 +88,8 @@ This indicates a unit as placed on the map. Compare with `baseUnitFilter`.
- `Barbarians`, `Barbarian`
- Again, any combination of the above is also allowed, e.g. `[{Wounded} {Water}]` units.
You can check this in-game using the console with the `unit checkfilter <filter>` command
## buildingFilter
Allows to only activate a unique for certain buildings. Allowed options are:
@ -135,6 +137,8 @@ cityFilters allow us to choose the range of cities affected by this unique:
- `in all cities in which the majority religion is an enhanced religion`
- [civFilter]
You can check this in-game using the console with the `city checkfilter <filter>` command
## improvementFilter
For filtering a specific improvement.
@ -265,6 +269,8 @@ Any of:
- `Improvement` or `improved` for tiles with any improvements
- `unimproved` for tiles with no improvement
You can check this in-game using the console with the `tile checkfilter <filter>` command
## terrainQuality
Used to indicate for what use the terrain should be viewed when dividing the world into regions, in each of which a single player is placed at the start of the game.