forked from mtcontrib/regional_weather
		
	Add additional constraints
This commit is contained in:
		@@ -12,7 +12,8 @@ climate_api.register_abm({
 | 
			
		||||
	 conditions	= {
 | 
			
		||||
		 min_height		= regional_weather.settings.min_height,
 | 
			
		||||
		 max_height		= regional_weather.settings.max_height,
 | 
			
		||||
		 min_humidity	= 55,
 | 
			
		||||
		 min_humidity	= 50,
 | 
			
		||||
		 min_biome_humidity = 26,
 | 
			
		||||
		 max_heat			= 85,
 | 
			
		||||
		 daylight			= 15,
 | 
			
		||||
		 indoors			= false
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ climate_api.register_abm({
 | 
			
		||||
	 conditions	= {
 | 
			
		||||
		 min_height		= regional_weather.settings.min_height,
 | 
			
		||||
		 max_height		= regional_weather.settings.max_height,
 | 
			
		||||
		 max_heat			= 25,
 | 
			
		||||
		 max_heat			= 35,
 | 
			
		||||
		 daylight			= 15,
 | 
			
		||||
		 indoors			= false
 | 
			
		||||
	 },
 | 
			
		||||
@@ -62,7 +62,7 @@ climate_api.register_abm({
 | 
			
		||||
	 conditions	= {
 | 
			
		||||
		 min_height		= regional_weather.settings.min_height,
 | 
			
		||||
		 max_height		= regional_weather.settings.max_height,
 | 
			
		||||
		 min_heat			= 40,
 | 
			
		||||
		 min_heat			= 35,
 | 
			
		||||
		 daylight			= 15,
 | 
			
		||||
		 indoors			= false
 | 
			
		||||
	 },
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@ climate_api.register_abm({
 | 
			
		||||
 | 
			
		||||
	action = function (pos, node, env)
 | 
			
		||||
		local wetness = minetest.get_item_group(node.name, "wet") or 0
 | 
			
		||||
		if wetness < 2 and env.humidity > 55 then
 | 
			
		||||
		if wetness < 2 and env.humidity > 50 then
 | 
			
		||||
			pedology.wetten(pos)
 | 
			
		||||
		elseif wetness > 0 and wetness < 3 and env.humidity < 40 then
 | 
			
		||||
			pedology.dry(pos)
 | 
			
		||||
 
 | 
			
		||||
@@ -109,12 +109,22 @@ climate_api.register_abm({
 | 
			
		||||
	catch_up	= false,
 | 
			
		||||
 | 
			
		||||
	 conditions	= {
 | 
			
		||||
		 min_height		= regional_weather.settings.min_height,
 | 
			
		||||
		 max_height		= regional_weather.settings.max_height,
 | 
			
		||||
		 min_humidity	= 55,
 | 
			
		||||
		 min_heat			= 30,
 | 
			
		||||
		 daylight			= 15,
 | 
			
		||||
		 indoors			= false
 | 
			
		||||
		 min_height = regional_weather.settings.min_height,
 | 
			
		||||
		 max_height = regional_weather.settings.max_height,
 | 
			
		||||
		 min_heat = 35,
 | 
			
		||||
		 min_humidity = 50,
 | 
			
		||||
		 min_biome_humidity = 26,
 | 
			
		||||
		 daylight = 15,
 | 
			
		||||
		 indoors = false,
 | 
			
		||||
		 not_biome = {
 | 
			
		||||
			"cold_desert",
 | 
			
		||||
			"cold_desert_ocean",
 | 
			
		||||
			"desert",
 | 
			
		||||
			"desert_ocean",
 | 
			
		||||
			"sandstone_desert",
 | 
			
		||||
			"sandstone_desert_ocean",
 | 
			
		||||
			"tundra"
 | 
			
		||||
		}
 | 
			
		||||
	 },
 | 
			
		||||
 | 
			
		||||
	 pos_override = function(pos)
 | 
			
		||||
 
 | 
			
		||||
@@ -70,11 +70,12 @@ climate_api.register_abm({
 | 
			
		||||
	catch_up	= false,
 | 
			
		||||
 | 
			
		||||
	 conditions	= {
 | 
			
		||||
		 min_height		= regional_weather.settings.min_height,
 | 
			
		||||
		 max_height		= regional_weather.settings.max_height,
 | 
			
		||||
		 min_humidity	= 55,
 | 
			
		||||
		 max_heat			= 30,
 | 
			
		||||
		 not_biome		= {
 | 
			
		||||
		 min_height = regional_weather.settings.min_height,
 | 
			
		||||
		 max_height = regional_weather.settings.max_height,
 | 
			
		||||
		 max_heat = 35,
 | 
			
		||||
		 min_humidity = 50,
 | 
			
		||||
		 min_biome_humidity = 26,
 | 
			
		||||
		 not_biome = {
 | 
			
		||||
			"cold_desert",
 | 
			
		||||
			"cold_desert_ocean",
 | 
			
		||||
			"desert",
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,8 @@ if farming ~= nil and farming.mod == "redo" then
 | 
			
		||||
		 conditions	= {
 | 
			
		||||
			 min_height		= regional_weather.settings.min_height,
 | 
			
		||||
			 max_height		= regional_weather.settings.max_height,
 | 
			
		||||
			 min_humidity	= 55,
 | 
			
		||||
			 min_heat			= 30,
 | 
			
		||||
			 min_humidity	= 50,
 | 
			
		||||
			 min_heat			= 35,
 | 
			
		||||
			 daylight			= 15,
 | 
			
		||||
			 indoors			= false
 | 
			
		||||
		 },
 | 
			
		||||
@@ -34,8 +34,8 @@ else
 | 
			
		||||
		 conditions	= {
 | 
			
		||||
			 min_height		= regional_weather.settings.min_height,
 | 
			
		||||
			 max_height		= regional_weather.settings.max_height,
 | 
			
		||||
			 min_humidity	= 55,
 | 
			
		||||
			 min_heat			= 30,
 | 
			
		||||
			 min_humidity	= 50,
 | 
			
		||||
			 min_heat			= 35,
 | 
			
		||||
			 daylight			= 15,
 | 
			
		||||
			 indoors			= false
 | 
			
		||||
		 },
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ local function generate_effects(params)
 | 
			
		||||
	local override = {}
 | 
			
		||||
 | 
			
		||||
	local cloud_density = climate_api.utility.rangelim(params.humidity / 100, 0.15, 0.65)
 | 
			
		||||
	local cloud_thickness = climate_api.utility.rangelim(params.base_humidity * 0.2, 1, 18)
 | 
			
		||||
	local cloud_thickness = climate_api.utility.rangelim(params.biome_humidity * 0.2, 1, 18)
 | 
			
		||||
	local cloud_height = calc_cloud_height(params.heat, params.humidity, params.dewpoint)
 | 
			
		||||
	local wind = climate_api.environment.get_wind({ x = 0, y = cloud_height, z = 0 })
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,16 @@ local conditions = {
 | 
			
		||||
	max_windspeed = 2,
 | 
			
		||||
	max_heat = 50,
 | 
			
		||||
	min_time = 4 / 24,
 | 
			
		||||
	max_time = 8 / 24
 | 
			
		||||
	max_time = 8 / 24,
 | 
			
		||||
	not_biome = {
 | 
			
		||||
		"cold_desert",
 | 
			
		||||
		"cold_desert_ocean",
 | 
			
		||||
		"desert",
 | 
			
		||||
		"desert_ocean",
 | 
			
		||||
		"sandstone_desert",
 | 
			
		||||
		"sandstone_desert_ocean",
 | 
			
		||||
		"tundra"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
local effects = {}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,15 @@
 | 
			
		||||
local name = "regional_weather:hail"
 | 
			
		||||
 | 
			
		||||
local conditions = {
 | 
			
		||||
	min_height			= regional_weather.settings.min_height,
 | 
			
		||||
	max_height			= regional_weather.settings.max_height,
 | 
			
		||||
	min_heat				= 30,
 | 
			
		||||
	max_heat				= 45,
 | 
			
		||||
	min_humidity		= 65,
 | 
			
		||||
	min_windspeed		= 2.5,
 | 
			
		||||
	indoors					= false,
 | 
			
		||||
	not_biome				= {
 | 
			
		||||
	min_height = regional_weather.settings.min_height,
 | 
			
		||||
	max_height = regional_weather.settings.max_height,
 | 
			
		||||
	min_heat = 30,
 | 
			
		||||
	max_heat = 45,
 | 
			
		||||
	min_humidity = 65,
 | 
			
		||||
	min_biome_humidity = 26,
 | 
			
		||||
	min_windspeed = 2.5,
 | 
			
		||||
	indoors = false,
 | 
			
		||||
	not_biome = {
 | 
			
		||||
		"cold_desert",
 | 
			
		||||
		"cold_desert_ocean",
 | 
			
		||||
		"desert",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,22 @@
 | 
			
		||||
local name = "regional_weather:rain"
 | 
			
		||||
 | 
			
		||||
local conditions = {
 | 
			
		||||
	min_height		= regional_weather.settings.min_height,
 | 
			
		||||
	max_height		= regional_weather.settings.max_height,
 | 
			
		||||
	min_heat			= 35,
 | 
			
		||||
	min_humidity	= 50,
 | 
			
		||||
	max_humidity	= 65,
 | 
			
		||||
	indoors				= false
 | 
			
		||||
	min_height = regional_weather.settings.min_height,
 | 
			
		||||
	max_height = regional_weather.settings.max_height,
 | 
			
		||||
	min_heat = 35,
 | 
			
		||||
	min_humidity = 50,
 | 
			
		||||
	max_humidity = 65,
 | 
			
		||||
	min_biome_humidity = 26,
 | 
			
		||||
	indoors = false,
 | 
			
		||||
	not_biome = {
 | 
			
		||||
		"cold_desert",
 | 
			
		||||
		"cold_desert_ocean",
 | 
			
		||||
		"desert",
 | 
			
		||||
		"desert_ocean",
 | 
			
		||||
		"sandstone_desert",
 | 
			
		||||
		"sandstone_desert_ocean",
 | 
			
		||||
		"tundra"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
local effects = {}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,21 @@
 | 
			
		||||
local name = "regional_weather:rain_heavy"
 | 
			
		||||
 | 
			
		||||
local conditions = {
 | 
			
		||||
	min_height		= regional_weather.settings.min_height,
 | 
			
		||||
	max_height		= regional_weather.settings.max_height,
 | 
			
		||||
	min_heat			= 40,
 | 
			
		||||
	min_humidity	= 65,
 | 
			
		||||
	indoors				= false
 | 
			
		||||
	min_height = regional_weather.settings.min_height,
 | 
			
		||||
	max_height = regional_weather.settings.max_height,
 | 
			
		||||
	min_heat = 40,
 | 
			
		||||
	min_humidity = 65,
 | 
			
		||||
	min_biome_humidity = 26,
 | 
			
		||||
	indoors = false,
 | 
			
		||||
	not_biome = {
 | 
			
		||||
		"cold_desert",
 | 
			
		||||
		"cold_desert_ocean",
 | 
			
		||||
		"desert",
 | 
			
		||||
		"desert_ocean",
 | 
			
		||||
		"sandstone_desert",
 | 
			
		||||
		"sandstone_desert_ocean",
 | 
			
		||||
		"tundra"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
local effects = {}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,16 +3,11 @@ local name = "regional_weather:sandstorm"
 | 
			
		||||
local conditions = {
 | 
			
		||||
	min_height = regional_weather.settings.min_height,
 | 
			
		||||
	max_height = regional_weather.settings.max_height,
 | 
			
		||||
	min_heat				= 50,
 | 
			
		||||
	max_humidity		= 25,
 | 
			
		||||
	min_windspeed		= 4.5,
 | 
			
		||||
	min_windspeed		= 3,
 | 
			
		||||
	has_biome				= {
 | 
			
		||||
		"cold_desert",
 | 
			
		||||
		"cold_desert_ocean",
 | 
			
		||||
		"desert",
 | 
			
		||||
		"desert_ocean",
 | 
			
		||||
		"sandstone_desert",
 | 
			
		||||
		"sandstone_desert_ocean"
 | 
			
		||||
		"sandstone_desert"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,11 +3,12 @@ local name = "regional_weather:snow"
 | 
			
		||||
local conditions = {
 | 
			
		||||
	min_height = regional_weather.settings.min_height,
 | 
			
		||||
	max_height = regional_weather.settings.max_height,
 | 
			
		||||
	max_heat				= 35,
 | 
			
		||||
	min_humidity		= 50,
 | 
			
		||||
	max_humidity		= 65,
 | 
			
		||||
	indoors					= false,
 | 
			
		||||
	not_biome				= {
 | 
			
		||||
	max_heat = 35,
 | 
			
		||||
	min_humidity = 50,
 | 
			
		||||
	max_humidity = 65,
 | 
			
		||||
	min_biome_humidity = 26,
 | 
			
		||||
	indoors	 = false,
 | 
			
		||||
	not_biome = {
 | 
			
		||||
		"cold_desert",
 | 
			
		||||
		"cold_desert_ocean",
 | 
			
		||||
		"desert",
 | 
			
		||||
 
 | 
			
		||||
@@ -3,10 +3,11 @@ local name = "regional_weather:snow_heavy"
 | 
			
		||||
local conditions = {
 | 
			
		||||
	min_height = regional_weather.settings.min_height,
 | 
			
		||||
	max_height = regional_weather.settings.max_height,
 | 
			
		||||
	max_heat				= 30,
 | 
			
		||||
	min_humidity		= 65,
 | 
			
		||||
	indoors					= false,
 | 
			
		||||
	not_biome				= {
 | 
			
		||||
	max_heat = 30,
 | 
			
		||||
	min_humidity = 65,
 | 
			
		||||
	min_biome_humidity = 26,
 | 
			
		||||
	indoors	 = false,
 | 
			
		||||
	not_biome = {
 | 
			
		||||
		"cold_desert",
 | 
			
		||||
		"cold_desert_ocean",
 | 
			
		||||
		"desert",
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ local function generate_effects(params)
 | 
			
		||||
	local override = {}
 | 
			
		||||
 | 
			
		||||
	override["climate_api:sound"]  = {
 | 
			
		||||
		gain = math.min(intensity, 1.2)
 | 
			
		||||
		gain = math.min(intensity, 1)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return climate_api.utility.merge_tables(effects, override)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user