Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npctrade: json-ize shop consumption rates #57852

Merged
merged 5 commits into from
May 27, 2022

Conversation

andrei8l
Copy link
Contributor

@andrei8l andrei8l commented May 22, 2022

Summary

None

Purpose of change

Shop consumption rate is hardcoded at 5 units/day
Follow-up from #56720
Fixes: #57688

Describe the solution

JSON-ize consumption rate

TODO (finished)
  • maybe split shop_consumption_rate to a new type_id so that definitions can be shared across merchants (this embiggened the patch quite a bit)
  • test unit
  • documentation

Describe alternatives you've considered

Hardcoding some special cases like in #57689: not flexible and not a good idea in the long term. This patch turned out to be pretty simple so there's no reason to delay until after 0.G

Testing

Test unit

Additional manual testing

Go to an evac center and open the trade UI in intervals of 6 days + 1 second. The utility shelf should not fill up with glass shards and the cabinet should not fill up with Merch.

Additional context

item_group::group_containts_item did not check recursively unlike item_group::every_possible_item_from and that looks like an oversight.

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON NPC / Factions NPCs, AI, Speech, Factions, Ownership json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels May 22, 2022
@andrei8l andrei8l force-pushed the npctrade-json-consume branch from 39d9252 to 39d4dce Compare May 22, 2022 16:37
@github-actions github-actions bot added Code: Tests Measurement, self-control, statistics, balancing. Mods Issues related to mods or modding labels May 22, 2022
@andrei8l andrei8l marked this pull request as ready for review May 22, 2022 17:31
@andrei8l andrei8l force-pushed the npctrade-json-consume branch from 39d4dce to d1469e8 Compare May 22, 2022 17:31
@andrei8l andrei8l requested a review from BrettDong as a code owner May 22, 2022 17:31
@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. [Markdown] Markdown issues and PRs [Python] Code made in Python Translation I18n labels May 22, 2022
@andrei8l andrei8l force-pushed the npctrade-json-consume branch 2 times, most recently from 4476fd7 to 2af30f5 Compare May 22, 2022 18:47
src/npc_class.cpp Outdated Show resolved Hide resolved
src/shop_cons_rate.cpp Outdated Show resolved Hide resolved
@andrei8l andrei8l force-pushed the npctrade-json-consume branch from 2af30f5 to d8c2952 Compare May 23, 2022 04:41
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label May 23, 2022
@andrei8l andrei8l force-pushed the npctrade-json-consume branch from d8c2952 to cbc8087 Compare May 23, 2022 06:14
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label May 23, 2022
@dseguin dseguin merged commit 8983592 into CleverRaven:master May 27, 2022
@andrei8l
Copy link
Contributor Author

Thanks for merging!

@andrei8l andrei8l deleted the npctrade-json-consume branch May 27, 2022 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs Mods Issues related to mods or modding NPC / Factions NPCs, AI, Speech, Factions, Ownership [Python] Code made in Python Translation I18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPC shops steadily stock less things over time
2 participants