Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recycling center #5738

Merged
merged 13 commits into from
Dec 3, 2021
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
181 changes: 94 additions & 87 deletions android/assets/Construction.atlas

Large diffs are not rendered by default.

Binary file modified android/assets/Construction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions android/assets/jsons/Civ V - Gods & Kings/Buildings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,12 @@
"requiredTech": "Ecology",
"uniques": ["Must be next to [Desert]", "Cannot be built with [Nuclear Plant]"]
},
{
"name": "Recycling Center",
"maintenance": 3,
"requiredTech": "Ecology",
"uniques": ["Provides [2] [Aluminum]","Can have [5] of this building in your empire at most"]
itanasi marked this conversation as resolved.
Show resolved Hide resolved
},
{
"name": "Sydney Opera House",
"isWonder": true,
Expand Down
2 changes: 1 addition & 1 deletion core/src/com/unciv/logic/city/CityInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class CityInfo {
cityResources.add(resource, -amount, "Buildings")
}
}

for (unique in getLocalMatchingUniques(UniqueType.ProvidesResources)) { // E.G "Provides [1] [Iron]"
if (!unique.conditionalsApply(civInfo, this)) continue
val resource = getRuleset().tileResources[unique.params[1]]
Expand Down
4 changes: 3 additions & 1 deletion core/src/com/unciv/logic/city/IConstruction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ class RejectionReasons: HashSet<RejectionReason>() {
RejectionReason.RequiresBuildingInSomeCity,
RejectionReason.PopulationRequirement,
RejectionReason.ConsumesResources,
RejectionReason.CanOnlyBePurchased
RejectionReason.CanOnlyBePurchased,
RejectionReason.MaxNumberBuilding
)
}
}
Expand All @@ -142,6 +143,7 @@ enum class RejectionReason(val shouldShow: Boolean, var errorMessage: String) {
MustOwnTile(false, "Must own a specific tile close by"),
WaterUnitsInCoastalCities(false, "May only built water units in coastal cities"),
CanOnlyBeBuiltInSpecificCities(false, "Can only be built in specific cities"),
MaxNumberBuilding(true, "Maximum number being built"),

UniqueToOtherNation(false, "Unique to another nation"),
ReplacedByOurUnique(false, "Our unique replaces this"),
Expand Down
15 changes: 15 additions & 0 deletions core/src/com/unciv/models/ruleset/Building.kt
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
override fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean {
if (cityConstructions.isBeingConstructedOrEnqueued(name))
return false
if (hasUnique(UniqueType.MaxNumberBuilding)) {
itanasi marked this conversation as resolved.
Show resolved Hide resolved
for (unique in getMatchingUniques(UniqueType.MaxNumberBuilding)){
if (cityConstructions.cityInfo.civInfo.cities.count{it.cityConstructions.containsBuildingOrEquivalent(name)}>=unique.params[0].toInt())
return false
}
}
val rejectionReasons = getRejectionReasons(cityConstructions)
return rejectionReasons.none { !it.shouldShow }
|| (
Expand Down Expand Up @@ -539,6 +545,15 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
UniqueType.HiddenWithoutReligion.text ->
if (!civInfo.gameInfo.isReligionEnabled())
rejectionReasons.add(RejectionReason.DisabledBySetting)

UniqueType.MaxNumberBuilding.placeholderText ->
if (civInfo.cities.count {
it.cityConstructions.containsBuildingOrEquivalent(name) ||
it.cityConstructions.isBeingConstructedOrEnqueued(name)
}
>= unique.params[0].toInt()) {
rejectionReasons.add(RejectionReason.MaxNumberBuilding)
}
}
}

Expand Down
1 change: 1 addition & 0 deletions core/src/com/unciv/models/ruleset/unique/UniqueType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags:
CostIncreasesPerCity("Cost increases by [amount] per owned city", UniqueTarget.Building),
CannotBeBuiltWith("Cannot be built with [buildingName]", UniqueTarget.Building),
RequiresAnotherBuilding("Requires a [buildingName] in this city", UniqueTarget.Building),
MaxNumberBuilding("Can have [amount] of this building in your empire at most", UniqueTarget.Building),

NotDisplayedWithout("Not displayed as an available construction without [buildingName/tech/resource/policy]", UniqueTarget.Building, UniqueTarget.Unit),
//UniqueType added in 3.18.4
Expand Down
1 change: 1 addition & 0 deletions docs/Credits.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [Chemistry](https://thenounproject.com/term/chemistry/175847/) By Creative Stall for Medical Lab
* [Pentagon](https://thenounproject.com/search/?q=the%20pentagon&i=1788323) By Maxim Kulikov
* [Solar panel](https://thenounproject.com/term/solar-panel/1131/) By Modik for Solar Plant
* [Recycle](https://thenounproject.com/search/?q=recycling&i=4397434) By Umer Younas, PK for Recycling Center
* [Opera House Sydney](https://thenounproject.com/term/opera-house-sydney/1626283/) By Pham Duy Phuong Hung for Sydney Opera House
* [Water dam](https://thenounproject.com/term/water-dam/1002726/) By Symbolon for Hydro Plant
* [Manhattan Project](https://thenounproject.com/search/?q=Nuclear%20Bomb&i=2041074) By corpus delicti, GR
Expand Down