Skip to content

Commit

Permalink
Eternal weather (CleverRaven#59707)
Browse files Browse the repository at this point in the history
* Set eternal weather on creating a world

* Serialization stuff

* Removed unneeded stuff

* Replaced Sunny weather with Clear weather

Also updated description.

* Set eternal weather update in do_turn

* Removed no longer needed debug menu Change weather option

* Update debug_menu.h

* WEATHER_NULL

* Removed some more unneeded stuff

* Returned back debug changing weather

* Moved options from options.cpp to game_balance.json

* Oops

* Update data/core/game_balance.json
  • Loading branch information
Night-Pryanik authored Nov 24, 2022
1 parent b56a3d9 commit 1f8e0a1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
7 changes: 7 additions & 0 deletions data/core/game_balance.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,12 @@
"info": "Determines frequency (in minutes) of displaying music description in sidebar when listening to MP3-players and the like.",
"stype": "int",
"value": 5
},
{
"type": "EXTERNAL_OPTION",
"name": "ETERNAL_WEATHER",
"info": "Sets eternal weather. Possible values are 'normal', 'clear', 'cloudy', 'light_drizzle', 'drizzle', 'rain', 'rainstorm', 'thunder', 'lightning', 'flurries', 'snowing', 'snowstorm', 'early_portal_storm', 'portal_storm'. 'normal' clears all eternal weather overrides and sets normal weather pattern. Requires restart of the game after changing value to take effect.",
"stype": "string_input",
"value": "normal"
}
]
11 changes: 10 additions & 1 deletion src/do_turn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ bool do_turn()
return turn_handler::cleanup_at_end();
}
// Actual stuff
if( g-> new_game ) {
if( g->new_game ) {
g->new_game = false;
} else {
g->gamemode->per_turn();
Expand All @@ -609,6 +609,15 @@ bool do_turn()
play_music( music::get_music_id_string() );

weather_manager &weather = get_weather();
if( get_option<std::string>( "ETERNAL_WEATHER" ) != "normal" ) {
weather.weather_override = static_cast<weather_type_id>
( get_option<std::string>( "ETERNAL_WEATHER" ) );
weather.set_nextweather( calendar::turn );
} else {
weather.weather_override = WEATHER_NULL;
weather.set_nextweather( calendar::turn );
}

// starting a new turn, clear out temperature cache
weather.temperature_cache.clear();

Expand Down
7 changes: 7 additions & 0 deletions src/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,13 @@ bool main_menu::opening_screen()
}
if( start && !load_game && get_scenario() ) {
add_msg( get_scenario()->description( player_character.male ) );

if( get_option<std::string>( "ETERNAL_WEATHER" ) != "normal" ) {
if( player_character.posz() >= 0 ) {
add_msg( _( "You feel as if this %1$s will last forever…" ),
get_options().get_option( "ETERNAL_WEATHER" ).getValueName() );
}
}
}
return true;
}
Expand Down

0 comments on commit 1f8e0a1

Please sign in to comment.