Restore theater ground objects to full health when repairing via UI (#3506)

This commit is contained in:
zhexu14 2025-06-07 21:47:04 +10:00 committed by GitHub
parent 43be243711
commit 3ed1f20233
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -9,6 +9,7 @@ Saves from 13.x are not compatible with 14.0.0.
## Fixes
* **[UI]** Air Wing and Transfers buttons disabled when no game is loaded as pressing them without a game loaded resulted in a crash.
* **[UI]** Units are restored to full health when repaired.
# 13.0.0

View File

@ -23,6 +23,7 @@ from game.theater import ControlPoint, TheaterGroundObject
from game.theater.theatergroundobject import (
BuildingGroundObject,
)
from game.theater.theatergroup import TheaterUnit
from game.utils import Heading
from qt_ui.uiconstants import EVENT_ICONS, ICONS
from qt_ui.widgets.QBudgetBox import QBudgetBox
@ -229,10 +230,11 @@ class QGroundObjectMenu(QDialog):
if self.sell_all_button is not None:
self.sell_all_button.setText("Disband (+$" + str(self.total_value) + "M)")
def repair_unit(self, unit, price):
def repair_unit(self, unit: TheaterUnit, price: float):
if self.game.blue.budget > price:
self.game.blue.budget -= price
unit.alive = True
unit.hit_points = unit.unit_type.hit_points # Restore unit health to full
GameUpdateSignal.get_instance().updateGame(self.game)
# Remove destroyed units in the vicinity