update unit position in UnitGrid when units move

This commit is contained in:
Evan
2025-04-06 15:13:45 -07:00
parent 15c2cc192f
commit add27fd5d9
2 changed files with 7 additions and 5 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
import { GameType, UnitInfo, UnitType } from "../game/Game"; import { UnitInfo, UnitType } from "../game/Game";
import { UserSettings } from "../game/UserSettings"; import { UserSettings } from "../game/UserSettings";
import { GameConfig } from "../Schemas"; import { GameConfig } from "../Schemas";
import { GameEnv, ServerConfig } from "./Config"; import { GameEnv, ServerConfig } from "./Config";
@@ -40,10 +40,10 @@ export class DevConfig extends DefaultConfig {
super(sc, gc, us); super(sc, gc, us);
} }
numSpawnPhaseTurns(): number { // numSpawnPhaseTurns(): number {
return this.gameConfig().gameType == GameType.Singleplayer ? 70 : 100; // return this.gameConfig().gameType == GameType.Singleplayer ? 70 : 100;
// return 100 // // return 100
} // }
unitInfo(type: UnitType): UnitInfo { unitInfo(type: UnitType): UnitInfo {
const info = super.unitInfo(type); const info = super.unitInfo(type);
+2
View File
@@ -86,6 +86,8 @@ export class UnitImpl implements Unit {
} }
this._lastTile = this._tile; this._lastTile = this._tile;
this._tile = tile; this._tile = tile;
this.mg.removeUnit(this);
this.mg.addUnit(this);
this.mg.addUpdate(this.toUpdate()); this.mg.addUpdate(this.toUpdate());
} }
setTroops(troops: number): void { setTroops(troops: number): void {