Added 'city addbuilding', 'city removebuilding' console commands

This commit is contained in:
Yair Morgenstern 2024-02-27 13:22:10 +02:00
parent 3689eed3aa
commit 27d63f00f4
4 changed files with 19 additions and 3 deletions

View File

@ -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"
},

View File

@ -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
},
)
}

View File

@ -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)

View File

@ -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