mirror of
https://github.com/Splizard/minetest-mod-snow.git
synced 2024-12-27 15:10:20 +01:00
Add a luacheckrc and fix errors reported by luacheck
* stairs is now added to depends.txt * The mapgen perlin noise functions use a buffer now
This commit is contained in:
parent
76981af958
commit
e8a15bf467
16
.luacheckrc
Normal file
16
.luacheckrc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
read_globals = {
|
||||||
|
"dump", "vector", "minetest",
|
||||||
|
"table", "math", "PseudoRandom", "VoxelArea",
|
||||||
|
"stairs", "stairsplus", "skins", "treecapitator",
|
||||||
|
default = {
|
||||||
|
fields = {
|
||||||
|
player_attached = {
|
||||||
|
read_only = false,
|
||||||
|
other_fields = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
other_fields = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
globals = {"snow"}
|
||||||
|
-- ignore = {"421", "423"}
|
@ -1,5 +1,6 @@
|
|||||||
default
|
default
|
||||||
flowers?
|
flowers?
|
||||||
|
stairs?
|
||||||
moreblocks?
|
moreblocks?
|
||||||
skins?
|
skins?
|
||||||
treecapitator?
|
treecapitator?
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
-- Added to change dirt_with_snow to dirt if covered with blocks that don't let light through (sunlight_propagates) or have a light paramtype and liquidtype combination. ~ LazyJ, 2014_03_08
|
-- Added to change dirt_with_snow to dirt if covered with blocks that don't let
|
||||||
|
-- light through (sunlight_propagates) or have a light paramtype and
|
||||||
|
-- liquidtype combination. ~ LazyJ, 2014_03_08
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"default:dirt_with_snow"},
|
nodenames = {"default:dirt_with_snow"},
|
||||||
@ -106,7 +108,10 @@ minetest.register_abm({
|
|||||||
if math.random(2) == 2 then
|
if math.random(2) == 2 then
|
||||||
p.y = pos.y
|
p.y = pos.y
|
||||||
if minetest.get_node(p).name == "default:water_source" then
|
if minetest.get_node(p).name == "default:water_source" then
|
||||||
minetest.add_node(p,{name="default:ice", param2 = math.random(0,node.param2-1)})
|
minetest.add_node(p, {
|
||||||
|
name = "default:ice",
|
||||||
|
param2 = math.random(0,node.param2-1)
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
function snow_fall(pos)
|
local function snow_fall(pos)
|
||||||
local ground_y = nil
|
local ground_y = nil
|
||||||
for y=pos.y+10,pos.y+20,1 do
|
for y=pos.y+10,pos.y+20,1 do
|
||||||
local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name
|
local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name
|
||||||
@ -32,8 +32,8 @@ local PRECSPR = 6 -- Time scale for precipitation variation in minutes
|
|||||||
local PRECOFF = -0.4 -- Precipitation offset, higher = rains more often
|
local PRECOFF = -0.4 -- Precipitation offset, higher = rains more often
|
||||||
local GSCYCLE = 0.5 -- Globalstep cycle (seconds)
|
local GSCYCLE = 0.5 -- Globalstep cycle (seconds)
|
||||||
local FLAKES = 32 -- Snowflakes per cycle
|
local FLAKES = 32 -- Snowflakes per cycle
|
||||||
local DROPS = 128 -- Raindrops per cycle
|
--~ local DROPS = 128 -- Raindrops per cycle
|
||||||
local RAINGAIN = 0.2 -- Rain sound volume
|
--~ local RAINGAIN = 0.2 -- Rain sound volume
|
||||||
local COLLIDE = false -- Whether particles collide with nodes
|
local COLLIDE = false -- Whether particles collide with nodes
|
||||||
local NISVAL = 39 -- Clouds RGB value at night
|
local NISVAL = 39 -- Clouds RGB value at night
|
||||||
local DASVAL = 175 -- Clouds RGB value in daytime
|
local DASVAL = 175 -- Clouds RGB value in daytime
|
||||||
@ -81,12 +81,6 @@ local grad = 14 / 95
|
|||||||
local yint = 1496 / 95
|
local yint = 1496 / 95
|
||||||
|
|
||||||
|
|
||||||
-- Initialise noise objects to nil
|
|
||||||
|
|
||||||
local nobj_temp = nil
|
|
||||||
local nobj_humid = nil
|
|
||||||
local nobj_prec = nil
|
|
||||||
|
|
||||||
|
|
||||||
-- Globalstep function
|
-- Globalstep function
|
||||||
local timer = 0
|
local timer = 0
|
||||||
@ -102,16 +96,16 @@ if snow.enable_snowfall then
|
|||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local ppos = player:getpos()
|
local pos_player = player:getpos()
|
||||||
local pposy = math.floor(ppos.y) + 2 -- Precipitation when swimming
|
local pposy = math.floor(pos_player.y) + 2 -- Precipitation when swimming
|
||||||
if pposy >= YLIMIT - 2 then
|
if pposy >= YLIMIT - 2 then
|
||||||
local pposx = math.floor(ppos.x)
|
local pposx = math.floor(pos_player.x)
|
||||||
local pposz = math.floor(ppos.z)
|
local pposz = math.floor(pos_player.z)
|
||||||
local ppos = {x = pposx, y = pposy, z = pposz}
|
local ppos = {x = pposx, y = pposy, z = pposz}
|
||||||
|
|
||||||
local nobj_temp = nobj_temp or minetest.get_perlin(np_temp)
|
local nobj_temp = minetest.get_perlin(np_temp)
|
||||||
local nobj_humid = nobj_humid or minetest.get_perlin(np_humid)
|
local nobj_humid = minetest.get_perlin(np_humid)
|
||||||
local nobj_prec = nobj_prec or minetest.get_perlin(np_prec)
|
local nobj_prec = minetest.get_perlin(np_prec)
|
||||||
|
|
||||||
local nval_temp = nobj_temp:get2d({x = pposx, y = pposz})
|
local nval_temp = nobj_temp:get2d({x = pposx, y = pposz})
|
||||||
local nval_humid = nobj_humid:get2d({x = pposx, y = pposz})
|
local nval_humid = nobj_humid:get2d({x = pposx, y = pposz})
|
||||||
@ -207,7 +201,7 @@ if snow.enable_snowfall then
|
|||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "snowdrift_snowflake" ..
|
texture = "snowdrift_snowflake" ..
|
||||||
math.random(1, 12) .. ".png",
|
math.random(1, 12) .. ".png",
|
||||||
playername = player:get_player_name()
|
playername = player_name
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -32,7 +32,6 @@ if not snow.disable_mapgen then
|
|||||||
nosmooth_rarity = 1-rarity/50
|
nosmooth_rarity = 1-rarity/50
|
||||||
perlin_scale = size*100/rarity
|
perlin_scale = size*100/rarity
|
||||||
mg.perlin_scale = perlin_scale
|
mg.perlin_scale = perlin_scale
|
||||||
local smooth_rarity_max, smooth_rarity_min, smooth_rarity_dif
|
|
||||||
if smooth then
|
if smooth then
|
||||||
local smooth_trans_size = 4 --snow.smooth_trans_size
|
local smooth_trans_size = 4 --snow.smooth_trans_size
|
||||||
mg.smooth_rarity_max = upper_rarity(nosmooth_rarity+smooth_trans_size*2/perlin_scale)
|
mg.smooth_rarity_max = upper_rarity(nosmooth_rarity+smooth_trans_size*2/perlin_scale)
|
||||||
@ -110,11 +109,11 @@ local xmas_tree = {
|
|||||||
--Makes pine tree
|
--Makes pine tree
|
||||||
function snow.make_pine(pos,snow,xmas)
|
function snow.make_pine(pos,snow,xmas)
|
||||||
local minetest = minetest
|
local minetest = minetest
|
||||||
local try_node = function(pos, node)
|
local function try_node(p, node)
|
||||||
local n = minetest.get_node(pos).name
|
local n = minetest.get_node(p).name
|
||||||
if n == "air"
|
if n == "air"
|
||||||
or n == "ignore" then
|
or n == "ignore" then
|
||||||
minetest.add_node(pos, node)
|
minetest.add_node(p, node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if xmas then
|
if xmas then
|
||||||
@ -150,13 +149,12 @@ function snow.voxelmanip_pine(pos,a,data)
|
|||||||
local c_snow = minetest.get_content_id("default:snow")
|
local c_snow = minetest.get_content_id("default:snow")
|
||||||
local c_pine_needles = minetest.get_content_id("snow:needles")
|
local c_pine_needles = minetest.get_content_id("snow:needles")
|
||||||
local c_pinetree = minetest.get_content_id("default:pinetree")
|
local c_pinetree = minetest.get_content_id("default:pinetree")
|
||||||
local c_air = minetest.get_content_id("air")
|
|
||||||
|
|
||||||
local perlin1 = minetest.get_perlin(112,3, 0.5, perlin_scale)
|
local perlin1 = minetest.get_perlin(112,3, 0.5, perlin_scale)
|
||||||
for z = -1,1 do
|
for off_z = -1,1 do
|
||||||
local z = pos.z + z
|
local z = pos.z + off_z
|
||||||
for x = -1,1 do
|
for off_x = -1,1 do
|
||||||
local x = pos.x + x
|
local x = pos.x + off_x
|
||||||
|
|
||||||
--Make tree.
|
--Make tree.
|
||||||
for i = 1,2 do
|
for i = 1,2 do
|
||||||
|
@ -14,11 +14,11 @@ local np_default = {
|
|||||||
-- 2D noise for coldness
|
-- 2D noise for coldness
|
||||||
|
|
||||||
local mg = snow.mapgen
|
local mg = snow.mapgen
|
||||||
local scale = mg.perlin_scale
|
local scale_coldness = mg.perlin_scale
|
||||||
local np_cold = {
|
local np_cold = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
spread = {x=scale, y=scale, z=scale},
|
spread = {x=scale_coldness, y=scale_coldness, z=scale_coldness},
|
||||||
seed = 112,
|
seed = 112,
|
||||||
octaves = 3,
|
octaves = 3,
|
||||||
persist = 0.5
|
persist = 0.5
|
||||||
@ -186,7 +186,9 @@ local function get_perlins(sidelen)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local nbuf_default, nbuf_cold, nbuf_ice
|
local nbuf_default = {}
|
||||||
|
local nbuf_cold = {}
|
||||||
|
local nbuf_ice = {}
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
local t1 = os.clock()
|
local t1 = os.clock()
|
||||||
|
|
||||||
@ -229,7 +231,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local nodes_added
|
local nodes_added
|
||||||
|
|
||||||
-- Loop through columns in chunk
|
-- Loop through columns in chunk
|
||||||
local smooth = smooth and not snowy
|
local is_smooth = smooth and not snowy
|
||||||
local write_to_map = false
|
local write_to_map = false
|
||||||
local ni = 1
|
local ni = 1
|
||||||
for z = z0, z1 do
|
for z = z0, z1 do
|
||||||
@ -239,7 +241,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if nvals_default[ni] < 0.35 then
|
if nvals_default[ni] < 0.35 then
|
||||||
nvals_cold = nvals_cold or perlin_objs.cold:get2dMap_flat({x=x0, y=z0}, nbuf_cold)
|
nvals_cold = nvals_cold or perlin_objs.cold:get2dMap_flat({x=x0, y=z0}, nbuf_cold)
|
||||||
test = math.min(nvals_cold[ni], 1)
|
test = math.min(nvals_cold[ni], 1)
|
||||||
if smooth then
|
if is_smooth then
|
||||||
if test >= smooth_rarity_max
|
if test >= smooth_rarity_max
|
||||||
or (
|
or (
|
||||||
test > smooth_rarity_min
|
test > smooth_rarity_min
|
||||||
@ -255,7 +257,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if not in_biome then
|
if not in_biome then
|
||||||
if alpine
|
if alpine
|
||||||
and test
|
and test
|
||||||
and test > (smooth and smooth_rarity_min or nosmooth_rarity) then
|
and test > (is_smooth and smooth_rarity_min or nosmooth_rarity) then
|
||||||
-- remove trees near alpine
|
-- remove trees near alpine
|
||||||
local ground_y
|
local ground_y
|
||||||
if data[area:index(x, maxp.y, z)] == c.air then
|
if data[area:index(x, maxp.y, z)] == c.air then
|
||||||
@ -345,7 +347,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
data[area:index(x, ground_y+1, z)] = c.dry_shrub
|
data[area:index(x, ground_y+1, z)] = c.dry_shrub
|
||||||
else
|
else
|
||||||
if snowy
|
if snowy
|
||||||
or test > (smooth and smooth_rarity_max or
|
or test > (is_smooth and smooth_rarity_max or
|
||||||
nosmooth_rarity) then
|
nosmooth_rarity) then
|
||||||
-- more, deeper snow
|
-- more, deeper snow
|
||||||
data[node] = c.snow_block
|
data[node] = c.snow_block
|
||||||
@ -388,13 +390,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
and (cool or icebergs)
|
and (cool or icebergs)
|
||||||
and pr:next(1,4) == 1 then
|
and pr:next(1,4) == 1 then
|
||||||
|
|
||||||
local vi = node + 1
|
local vi_ice = node + 1
|
||||||
for i = 1,6 do
|
for i = 1,6 do
|
||||||
if data[vi] == c.ice then
|
if data[vi_ice] == c.ice then
|
||||||
ice = true
|
ice = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
vi = vi + ndia[i]
|
vi_ice = vi_ice + ndia[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -505,8 +507,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
-- set snow
|
-- set snow
|
||||||
data[area:index(i[3], i[1]+1, i[2])] = c.snow
|
data[area:index(i[3], i[1]+1, i[2])] = c.snow
|
||||||
end
|
end
|
||||||
for i = 1, num-1 do
|
for k = 1, num-1 do
|
||||||
i = snow_tab[i]
|
local i = snow_tab[k]
|
||||||
local y,z,x,test = unpack(i)
|
local y,z,x,test = unpack(i)
|
||||||
test = (test-nosmooth_rarity)/(1-nosmooth_rarity) -- /(1-0.53)
|
test = (test-nosmooth_rarity)/(1-nosmooth_rarity) -- /(1-0.53)
|
||||||
if test > 0 then
|
if test > 0 then
|
||||||
@ -516,8 +518,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if h ~= 1 then
|
if h ~= 1 then
|
||||||
-- search for nearby snow
|
-- search for nearby snow
|
||||||
y = y+1
|
y = y+1
|
||||||
for i = -1,1,2 do
|
for off = -1,1,2 do
|
||||||
for _,cord in pairs({{x+i,z}, {x,z+i}}) do
|
for _,cord in pairs({{x+off,z}, {x,z+off}}) do
|
||||||
local nd = data[area:index(cord[1], y, cord[2])]
|
local nd = data[area:index(cord[1], y, cord[2])]
|
||||||
if nd == c.air
|
if nd == c.air
|
||||||
or is_plantlike(nd) then
|
or is_plantlike(nd) then
|
||||||
|
@ -82,9 +82,11 @@ if snow.disable_deco_needle_ani then
|
|||||||
else
|
else
|
||||||
-- Animated, "blinking lights" version. ~ LazyJ
|
-- Animated, "blinking lights" version. ~ LazyJ
|
||||||
nodedef.inventory_image = minetest.inventorycube("snow_needles_decorated.png")
|
nodedef.inventory_image = minetest.inventorycube("snow_needles_decorated.png")
|
||||||
nodedef.tiles = {
|
nodedef.tiles = {{
|
||||||
{name="snow_needles_decorated_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=20.0}}
|
name="snow_needles_decorated_animated.png",
|
||||||
}
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16,
|
||||||
|
length=20.0}
|
||||||
|
}}
|
||||||
end
|
end
|
||||||
nodedef.drop.items[#nodedef.drop.items] = {items = {'snow:needles_decorated'}}
|
nodedef.drop.items[#nodedef.drop.items] = {items = {'snow:needles_decorated'}}
|
||||||
|
|
||||||
@ -129,9 +131,13 @@ nodedef = {
|
|||||||
walkable = false,
|
walkable = false,
|
||||||
-- Don't want the ornament breaking too easily because you have to punch it to turn it on and off. ~ LazyJ
|
-- Don't want the ornament breaking too easily because you have to punch it to turn it on and off. ~ LazyJ
|
||||||
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1},
|
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1},
|
||||||
-- Breaking "glass" sound makes it sound like a real, broken, Xmas tree ornament (Sorry, Mom!). ;)- ~ LazyJ
|
-- Breaking "glass" sound makes it sound like a real, broken, Xmas tree
|
||||||
sounds = default.node_sound_glass_defaults({dig = {name="default_glass_footstep", gain=0.2}}),
|
-- ornament (Sorry, Mom!). ;)- ~ LazyJ
|
||||||
on_punch = function(pos, node) -- Added a "lit" star that can be punched on or off depending on your preference. ~ LazyJ
|
sounds = default.node_sound_glass_defaults(
|
||||||
|
{dig = {name="default_glass_footstep", gain=0.2}}),
|
||||||
|
-- Added a "lit" star that can be punched on or off depending on your
|
||||||
|
-- preference. ~ LazyJ
|
||||||
|
on_punch = function(pos, node)
|
||||||
node.name = "snow:star_lit"
|
node.name = "snow:star_lit"
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
end,
|
end,
|
||||||
@ -142,7 +148,7 @@ minetest.register_node("snow:star", table.copy(nodedef))
|
|||||||
|
|
||||||
-- Star (Lit Version) on Xmas Trees
|
-- Star (Lit Version) on Xmas Trees
|
||||||
nodedef.description = nodedef.description.." Lighted"
|
nodedef.description = nodedef.description.." Lighted"
|
||||||
nodedef.light_source = LIGHT_MAX
|
nodedef.light_source = minetest.LIGHT_MAX
|
||||||
nodedef.tiles = {"snow_star_lit.png"}
|
nodedef.tiles = {"snow_star_lit.png"}
|
||||||
nodedef.drop = "snow:star"
|
nodedef.drop = "snow:star"
|
||||||
nodedef.groups.not_in_creative_inventory = 1
|
nodedef.groups.not_in_creative_inventory = 1
|
||||||
@ -374,7 +380,8 @@ minetest.override_item("default:snowblock", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
-- Snow blocks should be easy to dig because they are just fluffy snow. ~ LazyJ
|
-- Snow blocks should be easy to dig because they are just fluffy snow. ~ LazyJ
|
||||||
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=1, icemaker=1, cooks_into_ice=1, falling_node=1},
|
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, melts=1,
|
||||||
|
icemaker=1, cooks_into_ice=1, falling_node=1},
|
||||||
--drop = "snow:snow_cobble",
|
--drop = "snow:snow_cobble",
|
||||||
on_construct = snow_onto_dirt
|
on_construct = snow_onto_dirt
|
||||||
-- Thinking in terms of layers, dirt_with_snow could also double as
|
-- Thinking in terms of layers, dirt_with_snow could also double as
|
||||||
|
@ -53,8 +53,6 @@ than I originally planned. :p ~ LazyJ
|
|||||||
-- Helper functions
|
-- Helper functions
|
||||||
--
|
--
|
||||||
|
|
||||||
vector.zero = vector.zero or {x=0, y=0, z=0}
|
|
||||||
|
|
||||||
local function table_find(t, v)
|
local function table_find(t, v)
|
||||||
for i = 1,#t do
|
for i = 1,#t do
|
||||||
if t[i] == v then
|
if t[i] == v then
|
||||||
|
@ -114,14 +114,14 @@ function snow_snowball_ENTITY.on_activate(self)
|
|||||||
and vel.y ~= 0 then
|
and vel.y ~= 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.after(0, function(obj)
|
minetest.after(0, function(object)
|
||||||
if not obj then
|
if not object then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local vel = obj:getvelocity()
|
local vel_obj = object:getvelocity()
|
||||||
if not vel
|
if not vel_obj
|
||||||
or vel.y == 0 then
|
or vel_obj.y == 0 then
|
||||||
obj:remove()
|
object:remove()
|
||||||
end
|
end
|
||||||
end, obj)
|
end, obj)
|
||||||
end, self.object)
|
end, self.object)
|
||||||
@ -214,7 +214,7 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
|||||||
minetest.sound_play("default_snow_footstep", {pos=pos, gain=gain})
|
minetest.sound_play("default_snow_footstep", {pos=pos, gain=gain})
|
||||||
|
|
||||||
-- spawn_falling_node
|
-- spawn_falling_node
|
||||||
local obj = core.add_entity(pos, "__builtin:falling_node")
|
local obj = minetest.add_entity(pos, "__builtin:falling_node")
|
||||||
if obj then
|
if obj then
|
||||||
obj:get_luaentity():set_node{name = "default:snow"}
|
obj:get_luaentity():set_node{name = "default:snow"}
|
||||||
else
|
else
|
||||||
@ -265,11 +265,16 @@ minetest.register_node(":default:snow", {
|
|||||||
dug = {name="default_snow_footstep", gain=0.75},
|
dug = {name="default_snow_footstep", gain=0.75},
|
||||||
}),
|
}),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:dirt_with_grass" or minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:dirt" then
|
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||||
|
== "default:dirt_with_grass"
|
||||||
|
or minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:dirt" then
|
||||||
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="default:dirt_with_snow"})
|
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="default:dirt_with_snow"})
|
||||||
end
|
end
|
||||||
-- Now, let's turn the snow pile into a snowblock. ~ LazyJ
|
-- Now, let's turn the snow pile into a snowblock. ~ LazyJ
|
||||||
if minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name == "default:snow" and -- Minus 2 because at the end of this, the layer that triggers the change to a snowblock is the second layer more than a full block, starting into a second block (-2) ~ LazyJ, 2014_04_11
|
if minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name == "default:snow"
|
||||||
|
and -- Minus 2 because at the end of this, the layer that triggers
|
||||||
|
--the change to a snowblock is the second layer more than a full block,
|
||||||
|
--starting into a second block (-2) ~ LazyJ, 2014_04_11
|
||||||
minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "default:snow" then
|
minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "default:snow" then
|
||||||
minetest.set_node({x=pos.x, y=pos.y-2, z=pos.z}, {name="default:snowblock"})
|
minetest.set_node({x=pos.x, y=pos.y-2, z=pos.z}, {name="default:snowblock"})
|
||||||
end
|
end
|
||||||
|
@ -18,6 +18,8 @@ snow = {
|
|||||||
|
|
||||||
-- functions for dynamically changing settings
|
-- functions for dynamically changing settings
|
||||||
|
|
||||||
|
snow.register_on_configuring = function() end
|
||||||
|
--[[
|
||||||
local on_configurings,n = {},1
|
local on_configurings,n = {},1
|
||||||
function snow.register_on_configuring(func)
|
function snow.register_on_configuring(func)
|
||||||
on_configurings[n] = func
|
on_configurings[n] = func
|
||||||
@ -50,3 +52,4 @@ local function value_from_string(v)
|
|||||||
end
|
end
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
|
--]]
|
||||||
|
Loading…
Reference in New Issue
Block a user