mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-24 13:52:45 +00:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user