diff --git a/android/assets/jsons/Translations/Other.json b/android/assets/jsons/Translations/Other.json index 5ee6958a7c..4112d19162 100644 --- a/android/assets/jsons/Translations/Other.json +++ b/android/assets/jsons/Translations/Other.json @@ -266,7 +266,11 @@ Simplified_Chinese:"架设" Portuguese:"Montar" Japanese:"セットアップ" - } + }, + + "Pack up": { // For siege units + "German": "Einpacken" + }, "Upgrade to [unitType] ([goldCost] gold)":{ // EG Upgrade to Cannon (140 gold) Italian:"Aggiorna a [unitType] ([goldCost] oro)" diff --git a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt index b6add32cb0..0f0c95ac80 100644 --- a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt @@ -78,7 +78,8 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: val selectedUnit = worldScreen.bottomBar.unitTable.selectedUnit if (selectedUnit != null && selectedUnit.getTile() != tileInfo - && selectedUnit.canMoveTo(tileInfo) && selectedUnit.movementAlgs().canReach(tileInfo)) { + && selectedUnit.canMoveTo(tileInfo) && selectedUnit.movementAlgs().canReach(tileInfo) + && selectedUnit.action!="Set Up") { // this can take a long time, because of the unit-to-tile calculation needed, so we put it in a different thread queueAddMoveHereButton(selectedUnit, tileInfo) } @@ -207,8 +208,12 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: } private fun updateTilegroupsForSelectedUnit(unit: MapUnit, playerViewableTilePositions: HashSet) { + tileGroups[unit.getTile()]!!.selectUnit(unit) + // units set up can't move unless packed together + if(unit.action=="Set Up") return + for (tile: TileInfo in unit.getDistanceToTiles().keys) if (unit.canMoveTo(tile)) tileGroups[tile]!!.showCircle(colorFromRGB(0, 120, 215)) diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt index 653d592cb9..8ccca291b1 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt @@ -124,14 +124,23 @@ class UnitActions { if(unit.hasUnique("Must set up to ranged attack") && !unit.isEmbarked()) { val setUp = unit.action == "Set Up" - actionList+=UnitAction("Set up", unit.currentMovement >0 && !setUp, currentAction = setUp ) { - unit.action="Set Up" - // setting up uses up all movement points - // this is to avoid problems with the idle state: - // - unit should not be idle when setting up right now - // - unit should be idle when set up in the past - unit.currentMovement=0f - }.sound("setup") + if(!setUp) { + actionList += UnitAction("Set up", unit.currentMovement > 0) { + unit.action = "Set Up" + // setting up uses up all movement points + // this is to avoid problems with the idle state: + // - unit should not be idle when setting up right now + // - unit should be idle when set up in the past + unit.currentMovement = 0f + unitTable.selectedUnit = null + }.sound("setup") + } + else { + actionList += UnitAction("Pack up", true) { + // packing together does not take any movement points + unit.action = null + }.sound("setup") + } } if (unit.hasUnique("Founds a new city") && !unit.isEmbarked()) { diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt index 0c722463ab..93d5ae72a3 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt @@ -44,6 +44,7 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table(){ "Conduct Trade Mission" -> return ImageGetter.getUnitIcon("Great Merchant") "Construct Customs House" -> return ImageGetter.getImprovementIcon("Customs house") "Set up" -> return ImageGetter.getUnitIcon("Catapult") + "Pack up" -> return ImageGetter.getUnitIcon("Catapult") "Disband unit" -> return ImageGetter.getImage("OtherIcons/DisbandUnit") "Sleep" -> return ImageGetter.getImage("OtherIcons/Sleep") "Explore" -> return ImageGetter.getUnitIcon("Scout")