Fix nuke telegraph for allies (#2983)

## Description:

Adds back the nuke overlay for teammates

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Mr. Box
This commit is contained in:
Vivacious Box
2026-01-22 00:13:55 +01:00
committed by GitHub
parent fc5eec5fc0
commit ee4b91a422
+13 -7
View File
@@ -116,14 +116,25 @@ export class DynamicUILayer implements Layer {
}
onBombEvent(unit: UnitView) {
if (this.createdThisTick(unit) && this.isOwnedByPlayer(unit)) {
const myPlayer = this.game.myPlayer();
if (!myPlayer) {
return;
}
if (
this.createdThisTick(unit) &&
(unit.owner() === myPlayer || unit.owner().isOnSameTeam(myPlayer))
) {
const target = new NukeTelegraph(this.transformHandler, this.game, unit);
this.uiElements.push(target);
}
}
onTransportShipEvent(unit: UnitView) {
if (this.createdThisTick(unit) && this.isOwnedByPlayer(unit)) {
const myPlayer = this.game.myPlayer();
if (!myPlayer) {
return;
}
if (this.createdThisTick(unit) && unit.owner() === myPlayer) {
const target = new NavalTarget(this.transformHandler, this.game, unit);
this.uiElements.push(target);
}
@@ -146,11 +157,6 @@ export class DynamicUILayer implements Layer {
}
}
private isOwnedByPlayer(unit: UnitView): boolean {
const my = this.game.myPlayer();
return my !== null && unit.owner() === my;
}
private createdThisTick(unit: UnitView): boolean {
return unit.createdAt() === this.game.ticks();
}