From c722b026db3bc9e7a670f1392954997d42038806 Mon Sep 17 00:00:00 2001 From: TKTK123456 <103334266+TKTK123456@users.noreply.github.com> Date: Mon, 1 Jun 2026 20:39:26 -0400 Subject: [PATCH] Sync factory effective distance and railroad max length and add railroad ghost for factories (#4079) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > **Before opening a PR:** discuss new features on [Discord](https://discord.gg/K9zernJB5z) first, and file bugs or small improvements as [issues](https://github.com/openfrontio/OpenFrontIO/issues/new/choose). You must be assigned to an `approved` issue — unsolicited PRs will be auto-closed. **Add approved & assigned issue number here:** Resolves #2668 ## Description: Makes radius that factories effect equal to the max distance that a railroad can be and enable factory ghosts Screenshot from 2026-06-01
20-13-58 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory ## Please put your Discord username so you can be contacted if a bug or regression is found: tktk1234567 --- src/client/render/gl/passes/RangeCirclePass.ts | 4 ++-- src/core/configuration/Config.ts | 4 ++-- src/core/game/RailNetworkImpl.ts | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/client/render/gl/passes/RangeCirclePass.ts b/src/client/render/gl/passes/RangeCirclePass.ts index 304f81630..8fbe41273 100644 --- a/src/client/render/gl/passes/RangeCirclePass.ts +++ b/src/client/render/gl/passes/RangeCirclePass.ts @@ -70,6 +70,8 @@ export class RangeCirclePass { const gl = this.gl; gl.useProgram(this.program); gl.uniformMatrix3fv(this.uCamera, false, cameraMatrix); + gl.bindVertexArray(this.vao); + gl.uniform2f(this.uCenter, this.centerX, this.centerY); gl.uniform1f(this.uRadius, this.radius); if (this.warning) { @@ -77,8 +79,6 @@ export class RangeCirclePass { } else { gl.uniform3f(this.uColor, 1.0, 1.0, 1.0); } - - gl.bindVertexArray(this.vao); gl.drawArrays(gl.TRIANGLES, 0, 6); } diff --git a/src/core/configuration/Config.ts b/src/core/configuration/Config.ts index 9244ebcfc..4b478d6f3 100644 --- a/src/core/configuration/Config.ts +++ b/src/core/configuration/Config.ts @@ -246,10 +246,10 @@ export class Config { return 15; } trainStationMaxRange(): number { - return 100; + return 110; } railroadMaxSize(): number { - return 120; + return this.trainStationMaxRange(); } tradeShipGold(dist: number, player: Player | PlayerView): Gold { diff --git a/src/core/game/RailNetworkImpl.ts b/src/core/game/RailNetworkImpl.ts index 7692b9ba2..9144734a7 100644 --- a/src/core/game/RailNetworkImpl.ts +++ b/src/core/game/RailNetworkImpl.ts @@ -238,9 +238,7 @@ export class RailNetworkImpl implements RailNetwork { } computeGhostRailPaths(unitType: UnitType, tile: TileRef): TileRef[][] { - // Factories already show their radius, so we'll exclude from ghost rails - // in order not to clutter the interface too much. - if (![UnitType.City, UnitType.Port].includes(unitType)) { + if (![UnitType.City, UnitType.Port, UnitType.Factory].includes(unitType)) { return []; }