mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-23 12:18:03 +00:00
make place name for efficient during spawn
This commit is contained in:
@@ -4,7 +4,7 @@ import { getConfig } from "./configuration/Config";
|
||||
import { EventBus } from "./EventBus";
|
||||
import { Executor } from "./execution/ExecutionManager";
|
||||
import { WinCheckExecution } from "./execution/WinCheckExecution";
|
||||
import { Cell, DisplayMessageUpdate, Game, GameUpdateType, MessageType, MutableGame, NameViewData, Player, PlayerActions, PlayerID, PlayerProfile, UnitType } from "./game/Game";
|
||||
import { Cell, DisplayMessageUpdate, Game, GameUpdateType, MessageType, MutableGame, NameViewData, Player, PlayerActions, PlayerID, PlayerProfile, PlayerType, UnitType } from "./game/Game";
|
||||
import { createGame } from "./game/GameImpl";
|
||||
import { loadTerrainMap as loadGameMap } from "./game/TerrainMapLoader";
|
||||
import { GameConfig, Turn } from "./Schemas";
|
||||
@@ -62,8 +62,14 @@ export class GameRunner {
|
||||
this.game.addExecution(...this.execManager.createExecs(this.turns[this.currTurn]))
|
||||
this.currTurn++
|
||||
const updates = this.game.executeNextTick()
|
||||
// TODO: make name rendering more efficient in spawn phase.
|
||||
if (this.game.inSpawnPhase() || this.game.ticks() % 30 == 0) {
|
||||
|
||||
if (this.game.inSpawnPhase() && this.game.ticks() % 2 == 0) {
|
||||
this.game.players()
|
||||
.filter(p => p.type() == PlayerType.Human || p.type() == PlayerType.FakeHuman)
|
||||
.forEach(p => this.playerViewData[p.id()] = placeName(this.game, p))
|
||||
}
|
||||
|
||||
if (this.game.ticks() < 3 || this.game.ticks() % 30 == 0) {
|
||||
this.game.players().forEach(p => {
|
||||
this.playerViewData[p.id()] = placeName(this.game, p)
|
||||
})
|
||||
|
||||
@@ -26,7 +26,7 @@ export class DevConfig extends DefaultConfig {
|
||||
unitInfo(type: UnitType): UnitInfo {
|
||||
const info = super.unitInfo(type)
|
||||
const oldCost = info.cost
|
||||
info.cost = (p: Player) => oldCost(p) / 10000
|
||||
// info.cost = (p: Player) => oldCost(p) / 10000
|
||||
return info
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user