Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This PR addresses code duplication and logic scattering by:

  1. Moving generic utility functions from src/state/utils.ts to src/lib/utils.ts and src/lib/rng.ts.
  2. Extracting factory placement logic to src/ecs/factories/placement.ts.
  3. Consolidating factory upgrade cost definitions into src/ecs/factories/config.ts (FACTORY_UPGRADE_CONFIG) and updating src/state/constants.ts to use this single source of truth.
  4. Refactoring src/state/utils.ts to act as a backward-compatible facade that re-exports the moved functions.

This ensures that the ECS engine and the State store share the exact same logic for upgrade costs and placement, preventing divergence and reducing maintenance burden.


PR created automatically by Jules for task 1761530404747206814 started by @deadronos

- Extract generic utilities (generateUniqueId, vector3ToTuple) to src/lib/utils.ts
- Move factory placement logic to src/ecs/factories/placement.ts
- Centralize factory upgrade cost configuration in src/ecs/factories/config.ts
- Refactor src/state/utils.ts to re-export from new locations, removing duplicated implementation
- Update src/state/constants.ts to use shared upgrade configuration
- Update imports in consumers (factorySlice, ToastProvider)
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- bump zustand from 5.0.9 to 5.0.10
- update @types/node from 25.0.3 to 25.0.9
- update @types/react from 19.2.7 to 19.2.8
- bump @typescript-eslint/eslint-plugin and parser from 8.52.0 to 8.53.0
- update @vitest/coverage-v8 from 4.0.16 to 4.0.17
- upgrade postcss-nesting from 13.0.2 to 14.0.0
- update postcss-preset-env from 10.6.0 to 11.1.1
- bump prettier from 3.7.4 to 3.8.0
- update vite from rolldown-vite@7.3.0 to rolldown-vite@7.3.1
- bump vitest from 4.0.16 to 4.0.17
@deadronos deadronos marked this pull request as ready for review January 18, 2026 08:16
@deadronos deadronos merged commit f9d8229 into main Jan 18, 2026
4 of 5 checks passed
@deadronos deadronos deleted the refactor-factory-logic-clustering-1761530404747206814 branch January 18, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant