Skip to content

refactor: move item groups to generic factories, move inline itemgroup loading to generic readers#9791

Open
WishDuck wants to merge 6 commits into
cataclysmbn:mainfrom
WishDuck:genericitemgroupreader
Open

refactor: move item groups to generic factories, move inline itemgroup loading to generic readers#9791
WishDuck wants to merge 6 commits into
cataclysmbn:mainfrom
WishDuck:genericitemgroupreader

Conversation

@WishDuck

@WishDuck WishDuck commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Purpose of change (The Why)

Item groups defied every law of the universe
Only item_group_id::is_valid was implemented, and it was rarely used
Item groups were shoved into item factories
Item groups could not copy from each other

#9755 showed that there was issues with inline itemgroup loading.
But failed to recognize that this also applies to professions, monster weapons, construction, vehicle bash results and mapdata locations. And instead implemented a single solution instead of an overarching one.
It also failed to support deleting specific things / references from monsters if neccesary

Describe the solution (The How)

  1. Move item groups to generic factories, adding required default copy from and reset variable support to generic factories

  2. Made optional return a bool if a value was applied, as itemgroup loading depended on that logic and it would be useful elsewhere

  3. Shift item groups from using unique pointers to shared pointers, as item group modification is limited to adding and removing these pointers, thus it is compatible.

  4. Add itemgroup_reader generic reader for usage in loading inline itemgroups. It supports copy from along with all standard methods of itemgroup inheritance

  5. revert feat: make death drops extendable #9755 as it is not necessary to destandardize from default itemgroup stuff and this allows default extend and standard itemgroup delete by default ( I am willing to budge on this, but there is a caviat, it will stick out as a completely different way to define nested itemgroups )

Describe alternatives you've considered

Split this into two PRs
Keep most of the old loading as halfway through the refactor I found moving from unique to shared pointers was enough

Testing

It loads the C.R.I.T. extend and delete stuff right
New tests pass which show all the inline inheritance stuff working ( individual types do not need to be tested as they all use the same runner )

Checklist

Mandatory

Optional

  • This is a C++ PR that modifies JSON loading or behavior.
    • I have documented the changes in the appropriate location in the docs/ folder.

Translations

post changed stale missing
mod/json/reference/items/item_spawn.md en ja, ko

Build Artifacts

PR build for commit 4c2dd14 (fix inline defaults and cleanup) on 2026-07-04 02:41:04

@github-actions github-actions Bot added the src changes related to source code. label Jul 3, 2026
@WishDuck WishDuck force-pushed the genericitemgroupreader branch from d5e7f6a to 0450982 Compare July 3, 2026 21:44
@github-actions github-actions Bot added docs PRs releated to docs page JSON related to game datas in JSON format. tests changes related to tests mods PR changes related to mods. labels Jul 3, 2026
@autofix-ci

autofix-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

@WishDuck WishDuck force-pushed the genericitemgroupreader branch from 422c1a3 to d18e299 Compare July 4, 2026 00:53
@WishDuck WishDuck marked this pull request as ready for review July 4, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs PRs releated to docs page JSON related to game datas in JSON format. mods PR changes related to mods. src changes related to source code. tests changes related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant