1
0
Fork 0

Fixed action icon fading for other actions' overheat

This commit is contained in:
Michaël Lemaire 2017-05-18 23:14:41 +02:00
parent 17bee3a81f
commit 11dd934dff
2 changed files with 6 additions and 6 deletions

View file

@ -170,14 +170,14 @@ module TS.SpaceTac.UI {
*
* *power_usage* is the consumption of currently selected action.
*/
updateSelectedActionPower(power_usage: number): void {
updateSelectedActionPower(power_usage: number, action: BaseAction): void {
var remaining_ap = this.ship ? (this.ship.values.power.get() - power_usage) : 0;
if (remaining_ap < 0) {
remaining_ap = 0;
}
this.action_icons.forEach((icon: ActionIcon) => {
icon.updateFadingStatus(remaining_ap, true);
icon.updateFadingStatus(remaining_ap, action);
});
this.updatePower(power_usage);
}

View file

@ -111,7 +111,7 @@ module TS.SpaceTac.UI {
}
// Update fading statuses
this.bar.updateSelectedActionPower(this.action.getActionPointsUsage(this.ship, null));
this.bar.updateSelectedActionPower(this.action.getActionPointsUsage(this.ship, null), this.action);
// Set the selected state
this.setSelected(true);
@ -143,7 +143,7 @@ module TS.SpaceTac.UI {
if (this.targetting) {
this.targetting.setTarget(correct_target, false, this.action.getBlastRadius(this.ship));
}
this.bar.updateSelectedActionPower(this.action.getActionPointsUsage(this.ship, correct_target));
this.bar.updateSelectedActionPower(this.action.getActionPointsUsage(this.ship, correct_target), this.action);
}
// Called when a target is selected
@ -201,9 +201,9 @@ module TS.SpaceTac.UI {
}
// Update the fading status, given an hypothetical remaining AP
updateFadingStatus(remaining_ap: number, action = false): void {
updateFadingStatus(remaining_ap: number, action: BaseAction | null = null): void {
let old_fading = this.fading;
let overheat = action && (this.action.equipment !== null && this.action.equipment.cooldown.willOverheat());
let overheat = (action == this.action && this.action.equipment !== null && this.action.equipment.cooldown.willOverheat());
this.fading = this.active && (this.action.checkCannotBeApplied(this.ship, remaining_ap) != null || overheat);
if (this.fading != old_fading) {
this.battleview.animations.setVisible(this.layer_active, this.active && !this.fading, 500);