mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Workers wake up on tile expansion (#11119)
* Workers wake up on tile expansion * Only owned workers will wake up
This commit is contained in:
parent
ccea2c88d3
commit
539db00cb6
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.logic.city.managers
|
package com.unciv.logic.city.managers
|
||||||
|
|
||||||
import com.badlogic.gdx.math.Vector2
|
import com.badlogic.gdx.math.Vector2
|
||||||
|
import com.unciv.Constants
|
||||||
import com.unciv.logic.IsPartOfGameInfoSerialization
|
import com.unciv.logic.IsPartOfGameInfoSerialization
|
||||||
import com.unciv.logic.automation.Automation
|
import com.unciv.logic.automation.Automation
|
||||||
import com.unciv.logic.city.City
|
import com.unciv.logic.city.City
|
||||||
@ -13,6 +14,7 @@ import com.unciv.models.ruleset.unique.UniqueType
|
|||||||
import com.unciv.ui.components.extensions.toPercent
|
import com.unciv.ui.components.extensions.toPercent
|
||||||
import com.unciv.ui.components.extensions.withItem
|
import com.unciv.ui.components.extensions.withItem
|
||||||
import com.unciv.ui.components.extensions.withoutItem
|
import com.unciv.ui.components.extensions.withoutItem
|
||||||
|
import com.unciv.ui.screens.worldscreen.unit.actions.UnitActions
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
@ -184,7 +186,14 @@ class CityExpansionManager : IsPartOfGameInfoSerialization {
|
|||||||
for (unit in tile.getUnits().toList()) // toListed because we're modifying
|
for (unit in tile.getUnits().toList()) // toListed because we're modifying
|
||||||
if (!unit.civ.diplomacyFunctions.canPassThroughTiles(city.civ))
|
if (!unit.civ.diplomacyFunctions.canPassThroughTiles(city.civ))
|
||||||
unit.movement.teleportToClosestMoveableTile()
|
unit.movement.teleportToClosestMoveableTile()
|
||||||
|
else if (unit.civ == city.civ && unit.isSleeping()) {
|
||||||
|
// If the unit is sleeping and is a worker, it might want to build on this tile
|
||||||
|
// So lets try to wake it up for the player to notice it
|
||||||
|
if (unit.cache.hasUniqueToBuildImprovements || unit.cache.hasUniqueToCreateWaterImprovements) {
|
||||||
|
unit.due = true
|
||||||
|
unit.action = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tile.history.recordTakeOwnership(tile)
|
tile.history.recordTakeOwnership(tile)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user