Make wind dependent on height, add additional control commands, improve docu

This commit is contained in:
Till Affeldt
2020-05-13 16:03:28 +02:00
parent f42b4183e5
commit d4e00db432
14 changed files with 142 additions and 55 deletions

View File

@ -35,7 +35,7 @@ local function check_hit(player, ray)
-- use raycating to factor in wind speed
local origin = vector.add(ppos, {x = 0, y = ray.height or 0, z = 0 })
if ray.use_wind ~= false then
local wind = climate_api.environment.get_wind()
local wind = climate_api.environment.get_wind(origin)
local velocity = ray.velocity or 1
local windpos = vector.multiply(
vector.normalize(vector.add({ x = 0, y = -velocity, z = 0 }, wind)),

View File

@ -22,7 +22,9 @@ local function apply_hud(pname, weather, hud)
local file
if hud.color_correction then
local pos = vector.add(player:get_pos(), {x = 0, y = 1, z = 0})
local light = math.floor(math.max(minetest.env:get_node_light(pos) / 15, 0.2) * 256)
local node_light = minetest.env:get_node_light(pos)
if not node_light then node_light = 0 end
local light = math.floor(math.max(node_light / 15, 0.2) * 256)
local shadow = 256 - light
local dark_file = hud.file .. "^[multiply:#000000ff^[opacity:" .. shadow

View File

@ -175,7 +175,8 @@ local function parse_config(player, particles)
-- move particles in wind direction
if config.use_wind then
local wind = climate_api.environment.get_wind()
local pos = vector.multiply(vector.add(config.minpos, config.maxpos), 0.5)
local wind = climate_api.environment.get_wind(pos)
-- adjust velocity to include wind
config.minvel = vector.add(config.minvel, wind)
config.maxvel = vector.add(config.maxvel, wind)

View File

@ -41,3 +41,5 @@ end
climate_api.register_effect(EFFECT_NAME, handle_effect, "tick")
climate_api.register_effect(EFFECT_NAME, remove_effect, "stop")
climate_api.set_effect_cycle(EFFECT_NAME, climate_api.SHORT_CYCLE)