diff --git a/src/falling_snow.lua b/src/falling_snow.lua index 2cc4279..a3e6979 100644 --- a/src/falling_snow.lua +++ b/src/falling_snow.lua @@ -79,6 +79,10 @@ minetest.register_globalstep(function(dtime) end end) +local function infolog(msg) + minetest.log("info", "[snow] falling_snow: "..msg) +end + -- copied from meru mod local SEEDDIFF3 = 9130 -- 9130 -- Values should match minetest mapgen desert perlin. local OCTAVES3 = 3 -- 3 @@ -110,7 +114,7 @@ local function get_snow(pos) return true end -local addvectors = vector and vector.add +local addvectors = vector.add --Returns a random position between minp and maxp. local function randpos(minp, maxp) @@ -247,16 +251,20 @@ end) if snow.enable_snowfall then step_func = calc_snowfall + infolog("step function set to calc_snowfall") else step_func = function() end + infolog("step function set to empty function") end snow.register_on_configuring(function(name, v) if name == "enable_snowfall" then if v then step_func = calc_snowfall + infolog("step function set to calc_snowfall") else step_func = function() end + infolog("step function set to empty function") end elseif name == "lighter_snowfall" then lighter_snowfall = v diff --git a/src/mapgen_v6.lua b/src/mapgen_v6.lua index 8384400..d72515c 100644 --- a/src/mapgen_v6.lua +++ b/src/mapgen_v6.lua @@ -59,6 +59,8 @@ local function get_ws_value(a, x) end else ws_values[a] = {} + -- weak table, see https://www.lua.org/pil/17.1.html + setmetatable(ws_values[a], {__mode = "v"}) end v = do_ws_func(a, x) ws_values[a][x] = v