mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-09 01:03:50 +01:00
Make grass block and friends snowed if placed below snow cover
This commit is contained in:
parent
576af661b1
commit
9fb148f8bf
@ -1107,7 +1107,8 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
---- Functions for snowed dirt-like blocks. ----
|
---- FUNCTIONS FOR SNOWED NODES ----
|
||||||
|
-- These are nodes which change their appearence when they are below a snow cover.
|
||||||
|
|
||||||
-- Lookup tables
|
-- Lookup tables
|
||||||
mcl_core.snowed_nodes = {}
|
mcl_core.snowed_nodes = {}
|
||||||
@ -1153,14 +1154,35 @@ mcl_core.clear_snow_dirt = function(pos, node)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---- [[[[[ Functions for snowable nodes (nodes that can become snowed). ]]]]] ----
|
||||||
|
-- Always add these for snowable nodes.
|
||||||
|
|
||||||
-- Functions for snow cover nodes. A snow cover node is a node which turns a snowed dirtlike
|
-- on_construct
|
||||||
|
-- Makes constructed snowable node snowed if placed below a snow cover node.
|
||||||
|
mcl_core.on_snowable_construct = function(pos)
|
||||||
|
-- Myself
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
|
||||||
|
-- Above
|
||||||
|
local apos = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||||
|
local anode = minetest.get_node(apos)
|
||||||
|
|
||||||
|
-- Make snowed if needed
|
||||||
|
if minetest.get_item_group(anode.name, "snow_cover") == 1 then
|
||||||
|
minetest.swap_node(pos, {name=mcl_core.snowed_nodes_reverse[node.name]})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---- [[[[[ Functions for snow cover nodes. ]]]]] ----
|
||||||
|
|
||||||
|
-- A snow cover node is a node which turns a snowed dirtlike --
|
||||||
-- node into its snowed form while it is placed above.
|
-- node into its snowed form while it is placed above.
|
||||||
-- MCL2's snow cover nodes are Top Snow (mcl_core:snow) and Snow (mcl_core:snowblock).
|
-- MCL2's snow cover nodes are Top Snow (mcl_core:snow) and Snow (mcl_core:snowblock).
|
||||||
|
|
||||||
-- Always add the following functions to snow cover nodes:
|
-- Always add the following functions to snow cover nodes:
|
||||||
|
|
||||||
-- on_construct
|
-- on_construct
|
||||||
|
-- Makes snowable node below snowed.
|
||||||
mcl_core.on_snow_construct = function(pos)
|
mcl_core.on_snow_construct = function(pos)
|
||||||
local npos = {x=pos.x, y=pos.y-1, z=pos.z}
|
local npos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
local node = minetest.get_node(npos)
|
local node = minetest.get_node(npos)
|
||||||
|
@ -307,6 +307,7 @@ minetest.register_node("mcl_core:dirt_with_grass", {
|
|||||||
sounds = mcl_sounds.node_sound_dirt_defaults({
|
sounds = mcl_sounds.node_sound_dirt_defaults({
|
||||||
footstep = {name="default_grass_footstep", gain=0.4},
|
footstep = {name="default_grass_footstep", gain=0.4},
|
||||||
}),
|
}),
|
||||||
|
on_construct = mcl_core.on_snowable_construct,
|
||||||
_mcl_blast_resistance = 3,
|
_mcl_blast_resistance = 3,
|
||||||
_mcl_hardness = 0.6,
|
_mcl_hardness = 0.6,
|
||||||
})
|
})
|
||||||
@ -347,6 +348,7 @@ minetest.register_node("mcl_core:mycelium", {
|
|||||||
sounds = mcl_sounds.node_sound_dirt_defaults({
|
sounds = mcl_sounds.node_sound_dirt_defaults({
|
||||||
footstep = {name="default_grass_footstep", gain=0.4},
|
footstep = {name="default_grass_footstep", gain=0.4},
|
||||||
}),
|
}),
|
||||||
|
on_construct = mcl_core.on_snowable_construct,
|
||||||
_mcl_blast_resistance = 2.5,
|
_mcl_blast_resistance = 2.5,
|
||||||
_mcl_hardness = 0.6,
|
_mcl_hardness = 0.6,
|
||||||
})
|
})
|
||||||
@ -361,6 +363,7 @@ minetest.register_node("mcl_core:podzol", {
|
|||||||
groups = {handy=1,shovely=3, soil=1, soil_sapling=2, soil_sugarcane=1, enderman_takable=1, building_block=1},
|
groups = {handy=1,shovely=3, soil=1, soil_sapling=2, soil_sugarcane=1, enderman_takable=1, building_block=1},
|
||||||
drop = 'mcl_core:dirt',
|
drop = 'mcl_core:dirt',
|
||||||
sounds = mcl_sounds.node_sound_dirt_defaults(),
|
sounds = mcl_sounds.node_sound_dirt_defaults(),
|
||||||
|
on_construct = mcl_core.on_snowable_construct,
|
||||||
_mcl_blast_resistance = 2.5,
|
_mcl_blast_resistance = 2.5,
|
||||||
_mcl_hardness = 0.6,
|
_mcl_hardness = 0.6,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user