mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-02 05:18:06 +00:00
Use spawn tile for name placement during spawn phase
Names now follow the player's currently-selected spawn tile each tick instead of going through placeName, which read a cluster bounding box that only refreshed every cluster-calc cycle and was further throttled to every other tick. Adds placeSpawnName and switches the spawn-phase branch in GameRunner to use it.
This commit is contained in:
+11
-13
@@ -1,4 +1,4 @@
|
||||
import { placeName } from "../client/hud/NameBoxCalculator";
|
||||
import { placeName, placeSpawnName } from "../client/hud/NameBoxCalculator";
|
||||
import { Config } from "./configuration/Config";
|
||||
import { Executor } from "./execution/ExecutionManager";
|
||||
import { RecomputeRailClusterExecution } from "./execution/RecomputeRailClusterExecution";
|
||||
@@ -160,16 +160,14 @@ export class GameRunner {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.game.inSpawnPhase() && this.game.ticks() % 2 === 0) {
|
||||
this.game
|
||||
.players()
|
||||
.filter(
|
||||
(p) =>
|
||||
p.type() === PlayerType.Human || p.type() === PlayerType.Nation,
|
||||
)
|
||||
.forEach(
|
||||
(p) => (this.playerViewData[p.id()] = placeName(this.game, p)),
|
||||
);
|
||||
if (this.game.inSpawnPhase()) {
|
||||
for (const p of this.game.players()) {
|
||||
if (p.type() !== PlayerType.Human && p.type() !== PlayerType.Nation) {
|
||||
continue;
|
||||
}
|
||||
if (p.spawnTile() === undefined) continue;
|
||||
this.playerViewData[p.id()] = placeSpawnName(this.game, p);
|
||||
}
|
||||
}
|
||||
|
||||
const spawnJustEnded = wasInSpawnPhase && !this.game.inSpawnPhase();
|
||||
@@ -178,9 +176,9 @@ export class GameRunner {
|
||||
this.game.ticks() < 3 ||
|
||||
this.game.ticks() % 30 === 0
|
||||
) {
|
||||
this.game.players().forEach((p) => {
|
||||
for (const p of this.game.players()) {
|
||||
this.playerViewData[p.id()] = placeName(this.game, p);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const packedTileUpdates = this.game.drainPackedTileUpdates();
|
||||
|
||||
Reference in New Issue
Block a user