2020-04-14 05:45:59 +02:00
|
|
|
local name = "regional_weather:ambient"
|
2020-04-13 16:52:45 +02:00
|
|
|
|
|
|
|
local CLOUD_SPEED = 1.8
|
|
|
|
|
2020-04-16 08:04:06 +02:00
|
|
|
local conditions = {
|
|
|
|
min_light = 15
|
|
|
|
}
|
2020-04-13 16:52:45 +02:00
|
|
|
|
|
|
|
local function generate_effects(params)
|
|
|
|
local override = {}
|
|
|
|
|
2020-04-16 08:04:06 +02:00
|
|
|
--[[override["climate_api:clouds"] = {
|
2020-04-14 05:45:59 +02:00
|
|
|
size = climate_api.utility.rangelim(params.humidity / 100, 0.25, 0.98),
|
2020-04-13 16:52:45 +02:00
|
|
|
speed = vector.multiply(params.wind, CLOUD_SPEED)
|
2020-04-16 08:04:06 +02:00
|
|
|
}]]
|
2020-04-13 16:52:45 +02:00
|
|
|
|
|
|
|
local movement = params.player:get_player_velocity()
|
|
|
|
local movement_direction
|
|
|
|
if (vector.length(movement) < 0.1) then
|
|
|
|
movement_direction = vector.new(0, 0, 0)
|
|
|
|
else
|
|
|
|
movement_direction = vector.normalize(movement)
|
|
|
|
end
|
|
|
|
local vector_product = vector.dot(movement_direction, params.wind)
|
|
|
|
local movement_penalty = climate_api.utility.sigmoid(vector_product, 1.6, 0.2, 0.8) + 0.2
|
|
|
|
override["regional_weather:speed_buff"] = movement_penalty
|
|
|
|
return override
|
|
|
|
end
|
|
|
|
|
|
|
|
climate_api.register_weather(name, conditions, generate_effects)
|