mirror of
https://github.com/APercy/airutils
synced 2025-11-14 18:57:58 +01:00
Merge pull request #40 from farribeiro/wind
Change to core namespace in wind
This commit is contained in:
commit
1a61644f6e
8
wind.lua
8
wind.lua
@ -24,7 +24,7 @@ SOFTWARE.
|
||||
|
||||
local get_wind
|
||||
|
||||
if minetest.get_modpath("climate_api") then
|
||||
if core.get_modpath("climate_api") then
|
||||
get_wind = function(pos, multiplier)
|
||||
multiplier = multiplier or 0.1
|
||||
local wind = climate_api.environment.get_wind({x=0,y=0,z=0})
|
||||
@ -35,7 +35,7 @@ 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),speed)
|
||||
airutils.wind.wind = vector.multiply(core.yaw_to_dir(yaw),speed)
|
||||
airutils.wind.timer = 0
|
||||
airutils.wind.ttime = math.random()*5*60+1*60
|
||||
|
||||
@ -44,11 +44,11 @@ else
|
||||
return retVal
|
||||
end
|
||||
|
||||
minetest.register_globalstep(
|
||||
core.register_globalstep(
|
||||
function(dtime)
|
||||
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 = core.dir_to_yaw(airutils.wind.wind)
|
||||
yaw = yaw+math.random()-0.5
|
||||
local speed = math.random()*4.0
|
||||
airutils.wind.wind = vector.multiply(minetest.yaw_to_dir(yaw),speed)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user