Skip to content

feat: allow per-hub model inheritance override for merged states#8

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/investigate-town-selection-issue
Draft

feat: allow per-hub model inheritance override for merged states#8
Copilot wants to merge 2 commits intomasterfrom
copilot/investigate-town-selection-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

Merged states currently inherit hub models (city, port, farm, mine, wood) from whichever source state happens to provide them first, causing hubs to cluster inside the original target state's territory with no user control.

Changes

  • New extended config formatmerge_states.json values can now be either the existing list (backward-compatible) or a dict with a "merge" key plus optional per-hub override keys. Both formats can coexist in the same file.
{
    "STATE_A": {
        "merge": ["STATE_B", "STATE_C"],
        "city": "STATE_B",
        "port": "STATE_C"
    },
    "STATE_D": ["STATE_E"]
}
  • cli.py — Added load_merge_config() that normalises both formats into (merge_dict, hub_overrides).
  • state_regions.pyStateRegion.merge_states() — Accepts hub_overrides. Snapshots all referenced hub province IDs before any merging (food states are removed after merge), then applies overrides to the diner state after all its foods are merged.
  • state_merger.py — Threads hub_overrides through StateMerger.__init__()merge_state_data()map_data.merge_states(). merge_loc_data() now preferentially searches the override source state for hub name localization before falling back to the food list.
  • Tests — 13 new tests covering config parsing (both formats, mixed, invalid) and merge logic (default behavior unchanged, overrides applied correctly, graceful warning on unknown source state).
  • Docs — README (EN + ZH) updated with format description and example.
Original prompt

This section details on the original issue you should resolve

<issue_title>关于为新合并州进行自选城镇</issue_title>
<issue_description>你好,

我注意到,对于新合并的州,其四个城镇hub或五个(含港口),直接会选取目标州的hub。但是这会让新合并的州看起来比较奇怪,其城镇会聚集在目标州内。

我手动在mod文件夹内对新生成的00_states_merging.txt文件进行修改,对各hub所在的province进行覆写所希望的hub所在的province代码,例如x766F08。但是该操作并没有生效。

我查看原因,似乎在v3根目录中有另一层数据文件,将某个province对应的hub指向一个对象坐标。可能是在game/gfx/map/map_object_data/generated_map_object_locators_city.txt文件中,然而应该还有一个链接文件,将province与hub的id映射起来。

希望作者如有相关想法,可以调查一下原因并开发这个功能。</issue_description>

<agent_instructions>如果我想实现这段话中最后一段中的功能,也就是既能表示要合并的省份,又能指定合并后的省份各个模型继承哪一个原来的省份,merge_states.json应该改成什么格式?(可以改成不是JSON的格式)</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@ShabbyGayBar 能再具体点描述你想要的功能嘛?

目前的hub,也就是城市模型,都是从原版游戏继承的没错。同时这也意味着即使他们挤在一起,他们的位置和名字还是能对上的。
如果你想指定他们新的位置,那就是不符合史实。
如果你想指定新位置并且指定新名字,那对我和终端用户都是巨大的工作量,似乎不应该由我这一个小脚本来实现。

我觉得你可能想要的是指定_合并后的省份_的城市,港口,矿场,农田模型各自继承哪一个_原版省份_。
这个功能上倒确实不难,但对于终端用户来说,目前的merge_states.json的格式肯定要大改,主要是需要一个能表达上述要求,同时还不影响现有基础功能(即指定被合并的省份)的格式。
而且JSON大概是难当此大任的。</comment_new>


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Extends the merge config format to support per-hub inheritance overrides.
Users can now specify which original state's hub province (city, port,
farm, mine, wood) the merged state should inherit, instead of always
using the default "keep diner's hub or fall back to first food's hub"
behavior.

New extended format (backward-compatible JSON):
  "STATE_A": {
      "merge": ["STATE_B", "STATE_C"],
      "city": "STATE_B",
      "port": "STATE_C"
  }

Old list format still works unchanged.

Co-authored-by: ShabbyGayBar <115197764+ShabbyGayBar@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate town selection for newly merged states feat: allow per-hub model inheritance override for merged states Mar 19, 2026
Copilot AI requested a review from ShabbyGayBar March 19, 2026 05:45
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.

关于为新合并州进行自选城镇

2 participants