From 3ed1f202331bd851754268dd9b86c967bfa39b4f Mon Sep 17 00:00:00 2001 From: zhexu14 <64713351+zhexu14@users.noreply.github.com> Date: Sat, 7 Jun 2025 21:47:04 +1000 Subject: [PATCH] Restore theater ground objects to full health when repairing via UI (#3506) --- changelog.md | 1 + qt_ui/windows/groundobject/QGroundObjectMenu.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 129e8c0a..2f7d9732 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/qt_ui/windows/groundobject/QGroundObjectMenu.py b/qt_ui/windows/groundobject/QGroundObjectMenu.py index 09cc9251..ac77bcbd 100644 --- a/qt_ui/windows/groundobject/QGroundObjectMenu.py +++ b/qt_ui/windows/groundobject/QGroundObjectMenu.py @@ -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