Advanced consumption - #2295
Open
ineveraskedforthis wants to merge 3 commits into
Open
Conversation
schombert
reviewed
Aug 18, 2026
| ankerl::unordered_dense::map<std::string, dcon::commodity_id> map_of_commodity_names; | ||
| ankerl::unordered_dense::map<std::string, dcon::factory_type_id> map_of_production_types; | ||
| ankerl::unordered_dense::map<std::string, dcon::factory_type_id> map_of_factory_names; | ||
| bool lua_factories; |
Owner
There was a problem hiding this comment.
This should probably be moved down to the both booleans below. It also probably needs to be given an initial value.
Edit: ah, I see that it gets set unconditionally, so it not having an initial value isn't a correctness issue.
schombert
reviewed
Aug 18, 2026
| } else if(consumption.category == 2) { | ||
| modifier = text::produce_simple_string(state, "alice_pop_details_lx_short"); | ||
| } else { | ||
| modifier = std::to_string(consumption.category - 3); |
Owner
There was a problem hiding this comment.
To make it possible for people to give names to the additional categories, maybe something like text::produce_simple_string(state, "alice_pop_details_cat" + std::to_string(consumption.category - 3) + "_short"); assuming that the category ids are stable and predictable. Otherwise, a category id to string name map could be stored at creation time and this name could be inserted instead of the number to form a localization key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds alternative way to define population needs via consumption categories defined with lua.
Allows to implement substitution in mods.
Calls specific lua function during the start of scenario creation to allow intervention into the process of building the scenario. Currently could be used for creation and setting properties of commodities, factories and consumption categories. Example is provided in comments in related lua file.