mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:20:45 +00:00
unit upgrade fixes
This commit is contained in:
@@ -133,6 +133,9 @@ export class BuildMenu extends LitElement implements Layer {
|
||||
|
||||
init() {
|
||||
this.eventBus.on(ShowBuildMenuEvent, (e) => {
|
||||
if (!this.game.myPlayer()?.isAlive()) {
|
||||
return;
|
||||
}
|
||||
const clickedCell = this.transformHandler.screenToWorldCoordinates(
|
||||
e.x,
|
||||
e.y,
|
||||
@@ -144,9 +147,6 @@ export class BuildMenu extends LitElement implements Layer {
|
||||
return;
|
||||
}
|
||||
const tile = this.game.ref(clickedCell.x, clickedCell.y);
|
||||
if (!this.game.myPlayer()?.isAlive()) {
|
||||
return;
|
||||
}
|
||||
this.showMenu(tile);
|
||||
});
|
||||
this.eventBus.on(CloseViewEvent, () => this.hideMenu());
|
||||
@@ -383,9 +383,6 @@ export class BuildMenu extends LitElement implements Layer {
|
||||
}
|
||||
|
||||
public sendBuildOrUpgrade(buildableUnit: BuildableUnit, tile: TileRef): void {
|
||||
if (buildableUnit === null) {
|
||||
return;
|
||||
}
|
||||
if (buildableUnit.canUpgrade !== false) {
|
||||
this.eventBus.emit(
|
||||
new SendUpgradeStructureIntentEvent(
|
||||
|
||||
@@ -797,7 +797,7 @@ export class PlayerImpl implements Player {
|
||||
// Returns the existing unit that can be upgraded,
|
||||
// or false if it cannot be upgraded.
|
||||
// New units of the same type can upgrade existing units.
|
||||
// e.g. if a place a new city here, will it upgrade an existing city?
|
||||
// e.g. if a place a new city here, can it upgrade an existing city?
|
||||
private canUpgradeExistingUnit(
|
||||
type: UnitType,
|
||||
targetTile: TileRef,
|
||||
|
||||
Reference in New Issue
Block a user