Update wind.lua

now we have random wind speed too
This commit is contained in:
Alexsandro Percy 2023-03-20 09:12:19 -03:00 committed by GitHub
parent e93f33037c
commit 8a5fa95b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -33,8 +33,9 @@ if minetest.get_modpath("climate_api") then
else
local yaw = math.random()*math.pi*2-math.pi
local speed = math.random()*4.0
airutils.wind={}
airutils.wind.wind = vector.multiply(minetest.yaw_to_dir(yaw),4)
airutils.wind.wind = vector.multiply(minetest.yaw_to_dir(yaw),speed)
airutils.wind.timer = 0
airutils.wind.ttime = math.random()*5*60+1*60
@ -48,8 +49,9 @@ else
airutils.wind.timer=airutils.wind.timer+dtime
if airutils.wind.timer >= airutils.wind.ttime then
local yaw = minetest.dir_to_yaw(airutils.wind.wind)
local yaw = yaw+math.random()-0.5
airutils.wind.wind = vector.multiply(minetest.yaw_to_dir(yaw),4)
yaw = yaw+math.random()-0.5
local speed = math.random()*4.0
airutils.wind.wind = vector.multiply(minetest.yaw_to_dir(yaw),speed)
airutils.wind.ttime = airutils.wind.timer+math.random()*5*60+1*60
end
end)