From 27d63f00f4338417e659eb0cf9be70d4a2e7827b Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 27 Feb 2024 13:22:10 +0200 Subject: [PATCH] Added 'city addbuilding', 'city removebuilding' console commands --- .../jsons/Civ V - Gods & Kings/Buildings.json | 2 +- .../ui/screens/devconsole/ConsoleCityCommands.kt | 15 +++++++++++++++ .../ui/screens/devconsole/DevConsoleCommand.kt | 1 + docs/Modders/uniques.md | 4 ++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/android/assets/jsons/Civ V - Gods & Kings/Buildings.json b/android/assets/jsons/Civ V - Gods & Kings/Buildings.json index c1520fcb8e..57012f79ab 100644 --- a/android/assets/jsons/Civ V - Gods & Kings/Buildings.json +++ b/android/assets/jsons/Civ V - Gods & Kings/Buildings.json @@ -498,7 +498,7 @@ "greatPersonPoints": {"Great Merchant": 1}, "culture": 1, "isWonder": true, - "uniques": ["[+25]% [Gold] from Trade Routes","Must have an owned [Mountain] within [2] tiles"], + "uniques": ["[+25]% [Gold] from Trade Routes", "Must have an owned [Mountain] within [2] tiles"], "requiredTech": "Guilds", "quote": "'Few romances can ever surpass that of the granite citadel on top of the beetling precipices of Machu Picchu, the crown of Inca Land.' - Hiram Bingham" }, diff --git a/core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt b/core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt index 29f5fcfb50..1ef29a976e 100644 --- a/core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt +++ b/core/src/com/unciv/ui/screens/devconsole/ConsoleCityCommands.kt @@ -69,5 +69,20 @@ class ConsoleCityCommands : ConsoleCommandNode { city.health = health DevConsoleResponse.OK }, + + "addbuilding" to ConsoleAction("city addbuilding [buildingName]") { console, params -> + val city = console.getSelectedCity() + val building = console.gameInfo.ruleset.buildings.values + .firstOrNull { it.name.toCliInput() == params[0] } ?: throw ConsoleErrorException("Unknown building") + city.cityConstructions.addBuilding(building) + DevConsoleResponse.OK + }, + "removebuilding" to ConsoleAction("city removebuilding [buildingName]") { console, params -> + val city = console.getSelectedCity() + val building = console.gameInfo.ruleset.buildings.values + .firstOrNull { it.name.toCliInput() == params[0] } ?: throw ConsoleErrorException("Unknown building") + city.cityConstructions.removeBuilding(building) + DevConsoleResponse.OK + }, ) } diff --git a/core/src/com/unciv/ui/screens/devconsole/DevConsoleCommand.kt b/core/src/com/unciv/ui/screens/devconsole/DevConsoleCommand.kt index 851933e340..d84bf76f4a 100644 --- a/core/src/com/unciv/ui/screens/devconsole/DevConsoleCommand.kt +++ b/core/src/com/unciv/ui/screens/devconsole/DevConsoleCommand.kt @@ -75,6 +75,7 @@ open class ConsoleAction(val format: String, val action: (console: DevConsolePop "resourceName" -> console.gameInfo.ruleset.tileResources.keys "stat" -> Stat.names() "religionName" -> console.gameInfo.religions.keys + "buildingName" -> console.gameInfo.ruleset.buildings.keys else -> listOf() } return getAutocompleteString(lastParam, options) diff --git a/docs/Modders/uniques.md b/docs/Modders/uniques.md index 56fb5306df..d4f63e4fb0 100644 --- a/docs/Modders/uniques.md +++ b/docs/Modders/uniques.md @@ -1070,9 +1070,9 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl Applicable to: Building, Unit -??? example "[amount]% Cost" +??? example "[amount]% production cost" Intended to be used with conditionals to dynamically alter construction costs - Example: "[3]% Cost" + Example: "[3]% production cost" Applicable to: Building, Unit