mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-22 17:56:54 +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:
@@ -544,6 +544,12 @@ export interface Game extends GameMap {
|
||||
type: MessageType,
|
||||
playerID: PlayerID | null,
|
||||
): void;
|
||||
displayIncomingUnit(
|
||||
unitID: number,
|
||||
message: string,
|
||||
type: MessageType,
|
||||
playerID: PlayerID,
|
||||
): void;
|
||||
|
||||
displayChat(
|
||||
message: string,
|
||||
|
||||
@@ -628,6 +628,24 @@ export class GameImpl implements Game {
|
||||
recipient: recipient,
|
||||
});
|
||||
}
|
||||
|
||||
displayIncomingUnit(
|
||||
unitID: number,
|
||||
message: string,
|
||||
type: MessageType,
|
||||
playerID: PlayerID,
|
||||
): void {
|
||||
const id = this.player(playerID).smallID();
|
||||
|
||||
this.addUpdate({
|
||||
type: GameUpdateType.UnitIncoming,
|
||||
unitID: unitID,
|
||||
message: message,
|
||||
messageType: type,
|
||||
playerID: id,
|
||||
});
|
||||
}
|
||||
|
||||
addUnit(u: Unit) {
|
||||
this.unitGrid.addUnit(u);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export enum GameUpdateType {
|
||||
Emoji,
|
||||
Win,
|
||||
Hash,
|
||||
UnitIncoming,
|
||||
}
|
||||
|
||||
export type GameUpdate =
|
||||
@@ -53,7 +54,8 @@ export type GameUpdate =
|
||||
| TargetPlayerUpdate
|
||||
| EmojiUpdate
|
||||
| WinUpdate
|
||||
| HashUpdate;
|
||||
| HashUpdate
|
||||
| UnitIncomingUpdate;
|
||||
|
||||
export interface TileUpdateWrapper {
|
||||
type: GameUpdateType.Tile;
|
||||
@@ -182,3 +184,11 @@ export interface HashUpdate {
|
||||
tick: Tick;
|
||||
hash: number;
|
||||
}
|
||||
|
||||
export interface UnitIncomingUpdate {
|
||||
type: GameUpdateType.UnitIncoming;
|
||||
unitID: number;
|
||||
message: string;
|
||||
messageType: MessageType;
|
||||
playerID: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user