Skip to content

Commit

Permalink
Adds an ocean. (#70070)
Browse files Browse the repository at this point in the history
* Update overmap.cpp

* Update overmap.cpp

* Adds freshwater "ocean".

* Do it properly, fine.

* oh copy paste, you fickle minx.

* Update overmap.cpp

* Update lake.json

* remove outdated test line

* fix compiler errors

* typo

* add to mods

* fix freshwater beaches

still no sand :(

* adjust tests, hopefully stop them failing

Also tweaks an urbanosity error I noticed during bug testing

* Update tests/overmap_test.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update overmap_test.cpp

* Update overmap_test.cpp

* I just want the tests to pass. Pass, tests

* Update overmap_test.cpp

* remove override fix since it caused an error I am tired

* Update data/json/furniture_and_terrain/terrain-liquids.json

Co-authored-by: Procyonae <[email protected]>

* Update overmap_test.cpp

alphabetize

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Procyonae <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2023
1 parent 6d7bd75 commit fed496b
Show file tree
Hide file tree
Showing 27 changed files with 879 additions and 33 deletions.
9 changes: 8 additions & 1 deletion data/core/game_balance.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@
"stype": "bool",
"value": true
},
{
"type": "EXTERNAL_OPTION",
"name": "OVERMAP_PLACE_OCEANS",
"info": "Allows to place procgen oceans during overmap generation.",
"stype": "bool",
"value": true
},
{
"type": "EXTERNAL_OPTION",
"name": "OVERMAP_PLACE_FORESTS",
Expand Down Expand Up @@ -424,7 +431,7 @@
"name": "OVERMAP_MAXIMUM_URBANITY",
"info": "How urban do we allow our megacities to go? Mostly functions as a multiple of map settings city size.",
"stype": "int",
"value": 5
"value": 8
},
{
"type": "EXTERNAL_OPTION",
Expand Down
13 changes: 13 additions & 0 deletions data/json/furniture_and_terrain/terrain-liquids.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,19 @@
"connects_to": "WATER",
"examine_action": "water_source"
},
{
"type": "terrain",
"id": "t_saltwater_cube",
"name": "submersed salt water",
"description": "You are submerged below the surface of the water, your feet can't touch the ground. With a watertight container, you could gather salt water from here.",
"symbol": "~",
"color": "blue",
"move_cost": 8,
"flags": [ "TRANSPARENT", "LIQUID", "NO_SCENT", "SWIMMABLE", "DEEP_WATER", "SALT_WATER", "WATER_CUBE", "NO_FLOOR_WATER" ],
"connect_groups": "WATER",
"connects_to": "WATER",
"examine_action": "water_source"
},
{
"type": "terrain",
"id": "t_lake_bed",
Expand Down
20 changes: 20 additions & 0 deletions data/json/mapgen/ocean.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"type": "mapgen",
"method": "json",
"om_terrain": [ "ocean_surface" ],
"object": { "fill_ter": "t_swater_dp" }
},
{
"type": "mapgen",
"method": "json",
"om_terrain": [ "ocean_water_cube" ],
"object": { "fill_ter": "t_saltwater_cube" }
},
{
"type": "mapgen",
"method": "json",
"om_terrain": [ "ocean_bed" ],
"object": { "fill_ter": "t_ocean_bed" }
}
]
40 changes: 40 additions & 0 deletions data/json/overmap/overmap_terrain/overmap_terrain_waterbody.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,45 @@
"id": "lake_bed",
"copy-from": "generic_lake",
"name": "lake bed (submerged)"
},
{
"type": "overmap_terrain",
"abstract": "generic_ocean",
"copy-from": "generic_water",
"name": "ocean",
"sym": "#",
"color": "blue",
"see_cost": 1,
"flags": [ "NO_ROTATE", "OCEAN" ]
},
{
"type": "overmap_terrain",
"id": "ocean_shore",
"copy-from": "generic_ocean",
"name": "ocean shore",
"color": "light_blue",
"delete": { "flags": [ "OCEAN" ] },
"extend": { "flags": [ "OCEAN_SHORE" ] },
"extras": "ocean_shore",
"travel_cost_type": "shore",
"mapgen": [ { "method": "builtin", "name": "ocean_shore" } ]
},
{
"type": "overmap_terrain",
"id": "ocean_surface",
"copy-from": "generic_ocean",
"travel_cost_type": "water"
},
{
"type": "overmap_terrain",
"id": "ocean_water_cube",
"copy-from": "generic_ocean",
"name": "ocean (submerged)"
},
{
"type": "overmap_terrain",
"id": "ocean_bed",
"copy-from": "generic_ocean",
"name": "ocean bed (submerged)"
}
]
20 changes: 20 additions & 0 deletions data/json/overmap/special_locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,26 @@
"id": "lake_shore",
"terrains": [ "lake_shore" ]
},
{
"type": "overmap_location",
"id": "ocean_surface",
"terrains": [ "ocean_surface" ]
},
{
"type": "overmap_location",
"id": "ocean_water_cube",
"terrains": [ "ocean_water_cube" ]
},
{
"type": "overmap_location",
"id": "ocean_bed",
"terrains": [ "ocean_bed" ]
},
{
"type": "overmap_location",
"id": "ocean_shore",
"terrains": [ "ocean_shore" ]
},
{
"type": "overmap_location",
"id": "potential_basement_lab_entrance",
Expand Down
9 changes: 9 additions & 0 deletions data/json/regional_map_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,15 @@
{ "om_terrain": "island_field", "om_terrain_match_type": "TYPE", "alias": "field" }
]
},
"overmap_ocean_settings": {
"noise_threshold_ocean": 0.25,
"ocean_size_min": 100,
"ocean_depth": -9,
"ocean_start_north": 500,
"ocean_start_east": 10,
"ocean_start_west": 1000,
"ocean_start_south": 0
},
"overmap_ravine_settings": { "num_ravines": 0, "ravine_width": 3, "ravine_range": 45, "ravine_depth": -3 },
"overmap_forest_settings": {
"noise_threshold_forest": 0.2,
Expand Down
9 changes: 9 additions & 0 deletions data/mods/Backrooms/regional_map_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@
"shore_extendable_overmap_terrain": [ "forest" ],
"shore_extendable_overmap_terrain_aliases": [ ]
},
"overmap_ocean_settings": {
"noise_threshold_ocean": 10.0,
"ocean_size_min": 100,
"ocean_depth": -9,
"ocean_start_north": 0,
"ocean_start_east": 0,
"ocean_start_west": 0,
"ocean_start_south": 0
},
"overmap_ravine_settings": { "num_ravines": 0, "ravine_width": 3, "ravine_range": 45, "ravine_depth": -3 },
"overmap_forest_settings": {
"noise_threshold_forest": 1.0,
Expand Down
10 changes: 10 additions & 0 deletions data/mods/No_Hope/regional_map_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@
{ "om_terrain": "island_field", "om_terrain_match_type": "TYPE", "alias": "field" }
]
},
"overmap_ocean_settings": {
"noise_threshold_ocean": 0.25,
"ocean_size_min": 100,
"ocean_depth": -9,
"ocean_start_north": 500,
"ocean_start_east": 10,
"ocean_start_west": 1000,
"ocean_start_south": 0
},
"overmap_ravine_settings": { "num_ravines": 0, "ravine_width": 3, "ravine_range": 45, "ravine_depth": -3 },
"overmap_forest_settings": {
"noise_threshold_forest": 0.2,
Expand Down Expand Up @@ -810,6 +819,7 @@
},
"river": { "chance": 3, "extras": { "mx_reed": 100 } },
"lake_shore": { "chance": 2, "extras": { "mx_reed": 100 } },
"ocean_shore": { "chance": 1, "extras": { "mx_reed": 100 } },
"sewer": { "chance": 80, "extras": { "mx_null": 100 } }
},
"city": {
Expand Down
9 changes: 9 additions & 0 deletions data/mods/TropiCataclysm/tropical_regional_map_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,15 @@
{ "om_terrain": "island_field", "om_terrain_match_type": "TYPE", "alias": "field" }
]
},
"overmap_ocean_settings": {
"noise_threshold_ocean": 0.25,
"ocean_size_min": 100,
"ocean_depth": -9,
"ocean_start_north": 500,
"ocean_start_east": 10,
"ocean_start_west": 1000,
"ocean_start_south": 0
},
"overmap_ravine_settings": { "num_ravines": 0, "ravine_width": 3, "ravine_range": 45, "ravine_depth": -3 },
"overmap_forest_settings": {
"noise_threshold_forest": 0.2,
Expand Down
9 changes: 9 additions & 0 deletions data/mods/aftershock_exoplanet/region_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@
{ "om_terrain": "island_field", "om_terrain_match_type": "TYPE", "alias": "field" }
]
},
"overmap_ocean_settings": {
"noise_threshold_ocean": 10.0,
"ocean_size_min": 100,
"ocean_depth": -9,
"ocean_start_north": 0,
"ocean_start_east": 0,
"ocean_start_west": 0,
"ocean_start_south": 0
},
"overmap_ravine_settings": { "num_ravines": 15, "ravine_width": 3, "ravine_range": 45, "ravine_depth": -3 },
"overmap_forest_settings": {
"noise_threshold_forest": 0.5,
Expand Down
9 changes: 9 additions & 0 deletions data/mods/classic_zombies/alberta_regional_map_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@
{ "om_terrain": "island_field", "om_terrain_match_type": "TYPE", "alias": "field" }
]
},
"overmap_ocean_settings": {
"noise_threshold_ocean": 0.25,
"ocean_size_min": 100,
"ocean_depth": -9,
"ocean_start_north": 250,
"ocean_start_east": 900,
"ocean_start_west": 200,
"ocean_start_south": 0
},
"overmap_ravine_settings": { "num_ravines": 0, "ravine_width": 3, "ravine_range": 45, "ravine_depth": -3 },
"overmap_forest_settings": {
"noise_threshold_forest": 0.4,
Expand Down
9 changes: 9 additions & 0 deletions data/mods/desert_region/desert_regional_map_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@
{ "om_terrain": "island_field", "om_terrain_match_type": "TYPE", "alias": "field" }
]
},
"overmap_ocean_settings": {
"noise_threshold_ocean": 10.0,
"ocean_size_min": 100,
"ocean_depth": -9,
"ocean_start_north": 0,
"ocean_start_east": 0,
"ocean_start_west": 0,
"ocean_start_south": 0
},
"overmap_ravine_settings": { "num_ravines": 0, "ravine_width": 3, "ravine_range": 15, "ravine_depth": -2 },
"overmap_forest_settings": {
"noise_threshold_forest": 0.29,
Expand Down
9 changes: 9 additions & 0 deletions data/mods/rural_biome/rural_regional_map_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@
{ "om_terrain": "island_field", "om_terrain_match_type": "TYPE", "alias": "field" }
]
},
"overmap_ocean_settings": {
"noise_threshold_ocean": 0.25,
"ocean_size_min": 100,
"ocean_depth": -9,
"ocean_start_north": 500,
"ocean_start_east": 10,
"ocean_start_west": 1000,
"ocean_start_south": 0
},
"overmap_ravine_settings": { "num_ravines": 0, "ravine_width": 3, "ravine_range": 45, "ravine_depth": -3 },
"overmap_forest_settings": {
"noise_threshold_forest": 0.1,
Expand Down
5 changes: 3 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ vehicle *game::place_vehicle_nearby(
if( veh.max_ground_velocity() == 0 && veh.can_float() ) {
search_types.emplace_back( "river" );
search_types.emplace_back( "lake" );
search_types.emplace_back( "ocean" );
} else {
search_types.emplace_back( "road" );
search_types.emplace_back( "field" );
Expand Down Expand Up @@ -12604,8 +12605,8 @@ void game::perhaps_add_random_npc( bool ignore_spawn_timers_and_rates )
// Only spawn random NPCs on z-level 0
spawn_point.z() = 0;
const oter_id oter = overmap_buffer.ter( spawn_point );
// shouldn't spawn on lakes or rivers.
if( !is_river_or_lake( oter ) ) {
// shouldn't spawn on bodies of water.
if( !is_water_body( oter ) ) {
spawn_allowed = true;
}
counter += 1;
Expand Down
6 changes: 5 additions & 1 deletion src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,11 @@ static bool good_fishing_spot( const tripoint &pos, Character *p )
overmap_buffer.ter( tripoint_abs_omt( ms_to_omt_copy( here.getabs( pos ) ) ) );
std::string om_id = cur_omt.id().c_str();
if( fishables.empty() && !here.has_flag( ter_furn_flag::TFLAG_CURRENT, pos ) &&
om_id.find( "river_" ) == std::string::npos && !cur_omt->is_lake() && !cur_omt->is_lake_shore() ) {
// this is a ridiculous way to find a good fishing spot, but I'm just trying
// to do oceans right now. Maybe is_water_body() would be better?
// if you find this comment still here and it's later than 2025, LOL.
om_id.find( "river_" ) == std::string::npos && !cur_omt->is_lake() && !cur_omt->is_ocean() &&
!cur_omt->is_lake_shore() && !cur_omt->is_ocean_shore() ) {
p->add_msg_if_player( m_info, _( "You doubt you will have much luck catching fish here." ) );
return false;
}
Expand Down
Loading

0 comments on commit fed496b

Please sign in to comment.