mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Resolved #8628 - modding: conditionally-unbuildable buildings display their cost
This commit is contained in:
parent
1daf76978b
commit
75d7494f89
@ -142,7 +142,8 @@ class CityConstructions : IsPartOfGameInfoSerialization {
|
|||||||
val turnsToConstruction = turnsToConstruction(constructionName, useStoredProduction)
|
val turnsToConstruction = turnsToConstruction(constructionName, useStoredProduction)
|
||||||
val currentProgress = if (useStoredProduction) getWorkDone(constructionName) else 0
|
val currentProgress = if (useStoredProduction) getWorkDone(constructionName) else 0
|
||||||
val lines = ArrayList<String>()
|
val lines = ArrayList<String>()
|
||||||
val buildable = construction.uniqueObjects.none{ it.isOfType(UniqueType.Unbuildable) }
|
val buildable = !construction.getMatchingUniques(UniqueType.Unbuildable)
|
||||||
|
.any { it.conditionalsApply(StateForConditionals(city.civ, city)) }
|
||||||
if (buildable)
|
if (buildable)
|
||||||
lines += (if (currentProgress == 0) "" else "$currentProgress/") +
|
lines += (if (currentProgress == 0) "" else "$currentProgress/") +
|
||||||
"$cost${Fonts.production} $turnsToConstruction${Fonts.turn}"
|
"$cost${Fonts.production} $turnsToConstruction${Fonts.turn}"
|
||||||
|
@ -415,7 +415,7 @@ class Ruleset {
|
|||||||
* */
|
* */
|
||||||
fun updateBuildingCosts() {
|
fun updateBuildingCosts() {
|
||||||
for (building in buildings.values) {
|
for (building in buildings.values) {
|
||||||
if (building.cost == 0 && !building.hasUnique(UniqueType.Unbuildable)) {
|
if (building.cost == 0 && building.getMatchingUniques(UniqueType.Unbuildable).none { it.conditionals.isEmpty() }) {
|
||||||
val column = technologies[building.requiredTech]?.column
|
val column = technologies[building.requiredTech]?.column
|
||||||
?: throw UncivShowableException("Building '[${building.name}]' is buildable and therefore must either have an explicit cost or reference an existing tech.")
|
?: throw UncivShowableException("Building '[${building.name}]' is buildable and therefore must either have an explicit cost or reference an existing tech.")
|
||||||
building.cost = if (building.isAnyWonder()) column.wonderCost else column.buildingCost
|
building.cost = if (building.isAnyWonder()) column.wonderCost else column.buildingCost
|
||||||
|
Loading…
x
Reference in New Issue
Block a user