mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-09 05:03:14 +00:00
Feat : focus unit when clicking on warnings in chat (#699)
## Description: Enables you to click on the `Naval invasion incoming from X` or `X - atom bomb inbound` messages to focus the camera on the incoming unit (boat or nuke). Works for boats, atom bombs, hydrogen bombs and MIRVs. Nothing changes in looks, only the fact that the messages are clickable. closes #641 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: leo21_
This commit is contained in:
@@ -81,7 +81,8 @@ export class MirvExecution implements Execution {
|
||||
this.separateDst = this.mg.ref(x, y);
|
||||
this.pathFinder.computeControlPoints(spawn, this.separateDst);
|
||||
|
||||
this.mg.displayMessage(
|
||||
this.mg.displayIncomingUnit(
|
||||
this.nuke.id(),
|
||||
`⚠️⚠️⚠️ ${this.player.name()} - MIRV INBOUND ⚠️⚠️⚠️`,
|
||||
MessageType.ERROR,
|
||||
this.targetPlayer.id(),
|
||||
|
||||
@@ -106,14 +106,16 @@ export class NukeExecution implements Execution {
|
||||
if (this.mg.hasOwner(this.dst)) {
|
||||
const target = this.mg.owner(this.dst) as Player;
|
||||
if (this.type == UnitType.AtomBomb) {
|
||||
this.mg.displayMessage(
|
||||
this.mg.displayIncomingUnit(
|
||||
this.nuke.id(),
|
||||
`${this.player.name()} - atom bomb inbound`,
|
||||
MessageType.ERROR,
|
||||
target.id(),
|
||||
);
|
||||
}
|
||||
if (this.type == UnitType.HydrogenBomb) {
|
||||
this.mg.displayMessage(
|
||||
this.mg.displayIncomingUnit(
|
||||
this.nuke.id(),
|
||||
`${this.player.name()} - hydrogen bomb inbound`,
|
||||
MessageType.ERROR,
|
||||
target.id(),
|
||||
@@ -129,7 +131,7 @@ export class NukeExecution implements Execution {
|
||||
);
|
||||
}
|
||||
|
||||
// after sending an nuke set the missilesilo on cooldown
|
||||
// after sending a nuke set the missilesilo on cooldown
|
||||
const silo = this.player
|
||||
.units(UnitType.MissileSilo)
|
||||
.find((silo) => silo.tile() === spawn);
|
||||
|
||||
@@ -67,15 +67,6 @@ export class TransportShipExecution implements Execution {
|
||||
|
||||
this.attacker = mg.player(this.attackerID);
|
||||
|
||||
// Notify the target player about the incoming naval invasion
|
||||
if (this.targetID && this.targetID !== mg.terraNullius().id()) {
|
||||
mg.displayMessage(
|
||||
`Naval invasion incoming from ${this.attacker.displayName()}`,
|
||||
MessageType.WARN,
|
||||
this.targetID,
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
this.attacker.units(UnitType.TransportShip).length >=
|
||||
mg.config().boatMaxNumber()
|
||||
@@ -142,6 +133,16 @@ export class TransportShipExecution implements Execution {
|
||||
this.boat = this.attacker.buildUnit(UnitType.TransportShip, this.src, {
|
||||
troops: this.troops,
|
||||
});
|
||||
|
||||
// Notify the target player about the incoming naval invasion
|
||||
if (this.targetID && this.targetID !== mg.terraNullius().id()) {
|
||||
mg.displayIncomingUnit(
|
||||
this.boat.id(),
|
||||
`Naval invasion incoming from ${this.attacker.displayName()}`,
|
||||
MessageType.WARN,
|
||||
this.targetID,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
tick(ticks: number) {
|
||||
|
||||
Reference in New Issue
Block a user