mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:50:43 +00:00
don't display unit deleted message when tranpsort ship lands
This commit is contained in:
@@ -230,9 +230,14 @@
|
||||
* only check islands/clusters when being attacked DONE 12/10/2024
|
||||
* only calculate name if tile changes DONE 12/10/2024
|
||||
* store in BigQuery DONE 12/10/2024
|
||||
* remove dash from game id DONE 12/11/2024
|
||||
* bug: transport display event when it lands DONE 12/11/2024
|
||||
* bug: name not updating location in spawn phase
|
||||
* have crash print stacktrace
|
||||
* allow longer names and allow them to be displayed in the Rank UI not be cut
|
||||
* make boats work on lakes (& oceania)
|
||||
* record game winner
|
||||
* record player ip in bigquery
|
||||
* add panama canal NA
|
||||
* repaint canvas after tab away to prevent blank screen
|
||||
* on mobile can't click away from build menu
|
||||
@@ -241,7 +246,6 @@
|
||||
* remove alliance when player dies
|
||||
* put delay on adjust troop ratio to reduce number of messages
|
||||
* make clientID & playerID smaller
|
||||
* remove dash from game id
|
||||
* pause button in single player
|
||||
* when hovering over another player have the name not appear ontop of the exit cross
|
||||
* have a visual thing of who your attacking and how many boats you sent
|
||||
|
||||
+4
-3
@@ -6,7 +6,7 @@ import DOMPurify from 'dompurify';
|
||||
import { Cell, Game, Player, TerraNullius, Tile, Unit } from "./game/Game";
|
||||
import { number } from 'zod';
|
||||
import { GameConfig, GameID, GameRecord, Turn } from './Schemas';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { customAlphabet, nanoid } from 'nanoid';
|
||||
|
||||
export function manhattanDist(c1: Cell, c2: Cell): number {
|
||||
return Math.abs(c1.x - c2.x) + Math.abs(c1.y - c2.y);
|
||||
@@ -262,6 +262,7 @@ export function assertNever(x: never): never {
|
||||
throw new Error('Unexpected value: ' + x);
|
||||
}
|
||||
|
||||
export function generateGameID(): string {
|
||||
return nanoid(8)
|
||||
export function generateGameID(): GameID {
|
||||
const nanoid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 8)
|
||||
return nanoid()
|
||||
}
|
||||
@@ -8,16 +8,13 @@ export const devConfig = new class extends DefaultConfig {
|
||||
info.cost = (p: Player) => oldCost(p) / 1000000
|
||||
return info
|
||||
}
|
||||
maxUnitCost(): number {
|
||||
return 10000
|
||||
}
|
||||
|
||||
percentageTilesOwnedToWin(): number {
|
||||
return 95
|
||||
}
|
||||
numSpawnPhaseTurns(gameType: GameType): number {
|
||||
return 40
|
||||
// return 100
|
||||
// return 40
|
||||
return 1000
|
||||
}
|
||||
gameCreationRate(): number {
|
||||
return 10 * 1000
|
||||
@@ -25,12 +22,9 @@ export const devConfig = new class extends DefaultConfig {
|
||||
lobbyLifetime(): number {
|
||||
return 10 * 1000
|
||||
}
|
||||
turnIntervalMs(): number {
|
||||
return 100
|
||||
}
|
||||
tradeShipSpawnRate(): number {
|
||||
return 10
|
||||
}
|
||||
// tradeShipSpawnRate(): number {
|
||||
// return 10
|
||||
// }
|
||||
boatMaxDistance(): number {
|
||||
return 5000
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ export class NukeExecution implements Execution {
|
||||
// .filter(b => euclideanDist(this.cell, b.tile().cell()) < this.magnitude + 50)
|
||||
// .forEach(b => b.delete())
|
||||
this.active = false
|
||||
this.nuke.delete()
|
||||
this.nuke.delete(false)
|
||||
}
|
||||
|
||||
owner(): MutablePlayer {
|
||||
|
||||
@@ -102,7 +102,7 @@ export class TransportShipExecution implements Execution {
|
||||
case PathFindResultType.Completed:
|
||||
if (this.dst.owner() == this.attacker) {
|
||||
this.attacker.addTroops(this.troops)
|
||||
this.boat.delete()
|
||||
this.boat.delete(false)
|
||||
this.active = false
|
||||
return
|
||||
}
|
||||
@@ -114,7 +114,7 @@ export class TransportShipExecution implements Execution {
|
||||
new AttackExecution(this.troops, this.attacker.id(), this.targetID, this.dst.cell(), null, false)
|
||||
)
|
||||
}
|
||||
this.boat.delete()
|
||||
this.boat.delete(false)
|
||||
this.active = false
|
||||
return
|
||||
case PathFindResultType.NextTile:
|
||||
@@ -125,7 +125,7 @@ export class TransportShipExecution implements Execution {
|
||||
case PathFindResultType.PathNotFound:
|
||||
// TODO: add to poisoned port list
|
||||
console.warn(`path not found tot dst`)
|
||||
this.boat.delete()
|
||||
this.boat.delete(false)
|
||||
this.active = false
|
||||
return
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ export interface MutableUnit extends Unit {
|
||||
move(tile: Tile): void
|
||||
owner(): MutablePlayer
|
||||
setTroops(troops: number): void
|
||||
delete(): void
|
||||
delete(displayerMessage?: boolean): void
|
||||
}
|
||||
|
||||
export interface TerraNullius {
|
||||
|
||||
@@ -57,14 +57,14 @@ export class UnitImpl implements MutableUnit {
|
||||
)
|
||||
}
|
||||
|
||||
delete(): void {
|
||||
delete(displayMessage: boolean = true): void {
|
||||
if (!this.isActive()) {
|
||||
throw new Error(`cannot delete ${this} not active`)
|
||||
}
|
||||
this._owner._units = this._owner._units.filter(b => b != this);
|
||||
this._active = false;
|
||||
this.g.fireUnitUpdateEvent(this, this._tile);
|
||||
if (this.type() != UnitType.AtomBomb && this.type() != UnitType.HydrogenBomb) {
|
||||
if (displayMessage) {
|
||||
this.g.displayMessage(`Your ${this.type()} was destroyed`, MessageType.ERROR, this.owner().id())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user