Merge pull request #40 from farribeiro/wind

Change to core namespace in wind
This commit is contained in:
Alexsandro Percy 2025-10-20 07:23:01 -03:00 committed by GitHub
commit 1a61644f6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)