mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
Update wind.lua
now we have random wind speed too
This commit is contained in:
parent
e93f33037c
commit
8a5fa95b31
1 changed files with 5 additions and 3 deletions
8
wind.lua
8
wind.lua
|
@ -33,8 +33,9 @@ if minetest.get_modpath("climate_api") then
|
||||||
|
|
||||||
else
|
else
|
||||||
local yaw = math.random()*math.pi*2-math.pi
|
local yaw = math.random()*math.pi*2-math.pi
|
||||||
|
local speed = math.random()*4.0
|
||||||
airutils.wind={}
|
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.timer = 0
|
||||||
airutils.wind.ttime = math.random()*5*60+1*60
|
airutils.wind.ttime = math.random()*5*60+1*60
|
||||||
|
|
||||||
|
@ -48,8 +49,9 @@ else
|
||||||
airutils.wind.timer=airutils.wind.timer+dtime
|
airutils.wind.timer=airutils.wind.timer+dtime
|
||||||
if airutils.wind.timer >= airutils.wind.ttime then
|
if airutils.wind.timer >= airutils.wind.ttime then
|
||||||
local yaw = minetest.dir_to_yaw(airutils.wind.wind)
|
local yaw = minetest.dir_to_yaw(airutils.wind.wind)
|
||||||
local yaw = yaw+math.random()-0.5
|
yaw = yaw+math.random()-0.5
|
||||||
airutils.wind.wind = vector.multiply(minetest.yaw_to_dir(yaw),4)
|
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
|
airutils.wind.ttime = airutils.wind.timer+math.random()*5*60+1*60
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Reference in a new issue