From 76981af958daaf6427f69c884e69993ad26ba657 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sat, 30 Jan 2021 17:04:28 +0100 Subject: [PATCH] Remove unused variables and do some whitespace fixes --- src/abms.lua | 20 ++++++++++---------- src/falling_snow.lua | 16 ++++++++-------- src/mapgen_v6.lua | 2 +- src/sled.lua | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/abms.lua b/src/abms.lua index 0a77a2f..c6facb0 100644 --- a/src/abms.lua +++ b/src/abms.lua @@ -4,7 +4,7 @@ minetest.register_abm({ nodenames = {"default:dirt_with_snow"}, interval = 2, chance = 20, - action = function(pos, node) + action = function(pos) local name = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name local nodedef = minetest.registered_nodes[name] if name ~= "ignore" @@ -37,9 +37,9 @@ minetest.register_abm({ if intensity == 1 then minetest.set_node(pos, {name="default:water_source"}) elseif intensity == 2 then - minetest.set_node(pos, {name="default:water_flowing", param2=7}) + minetest.set_node(pos, {name="default:water_flowing", param2=7}) elseif intensity == 3 then - minetest.set_node(pos, {name="default:water_flowing", param2=3}) + minetest.set_node(pos, {name="default:water_flowing", param2=3}) --[[ LazyJ, you need to add param2, which defines the amount of the flowing water ~ HybridDog 2015_03_06 This was causing "melts=2" nodes to just disappear so I changed it to replace the node with a water_source for a couple seconds and then replace the water_source with @@ -61,11 +61,11 @@ minetest.register_abm({ -- the water to flow and spread before the -- water_source is changed to air. ~ LazyJ if minetest.get_node(pos).name == "default:water_source" then - minetest.add_node(pos,{name="air"}) - end - end) + minetest.add_node(pos,{name="air"}) + end + end) --]] - else + else return end end, @@ -78,7 +78,7 @@ minetest.register_abm({ --Water freezes when in contact with snow. minetest.register_abm({ nodenames = {"default:water_source"}, - -- Added "group:icemaker" and snowbrick. ~ LazyJ + -- Added "group:icemaker" and snowbrick. ~ LazyJ neighbors = {"default:snow", "default:snowblock", "snow:snow_brick", "group:icemaker"}, interval = 20, chance = 4, @@ -144,7 +144,7 @@ minetest.register_abm({ nodenames = {"snow:sapling_pine"}, interval = 10, chance = 50, - action = function(pos, node) + action = function(pos) -- Check if there is enough vertical-space for the sapling to grow without -- hitting anything else. ~ LazyJ, 2014_04_10 @@ -177,7 +177,7 @@ minetest.register_abm({ nodenames = {"snow:xmas_tree"}, interval = 10, chance = 50, - action = function(pos, node) + action = function(pos) -- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ for i = 1,8 do diff --git a/src/falling_snow.lua b/src/falling_snow.lua index b4f2758..b934590 100644 --- a/src/falling_snow.lua +++ b/src/falling_snow.lua @@ -1,6 +1,6 @@ -- Parameters -function snow_fall(pos, player, animate) +function snow_fall(pos) local ground_y = nil for y=pos.y+10,pos.y+20,1 do local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name @@ -128,7 +128,7 @@ if snow.enable_snowfall then local freeze = nval_temp < 35 local precip = nval_prec < (nval_humid - 50) / 50 + PRECOFF and nval_humid - grad * nval_temp > yint - + if snow.debug then precip = true end @@ -173,9 +173,9 @@ if snow.enable_snowfall then if freeze then -- Snowfall local extime = math.min((pposy + 12 - YLIMIT) / 2, 9) - + local x, y, z = pposx - 24 + math.random(0, 48), pposy + 12, pposz - 24 + math.random(0, 48) - + if not snow.lighter_snowfall then snow_fall({ x = x, @@ -183,11 +183,11 @@ if snow.enable_snowfall then z = z }, true) end - - for flake = 1, FLAKES do - + + for _ = 1, FLAKES do + x, y, z = pposx - 24 + math.random(0, 48), pposy + 12, pposz - 24 + math.random(0, 48) - + minetest.add_particle({ pos = { x = x, diff --git a/src/mapgen_v6.lua b/src/mapgen_v6.lua index 44794a5..950ddc4 100644 --- a/src/mapgen_v6.lua +++ b/src/mapgen_v6.lua @@ -577,7 +577,7 @@ local biome_strings = { {"snowy", "plain", "alpine", "normal", "normal"}, {"cool", "icebergs", "icesheet", "icecave", "icehole"} } -function biome_to_string(num,num2) +function biome_to_string(num) local biome = biome_strings[1][num] or "unknown "..num return biome end diff --git a/src/sled.lua b/src/sled.lua index e6af1fe..a53d5f3 100644 --- a/src/sled.lua +++ b/src/sled.lua @@ -156,7 +156,7 @@ function sled:on_rightclick(player) on_sled_click(self, player) end -function sled:on_activate(staticdata, dtime_s) +function sled:on_activate(staticdata) self.object:set_armor_groups({immortal=1}) self.object:setacceleration({x=0, y=-10, z=0}) if staticdata then