mirror of
https://codeberg.org/Wuzzy/pride_flags.git
synced 2025-03-15 04:41:21 +00:00
Fix deprecation warning for get2d call
This commit is contained in:
parent
52097be084
commit
201db6bd8a
1 changed files with 15 additions and 1 deletions
16
init.lua
16
init.lua
|
@ -6,6 +6,13 @@
|
|||
--------------------------------------------------------
|
||||
|
||||
local wind_noise = PerlinNoise( 204, 1, 0, 500 )
|
||||
-- Check whether the new `get_2d` Perlin function is available,
|
||||
-- otherwise use `get2d`. Needed to suppress deprecation
|
||||
-- warning in newer Minetest versions.
|
||||
local old_get2d = true
|
||||
if wind_noise.get_2d then
|
||||
old_get2d = false
|
||||
end
|
||||
local active_flags = { }
|
||||
|
||||
local pi = math.pi
|
||||
|
@ -71,7 +78,14 @@ minetest.register_entity( "pride_flags:wavingflag", {
|
|||
end,
|
||||
|
||||
reset_animation = function ( self, start_frame )
|
||||
local cur_wind = wind_noise:get2d( { x = os.time( ) % 65535, y = 0 } ) * 30 + 30
|
||||
local coords = { x = os.time( ) % 65535, y = 0 }
|
||||
local cur_wind
|
||||
if old_get2d then
|
||||
cur_wind = wind_noise:get2d(coords)
|
||||
else
|
||||
cur_wind = wind_noise:get_2d(coords)
|
||||
end
|
||||
cur_wind = cur_wind * 30 + 30
|
||||
minetest.log("verbose", "[pride_flags] Current wind: " .. cur_wind)
|
||||
local anim_speed
|
||||
local wave_sound
|
||||
|
|
Loading…
Add table
Reference in a new issue