mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-03 14:15:15 +07:00
Can build mods without workers
This commit is contained in:
parent
95fd51acc5
commit
5d95356e0f
@ -119,6 +119,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
|
||||
}
|
||||
|
||||
private fun addWorkerChoice() {
|
||||
if(!civInfo.gameInfo.ruleSet.units.containsKey(Constants.worker)) return // for mods
|
||||
if(civInfo.getIdleUnits().any { it.name==Constants.worker && it.action== Constants.unitActionAutomation})
|
||||
return // If we have automated workers who have no work to do then it's silly to construct new workers.
|
||||
|
||||
|
@ -443,7 +443,7 @@ object NextTurnAutomation{
|
||||
city.annexCity()
|
||||
}
|
||||
|
||||
city.reassignWorkers()
|
||||
city.reassignPopulation()
|
||||
|
||||
city.cityConstructions.chooseNextConstruction()
|
||||
if (city.health < city.getMaxHealth())
|
||||
|
@ -177,7 +177,7 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
private fun chooseImprovement(tile: TileInfo, civInfo: CivilizationInfo): TileImprovement? {
|
||||
val improvementStringForResource : String ?= when {
|
||||
tile.resource == null || !tile.hasViewableResource(civInfo) -> null
|
||||
tile.terrainFeature == "Marsh" && !isImprovementOnFeatureAllowed(tile,civInfo) -> "Remove Marsh"
|
||||
tile.terrainFeature == Constants.marsh && !isImprovementOnFeatureAllowed(tile,civInfo) -> "Remove Marsh"
|
||||
tile.terrainFeature == "Fallout" && !isImprovementOnFeatureAllowed(tile,civInfo) -> "Remove Fallout" // for really mad modders
|
||||
tile.terrainFeature == Constants.jungle && !isImprovementOnFeatureAllowed(tile,civInfo) -> "Remove Jungle"
|
||||
tile.terrainFeature == Constants.forest && !isImprovementOnFeatureAllowed(tile,civInfo) -> "Remove Forest"
|
||||
@ -200,7 +200,7 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
uniqueImprovement!=null && tile.canBuildImprovement(uniqueImprovement,civInfo) -> uniqueImprovement.name
|
||||
|
||||
tile.terrainFeature == "Fallout" -> "Remove Fallout"
|
||||
tile.terrainFeature == "Marsh" -> "Remove Marsh"
|
||||
tile.terrainFeature == Constants.marsh -> "Remove Marsh"
|
||||
tile.terrainFeature == Constants.jungle -> "Trading post"
|
||||
tile.terrainFeature == "Oasis" -> null
|
||||
tile.terrainFeature == Constants.forest -> "Lumber mill"
|
||||
|
@ -88,7 +88,6 @@ class CityInfo {
|
||||
|
||||
if (civInfo.cities.size == 1) {
|
||||
cityConstructions.addBuilding("Palace")
|
||||
cityConstructions.currentConstructionFromQueue = Constants.worker // Default for first city only!
|
||||
}
|
||||
|
||||
civInfo.policies.tryAddLegalismBuildings()
|
||||
@ -99,7 +98,7 @@ class CityInfo {
|
||||
|
||||
tryUpdateRoadStatus()
|
||||
|
||||
if (listOf(Constants.forest, Constants.jungle, "Marsh").contains(tile.terrainFeature))
|
||||
if (getRuleset().tileImprovements.containsKey("Remove "+tile.terrainFeature))
|
||||
tile.terrainFeature = null
|
||||
|
||||
workedTiles = hashSetOf() //reassign 1st working tile
|
||||
@ -308,10 +307,10 @@ class CityInfo {
|
||||
attackedThisTurn = false
|
||||
if (isInResistance()) resistanceCounter--
|
||||
|
||||
if (isPuppet) reassignWorkers()
|
||||
if (isPuppet) reassignPopulation()
|
||||
}
|
||||
|
||||
fun reassignWorkers() {
|
||||
fun reassignPopulation() {
|
||||
var foodWeight = 1f
|
||||
var foodPerTurn = 0f
|
||||
while (foodWeight < 3 && foodPerTurn <= 0) {
|
||||
@ -394,7 +393,7 @@ class CityInfo {
|
||||
|
||||
|
||||
if(population.population>1) population.population -= 1 + population.population/4 // so from 2-4 population, remove 1, from 5-8, remove 2, etc.
|
||||
reassignWorkers()
|
||||
reassignPopulation()
|
||||
|
||||
resistanceCounter = population.population // I checked, and even if you puppet there's resistance for conquering
|
||||
isPuppet = true
|
||||
@ -446,7 +445,7 @@ class CityInfo {
|
||||
moveToCiv(foundingCiv)
|
||||
health = getMaxHealth() / 2 // I think that cities recover to half health when conquered?
|
||||
|
||||
reassignWorkers()
|
||||
reassignPopulation()
|
||||
|
||||
if(foundingCiv.cities.size == 1) cityConstructions.addBuilding("Palace") // Resurrection!
|
||||
isPuppet = false
|
||||
|
Loading…
Reference in New Issue
Block a user