Improve wind position for particles, add command to set wind, improve wind influences

This commit is contained in:
Till Affeldt
2020-04-18 11:12:47 +02:00
parent 241a0a82c1
commit a6cfca7745
8 changed files with 55 additions and 28 deletions

View File

@ -11,18 +11,11 @@ end
local function spawn_particles(player, particles)
local ppos = player:getpos()
local wind_x = climate_mod.state:get_float("wind_x")
local wind_z = climate_mod.state:get_float("wind_z")
local wind = vector.new(wind_x, 0, wind_z)
local wind_pos = vector.multiply(wind, -1)
local wind_speed = vector.length(wind)
local wind = climate_api.environment.get_wind()
local amount = particles.amount * climate_mod.settings.particle_count
local texture = get_particle_texture(particles)
local minp = vector.add(vector.add(ppos, particles.min_pos), wind_pos)
local maxp = vector.add(vector.add(ppos, particles.max_pos), wind_pos)
local vel = vector.new({
x = wind.x,
y = -particles.falling_speed,
@ -30,6 +23,14 @@ local function spawn_particles(player, particles)
})
local acc = vector.new({x=0, y=0, z=0})
local wind_pos = vector.multiply(
vector.normalize(vel),
-vector.length(wind)
)
wind_pos.y = 0
local minp = vector.add(vector.add(ppos, particles.min_pos), wind_pos)
local maxp = vector.add(vector.add(ppos, particles.max_pos), wind_pos)
local exp = particles.exptime
local vertical = math.abs(vector.normalize(vel).y) >= 0.6

View File

@ -2,6 +2,8 @@ if not climate_mod.settings.skybox then return end
local EFFECT_NAME = "climate_api:skybox"
local reset_data = {}
local function set_skybox(player, sky)
if not player.get_stars then return end
if sky.sky_data ~= nil then
@ -16,14 +18,14 @@ local function set_skybox(player, sky)
if sky.sun_data ~= nil then
player:set_sun(sky.sun_data)
end
if sky.stars_data ~= nil then
player:set_sun(sky.stars_data)
if sky.star_data ~= nil then
player:set_stars(sky.stars_data)
end
end
local function remove_skybox(player)
if not player.get_stars then return end
player:set_sky({ type = "regular", clouds = true})
player:set_sky({ type = "regular", clouds = true })
end
local function handle_effect(player_data)