Mod API suggestions related to biomes

Hi.

There are 3 things in biomes that I already used more than once but are hardcoded in lua.
This means that not only I need to mod a lua file to change it, but also I have to make sure to not affect other biomes that should not be changed and make sure to keep compatibility between the biomes that are modding those same lua files.

----------

The first one, is water height. I modded this both in Archipelago and Swamp biomes.
Usually, the water height go up to 1 block and a half below the land margin. Like this:
screenshot 2017_09_28__12_17_10

It is hardcoded at
WorldGenerationService:_add_water_bodies()
as
local water_height_delta = 1.5

I changed it to:
local water_height_delta = stonehearth.world_generation:get_biome_generation_data():get_landscape_info().water.water_height_delta or 1.5
Then I can set the desired value in the json like this:

{
	"landscape": {
		"water": {
			"water_height_delta": 0.6
		}
	}
}

This way I could accomplish those super shallow water in both biomes. (while keeping the default as a fallback)

----------

The second change is about the water color. This was done in Swamp and Volcano biomes. (volcano was just a sketch test, the first I did to change water colors, I will soon release it with a bunch of other sketch mods I have in a mega post)

It is hardcoded at the
Biome:_generate_color_map()
as
water = '#1cbfff

I changed it to:
water = self:get_landscape_info().water.color or '#1cbfff
Like before, I can now set the desired value in json, with the default value as a fallback. The json ends like this:

{
	"landscape": {
		"water": {
			"color": "#4B4A32"
		}
	}
}

I must add that this color change affects only the mini-map, not the in-game color.

----------

The third is like the second, this time for the in-game water.

It is hardcoded at the
WaterRenderer
with two variables
local EDGE_COLOR = Color4(28, 191, 255, 0)
local FACE_COLOR = Color4(28, 191, 255, 192)

I changed it by overriding the whole file because I couldn’t change only them or the method calling them for some reason, thankfully the override can be done in applied manifests loaded only in those biomes.
It would be good to be able to set it in json too.

----------

This last one I did not got it to work yet, so I have no example code.
Basically it would be really nice if we could set up bg music and ambient sounds on biomes. Right now, music is tied to kingdoms only and ambient sounds plays anywhere without restrictions. Birds chirping does not makes sense in all places, and other sounds that we add may not make sense in temperate or deserts.

4 Likes

Food for thought for: @ayazar and @albert . Thanks for the practical suggestions, @BrunoSupremo! :smiley:

Sky colour was mentioned together with water colour in another thread so add that to the list.

1 Like

Sky colors can be modified at stonehearth/data/calendar/sky_settings.json

2 Likes