Skip to content

feat: auto-pick an unused village_layout slot for import_village - #747

Merged
gaidheal1 merged 1 commit into
developmentfrom
feat/import-village-auto-slot
Aug 10, 2026
Merged

feat: auto-pick an unused village_layout slot for import_village#747
gaidheal1 merged 1 commit into
developmentfrom
feat/import-village-auto-slot

Conversation

@gaidheal1

Copy link
Copy Markdown
Member

Summary

  • import_village (the singular, ad-hoc management command) required --x/--y to be passed explicitly. It now auto-picks the first unoccupied village_layout.VILLAGE_LAYOUT slot when both are omitted, so an ad-hoc import (e.g. trying out a village file outside locations/data/, so outside the setup_world/import_villages pipeline) can claim spare grid space without colliding with the pipeline's own slots or requiring hand-picked coordinates.
  • Passing only one of --x/--y now raises a clear CommandError instead of silently doing something unintended.
  • Not persistent across a setup_world rerun — that command still wipes and reimports only locations/data/'s contents, so this only helps within a session.

Testing

  • New locations/tests/test_import_village_command.py: _resolve_origin's three cases (both coords given, only one given, neither given) and _pick_unused_layout_slot's slot-selection logic (picks first free slot, skips occupied ones, raises when the grid is full, ignores off-grid centres). User-run test suite, all passing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C6BX7dFJWn2xMYn9qggdos

When --x/--y are omitted, import_village now picks the first
VILLAGE_LAYOUT slot with no existing PopulationCentre on it, instead
of requiring coordinates to be hand-picked. Passing only one of --x/--y
now raises a clear CommandError instead of silently doing something
unintended.

This lets ad-hoc imports outside the setup_world/import_villages
pipeline (e.g. trying out a village file not in locations/data/) claim
spare grid space without colliding with the pipeline's own slots -
though it's not persistent across a setup_world rerun, which wipes and
reimports only locations/data/'s contents.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C6BX7dFJWn2xMYn9qggdos
@gaidheal1 gaidheal1 self-assigned this Aug 10, 2026
@gaidheal1
gaidheal1 merged commit fed33bd into development Aug 10, 2026
2 checks passed
@gaidheal1
gaidheal1 deleted the feat/import-village-auto-slot branch August 10, 2026 00:40
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