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

Move weather into JSON #41617

Merged
merged 39 commits into from
Jul 8, 2020
Merged

Move weather into JSON #41617

merged 39 commits into from
Jul 8, 2020

Conversation

Ramza13
Copy link
Contributor

@Ramza13 Ramza13 commented Jun 26, 2020

Summary

SUMMARY: Infrastructure "Move weather from being hardcoded into json."

Purpose of change

Part of setup for #41067
Hardcoded = bad
Allow ability via json to add. delete, or change all weather.

Describe the solution

Added weather_types and weather_types.json. Weather_type defines the behavior and types of weather. All references to specific weather in code have been replaced by references to weather properties and the weather enum has been replaced with a vector. Regional_map.json now contains a list of weather ids allowed. No functional changes other than one minor change to some weathers rate of extinguishing torches.

When deciding the weather this array is iterated over and each elements requirements are tested, the last entry with valid requirements is chosen. At the moment requirements are what the existing weather used, such as humidity, temperature, pressure, or another weather being true already.

Updated documentation

Describe alternatives you've considered

Testing

Used debug conmmands to generate weather test data, set various weathers and observe results.

Additional context

Future PRs are planned to expand both requirements and weather effects. Providing freedom to make weather depend on random events or time intervals and cause all effects and or monster spawns, injury, radiation.

@anothersimulacrum anothersimulacrum added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Mechanics: Weather Rain, snow, portal storms and non-temperature environment labels Jun 27, 2020
@anothersimulacrum
Copy link
Member

Great job!

@ZhilkinSerg
Copy link
Contributor

Damn :)

Can you please make weather_type a distinct json object (similar to what I did in my branch linked above), so you could just reference in regional settings by id instead of putting full definition there.

src/animation.cpp Outdated Show resolved Hide resolved
src/weather.h Outdated Show resolved Hide resolved
src/weather.h Outdated Show resolved Hide resolved
src/weather.h Outdated Show resolved Hide resolved
src/weather.cpp Outdated Show resolved Hide resolved
src/weather.cpp Outdated Show resolved Hide resolved
src/weather_data.cpp Outdated Show resolved Hide resolved
src/weather_gen.cpp Outdated Show resolved Hide resolved
src/weather_gen.cpp Outdated Show resolved Hide resolved
src/weather_gen.cpp Outdated Show resolved Hide resolved
src/weather_data.cpp Outdated Show resolved Hide resolved
src/weather_gen.cpp Outdated Show resolved Hide resolved
src/weather_gen.cpp Outdated Show resolved Hide resolved
src/weather.cpp Outdated Show resolved Hide resolved
src/weather.cpp Outdated Show resolved Hide resolved
src/weather.cpp Outdated Show resolved Hide resolved
src/weather.cpp Outdated Show resolved Hide resolved
src/iuse.cpp Outdated Show resolved Hide resolved
src/panels.cpp Outdated Show resolved Hide resolved
src/panels.cpp Outdated Show resolved Hide resolved
src/panels.cpp Outdated Show resolved Hide resolved
src/sounds.cpp Outdated Show resolved Hide resolved
src/weather.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style [JSON] Changes (can be) made in JSON Mechanics: Weather Rain, snow, portal storms and non-temperature environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants