2014-06-04 00:34:58 +02:00
|
|
|
-- NODES
|
|
|
|
|
|
|
|
-- Pine Needles
|
2015-06-12 18:11:45 +02:00
|
|
|
local nodedef = {
|
2014-06-04 00:34:58 +02:00
|
|
|
description = "Pine Needles",
|
|
|
|
drawtype = "allfaces_optional",
|
|
|
|
visual_scale = 1.3,
|
|
|
|
tiles = {"snow_needles.png"},
|
|
|
|
waving = 1,
|
|
|
|
paramtype = "light",
|
|
|
|
groups = {snappy=3, leafdecay=5},
|
2015-06-12 18:11:45 +02:00
|
|
|
furnace_burntime = 1,
|
2014-06-04 00:34:58 +02:00
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
|
|
|
{
|
|
|
|
-- player will get sapling with 1/20 chance
|
|
|
|
items = {'snow:sapling_pine'},
|
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
items = {'snow:needles'},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2015-06-12 18:11:45 +02:00
|
|
|
}
|
2014-06-04 00:34:58 +02:00
|
|
|
|
|
|
|
--[[
|
|
|
|
If christmas_content is enabled, then this next part will override the pine needles' drop code
|
|
|
|
(in the code section above) and adds Xmas tree saplings to the items that are dropped.
|
|
|
|
The Xmas tree needles are registred and defined a farther down in this nodes.lua file.
|
|
|
|
|
|
|
|
~ LazyJ
|
2015-06-12 18:11:45 +02:00
|
|
|
]]
|
2014-06-04 00:34:58 +02:00
|
|
|
if snow.christmas_content then
|
2015-06-12 18:11:45 +02:00
|
|
|
table.insert(nodedef.drop.items, 1, {
|
|
|
|
-- player will get xmas tree with 1/120 chance
|
2015-11-22 01:21:21 +01:00
|
|
|
items = {"snow:xmas_tree"},
|
2015-06-12 18:11:45 +02:00
|
|
|
rarity = 120,
|
2014-06-04 00:34:58 +02:00
|
|
|
})
|
2015-05-29 12:11:17 +02:00
|
|
|
end
|
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
minetest.register_node("snow:needles", table.copy(nodedef))
|
|
|
|
|
2015-11-22 01:21:21 +01:00
|
|
|
snow.register_on_configuring(function(name, v)
|
|
|
|
if name == "christmas_content" then
|
|
|
|
local drop = minetest.registered_nodes["snow:needles"].drop
|
|
|
|
if v then
|
|
|
|
table.insert(drop.items, 1, {
|
|
|
|
items = {"snow:xmas_tree"},
|
|
|
|
rarity = 120,
|
|
|
|
})
|
|
|
|
else
|
|
|
|
table.remove(drop.items, 1)
|
|
|
|
end
|
|
|
|
minetest.override_item("snow:needles", {drop = drop})
|
|
|
|
end
|
|
|
|
end)
|
2015-06-12 18:11:45 +02:00
|
|
|
|
|
|
|
|
2015-05-29 12:11:17 +02:00
|
|
|
|
2016-07-31 18:32:49 +02:00
|
|
|
-- Christmas egg
|
|
|
|
if minetest.global_exists"skins" then
|
|
|
|
skins.add"character_snow_man"
|
2014-06-04 00:34:58 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Decorated Pine Leaves
|
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
nodedef.description ="Decorated "..nodedef.description
|
|
|
|
nodedef.light_source = 5
|
|
|
|
nodedef.waving = nil
|
|
|
|
if snow.disable_deco_needle_ani then
|
|
|
|
nodedef.tiles = {"snow_needles_decorated.png"}
|
|
|
|
else
|
|
|
|
-- Animated, "blinking lights" version. ~ LazyJ
|
|
|
|
nodedef.inventory_image = minetest.inventorycube("snow_needles_decorated.png")
|
|
|
|
nodedef.tiles = {
|
|
|
|
{name="snow_needles_decorated_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=20.0}}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
nodedef.drop.items[#nodedef.drop.items] = {items = {'snow:needles_decorated'}}
|
2014-06-04 00:34:58 +02:00
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
minetest.register_node("snow:needles_decorated", nodedef)
|
2014-06-04 00:34:58 +02:00
|
|
|
|
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
-- Saplings
|
2014-06-04 00:34:58 +02:00
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
nodedef = {
|
2014-06-04 00:34:58 +02:00
|
|
|
description = "Pine Sapling",
|
|
|
|
drawtype = "plantlike",
|
|
|
|
visual_scale = 1.0,
|
|
|
|
tiles = {"snow_sapling_pine.png"},
|
|
|
|
inventory_image = "snow_sapling_pine.png",
|
|
|
|
wield_image = "snow_sapling_pine.png",
|
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
groups = {snappy=2,dig_immediate=3},
|
2015-06-12 18:11:45 +02:00
|
|
|
furnace_burntime = 10,
|
2014-06-04 00:34:58 +02:00
|
|
|
sounds = default.node_sound_defaults(),
|
2015-06-12 18:11:45 +02:00
|
|
|
}
|
2015-05-29 12:11:17 +02:00
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
-- Pine Sapling
|
|
|
|
minetest.register_node("snow:sapling_pine", table.copy(nodedef))
|
|
|
|
|
|
|
|
-- Xmas Tree Sapling
|
|
|
|
nodedef.description = "Christmas Tree"
|
|
|
|
nodedef.tiles = {"snow_xmas_tree.png"}
|
|
|
|
nodedef.inventory_image = "snow_xmas_tree.png"
|
|
|
|
nodedef.wield_image = "snow_xmas_tree.png"
|
2014-06-04 00:34:58 +02:00
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
minetest.register_node("snow:xmas_tree", nodedef)
|
2014-06-04 00:34:58 +02:00
|
|
|
|
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
nodedef = {
|
2014-06-04 00:34:58 +02:00
|
|
|
description = "Star",
|
2015-06-12 18:11:45 +02:00
|
|
|
drawtype = "plantlike",
|
2014-06-04 00:34:58 +02:00
|
|
|
tiles = {"snow_star.png"},
|
|
|
|
inventory_image = "snow_star.png",
|
|
|
|
wield_image = "snow_star.png",
|
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
2015-06-12 18:11:45 +02:00
|
|
|
-- 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},
|
|
|
|
-- Breaking "glass" sound makes it sound like a real, broken, Xmas tree ornament (Sorry, Mom!). ;)- ~ LazyJ
|
|
|
|
sounds = default.node_sound_glass_defaults({dig = {name="default_glass_footstep", gain=0.2}}),
|
2015-05-23 19:53:30 +02:00
|
|
|
on_punch = function(pos, node) -- Added a "lit" star that can be punched on or off depending on your preference. ~ LazyJ
|
|
|
|
node.name = "snow:star_lit"
|
|
|
|
minetest.set_node(pos, node)
|
2014-06-04 00:34:58 +02:00
|
|
|
nodeupdate(pos)
|
|
|
|
end,
|
2015-06-12 18:11:45 +02:00
|
|
|
}
|
2014-06-04 00:34:58 +02:00
|
|
|
|
2015-06-12 18:11:45 +02:00
|
|
|
-- Star on Xmas Trees
|
|
|
|
minetest.register_node("snow:star", table.copy(nodedef))
|
2014-06-04 00:34:58 +02:00
|
|
|
|
|
|
|
-- Star (Lit Version) on Xmas Trees
|
2015-06-12 18:11:45 +02:00
|
|
|
nodedef.description = nodedef.description.." Lighted"
|
|
|
|
nodedef.light_source = LIGHT_MAX
|
|
|
|
nodedef.tiles = {"snow_star_lit.png"}
|
|
|
|
nodedef.drop = "snow:star"
|
|
|
|
nodedef.groups.not_in_creative_inventory = 1
|
|
|
|
nodedef.on_punch = function(pos, node)
|
|
|
|
node.name = "snow:star"
|
|
|
|
minetest.set_node(pos, node)
|
|
|
|
nodeupdate(pos)
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_node("snow:star_lit", nodedef)
|
2014-06-04 00:34:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-17 18:57:11 +02:00
|
|
|
-- Plants
|
|
|
|
|
2014-06-04 00:34:58 +02:00
|
|
|
-- Moss
|
|
|
|
minetest.register_node("snow:moss", {
|
|
|
|
description = "Moss",
|
2015-03-06 19:40:51 +01:00
|
|
|
inventory_image = "snow_moss.png",
|
2014-06-04 00:34:58 +02:00
|
|
|
tiles = {"snow_moss.png"},
|
|
|
|
drawtype = "signlike",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {crumbly=3, attached_node=1},
|
2015-06-19 19:07:38 +02:00
|
|
|
furnace_burntime = 3,
|
2014-06-04 00:34:58 +02:00
|
|
|
})
|
|
|
|
|
2015-06-17 19:29:43 +02:00
|
|
|
-- Shrub(s)
|
|
|
|
nodedef = {
|
2015-06-17 18:57:11 +02:00
|
|
|
description = "Snow Shrub",
|
|
|
|
tiles = {"snow_shrub.png"},
|
|
|
|
inventory_image = "snow_shrub.png",
|
|
|
|
wield_image = "snow_shrub.png",
|
|
|
|
drawtype = "plantlike",
|
|
|
|
paramtype = "light",
|
|
|
|
waving = 1,
|
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = false,
|
|
|
|
is_ground_content = true,
|
|
|
|
buildable_to = true,
|
|
|
|
groups = {snappy=3,flammable=3,attached_node=1},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.3, -0.5, -0.3, 0.3, -5/16, 0.3},
|
|
|
|
},
|
2015-06-19 19:07:38 +02:00
|
|
|
furnace_burntime = 5,
|
2015-06-17 19:29:43 +02:00
|
|
|
}
|
|
|
|
minetest.register_node("snow:shrub", table.copy(nodedef))
|
|
|
|
|
|
|
|
nodedef.tiles = {"snow_shrub.png^snow_shrub_covering.png"}
|
|
|
|
nodedef.inventory_image = "snow_shrub.png^snow_shrub_covering.png"
|
|
|
|
nodedef.wield_image = "snow_shrub.png^snow_shrub_covering.png"
|
2015-11-21 21:26:45 +01:00
|
|
|
nodedef.paramtype2 = "degrotate"
|
2015-06-17 19:29:43 +02:00
|
|
|
nodedef.drop = "snow:shrub"
|
2015-06-19 19:07:38 +02:00
|
|
|
nodedef.furnace_burntime = 3
|
2015-06-17 19:29:43 +02:00
|
|
|
minetest.register_node("snow:shrub_covered", nodedef)
|
2015-06-17 18:57:11 +02:00
|
|
|
|
2015-06-19 21:21:36 +02:00
|
|
|
-- Flowers
|
2015-06-13 16:51:14 +02:00
|
|
|
if rawget(_G, "flowers") then
|
|
|
|
-- broken flowers
|
|
|
|
snow.known_plants = {}
|
|
|
|
for _,name in pairs({"dandelion_yellow", "geranium", "rose", "tulip", "dandelion_white", "viola"}) do
|
|
|
|
local flowername = "flowers:"..name
|
|
|
|
local newname = "snow:flower_"..name
|
|
|
|
local flower = minetest.registered_nodes[flowername]
|
|
|
|
minetest.register_node(newname, {
|
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = { "snow_" .. name .. ".png" },
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype = "light",
|
2015-11-21 21:26:45 +01:00
|
|
|
paramtype2 = "degrotate",
|
2015-06-13 16:51:14 +02:00
|
|
|
walkable = false,
|
|
|
|
drop = "",
|
|
|
|
groups = {snappy=3, attached_node = 1},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
selection_box = flower.selection_box
|
|
|
|
})
|
|
|
|
snow.known_plants[minetest.get_content_id(flowername)] = minetest.get_content_id(newname)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-19 21:21:36 +02:00
|
|
|
-- Leaves
|
|
|
|
local leaves = minetest.registered_nodes["default:leaves"]
|
|
|
|
nodedef = {
|
|
|
|
description = "Snow Leaves",
|
|
|
|
tiles = {"snow_leaves.png"},
|
|
|
|
waving = 1,
|
|
|
|
visual_scale = leaves.visual_scale,
|
|
|
|
drawtype = leaves.drawtype,
|
|
|
|
paramtype = leaves.paramtype,
|
|
|
|
groups = leaves.groups,
|
|
|
|
drop = leaves.drop,
|
|
|
|
sounds = leaves.sounds,
|
|
|
|
}
|
|
|
|
nodedef.groups.flammable = 1
|
|
|
|
|
|
|
|
minetest.register_node("snow:leaves", nodedef)
|
|
|
|
snow.known_plants[minetest.get_content_id("default:leaves")] = minetest.get_content_id("snow:leaves")
|
|
|
|
|
2015-06-19 22:03:59 +02:00
|
|
|
local apple = minetest.registered_nodes["default:apple"]
|
|
|
|
nodedef = {
|
|
|
|
description = "Snow Apple",
|
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"snow_apple.png"},
|
|
|
|
paramtype = "light",
|
2015-11-21 21:26:45 +01:00
|
|
|
paramtype2 = "degrotate",
|
2015-06-19 22:03:59 +02:00
|
|
|
walkable = false,
|
|
|
|
sunlight_propagates = apple.sunlight_propagates,
|
|
|
|
selection_box = apple.selection_box,
|
|
|
|
groups = apple.groups,
|
|
|
|
sounds = apple.sounds,
|
|
|
|
drop = apple.drop,
|
|
|
|
}
|
|
|
|
nodedef.groups.flammable = 1
|
|
|
|
|
|
|
|
minetest.register_node("snow:apple", nodedef)
|
|
|
|
snow.known_plants[minetest.get_content_id("default:apple")] = minetest.get_content_id("snow:apple")
|
|
|
|
|
2015-06-19 21:21:36 +02:00
|
|
|
-- TODO
|
|
|
|
snow.known_plants[minetest.get_content_id("default:jungleleaves")] = minetest.get_content_id("default:jungleleaves")
|
|
|
|
|
2015-06-13 16:51:14 +02:00
|
|
|
|
2014-06-04 00:34:58 +02:00
|
|
|
|
2015-03-05 16:58:57 +01:00
|
|
|
local function snow_onto_dirt(pos)
|
|
|
|
pos.y = pos.y - 1
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
if node.name == "default:dirt_with_grass"
|
|
|
|
or node.name == "default:dirt" then
|
|
|
|
node.name = "default:dirt_with_snow"
|
|
|
|
minetest.set_node(pos, node)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-12 21:03:06 +02:00
|
|
|
-- Bricks
|
|
|
|
|
|
|
|
nodedef = {
|
2014-06-04 00:34:58 +02:00
|
|
|
description = "Snow Brick",
|
|
|
|
tiles = {"snow_snow_brick.png"},
|
|
|
|
is_ground_content = true,
|
2015-06-12 21:03:06 +02:00
|
|
|
--freezemelt = "default:water_source", -- deprecated
|
2014-06-04 00:34:58 +02:00
|
|
|
liquidtype = "none",
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
2015-05-29 12:11:17 +02:00
|
|
|
paramtype2 = "facedir", -- Allow blocks to be rotated with the screwdriver or
|
2014-06-04 00:34:58 +02:00
|
|
|
-- by player position. ~ LazyJ
|
2015-05-29 12:11:17 +02:00
|
|
|
-- I made this a little harder to dig than snow blocks because
|
2014-06-04 00:34:58 +02:00
|
|
|
-- I imagine snow brick as being much more dense and solid than fluffy snow. ~ LazyJ
|
|
|
|
groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1, icemaker=1, cooks_into_ice=1},
|
|
|
|
--Let's use the new snow sounds instead of the old grass sounds. ~ LazyJ
|
|
|
|
sounds = default.node_sound_dirt_defaults({
|
|
|
|
footstep = {name="default_snow_footstep", gain=0.25},
|
|
|
|
dig = {name="default_dig_crumbly", gain=0.4},
|
|
|
|
dug = {name="default_snow_footstep", gain=0.75},
|
|
|
|
place = {name="default_place_node", gain=1.0}
|
|
|
|
}),
|
2015-05-29 12:11:17 +02:00
|
|
|
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could also
|
2014-06-04 00:34:58 +02:00
|
|
|
-- double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
|
2015-03-05 16:58:57 +01:00
|
|
|
on_construct = snow_onto_dirt
|
2015-06-12 21:03:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
-- Snow Brick
|
|
|
|
minetest.register_node("snow:snow_brick", table.copy(nodedef))
|
|
|
|
|
|
|
|
|
|
|
|
-- hard Ice Brick, original texture from LazyJ
|
|
|
|
local ibdef = table.copy(nodedef)
|
|
|
|
ibdef.description = "Ice Brick"
|
|
|
|
ibdef.tiles = {"snow_ice_brick.png"}
|
|
|
|
ibdef.use_texture_alpha = true
|
2015-06-12 21:46:30 +02:00
|
|
|
ibdef.drawtype = "glasslike"
|
2015-06-12 21:03:06 +02:00
|
|
|
ibdef.groups = {cracky=1, crumbly=1, choppy=1, melts=1}
|
|
|
|
ibdef.sounds = default.node_sound_glass_defaults({
|
|
|
|
dug = {name="default_hard_footstep", gain=1}
|
2014-06-04 00:34:58 +02:00
|
|
|
})
|
|
|
|
|
2015-06-12 21:03:06 +02:00
|
|
|
minetest.register_node("snow:ice_brick", ibdef)
|
2014-06-04 00:34:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
-- Snow Cobble ~ LazyJ
|
2014-06-09 03:37:10 +02:00
|
|
|
-- Described as Icy Snow
|
2015-06-12 21:03:06 +02:00
|
|
|
nodedef.description = "Icy Snow"
|
|
|
|
nodedef.tiles = {"snow_snow_cobble.png"}
|
|
|
|
|
|
|
|
minetest.register_node("snow:snow_cobble", nodedef)
|
2014-06-04 00:34:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Override Default Nodes to Add Extra Functions
|
|
|
|
|
|
|
|
minetest.override_item("default:ice", {
|
2016-08-13 13:15:15 +02:00
|
|
|
use_texture_alpha = true,
|
|
|
|
param2 = 0, --param2 is reserved for how much ice will freezeover.
|
|
|
|
sunlight_propagates = true, -- necessary for dirt_with_grass/snow/just dirt ABMs
|
2014-06-04 00:34:58 +02:00
|
|
|
drawtype = "glasslike",
|
2016-08-13 13:15:15 +02:00
|
|
|
inventory_image = minetest.inventorycube"default_ice.png".."^[brighten",
|
2014-06-04 00:34:58 +02:00
|
|
|
liquidtype = "none",
|
|
|
|
-- I made this a lot harder to dig than snow blocks because ice is much more dense
|
|
|
|
-- and solid than fluffy snow. ~ LazyJ
|
2014-06-09 04:01:31 +02:00
|
|
|
groups = {cracky=2, crumbly=1, choppy=1, --[[oddly_breakable_by_hand=1,]] melts=1},
|
2015-03-05 16:58:57 +01:00
|
|
|
on_construct = snow_onto_dirt,
|
2014-06-05 06:39:38 +02:00
|
|
|
liquids_pointable = true,
|
|
|
|
--Make ice freeze over when placed by a maximum of 10 blocks.
|
2015-05-23 19:53:30 +02:00
|
|
|
after_place_node = function(pos)
|
2014-06-05 06:39:38 +02:00
|
|
|
minetest.set_node(pos, {name="default:ice", param2=math.random(0,10)})
|
2014-06-04 00:34:58 +02:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
minetest.override_item("default:snowblock", {
|
2016-08-13 13:15:15 +02:00
|
|
|
-- LazyJ to make dirt below change to dirt_with_snow (see default, nodes.lua, dirt ABM)
|
|
|
|
liquidtype = "none",
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
2014-06-04 00:34:58 +02:00
|
|
|
-- Snow blocks should be easy to dig because they are just fluffy snow. ~ LazyJ
|
2014-06-09 03:37:10 +02:00
|
|
|
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",
|
2015-03-05 16:58:57 +01:00
|
|
|
on_construct = snow_onto_dirt
|
2015-05-29 12:11:17 +02:00
|
|
|
-- Thinking in terms of layers, dirt_with_snow could also double as
|
2015-03-05 16:58:57 +01:00
|
|
|
-- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
|
2014-06-04 00:34:58 +02:00
|
|
|
})
|
2016-08-13 13:05:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
minetest.override_item("default:snow", {
|
|
|
|
drop = {
|
|
|
|
max_items = 2,
|
|
|
|
items = {
|
|
|
|
{items = {'snow:moss'}, rarity = 20,},
|
|
|
|
{items = {'default:snow'},}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
leveled = 7,
|
|
|
|
node_box = {
|
|
|
|
type = "leveled",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, -0.5, 0.5, -0.5, 0.5},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3, falling_node=1, melts=2, float=1},
|
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = true,
|
|
|
|
node_placement_prediction = "",
|
|
|
|
on_construct = function(pos)
|
|
|
|
pos.y = pos.y-1
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
if node.name == "default:dirt_with_grass"
|
|
|
|
or node.name == "default:dirt" then
|
|
|
|
node.name = "default:dirt_with_snow"
|
|
|
|
minetest.set_node(pos, node)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
--Handle node drops due to node level.
|
|
|
|
on_dig = function(pos, node, digger)
|
|
|
|
local level = minetest.get_node_level(pos)
|
|
|
|
minetest.node_dig(pos, node, digger)
|
|
|
|
if minetest.get_node(pos).name ~= node.name then
|
|
|
|
local inv = digger:get_inventory()
|
|
|
|
if not inv then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local left = inv:add_item("main", "default:snow "..tostring(level/7-1))
|
|
|
|
if not left:is_empty() then
|
|
|
|
minetest.add_item({
|
|
|
|
x = pos.x + math.random()/2-0.25,
|
|
|
|
y = pos.y + math.random()/2-0.25,
|
|
|
|
z = pos.z + math.random()/2-0.25,
|
|
|
|
}, left)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
--Manage snow levels.
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
local under = pointed_thing.under
|
|
|
|
local oldnode_under = minetest.get_node_or_nil(under)
|
|
|
|
local above = pointed_thing.above
|
|
|
|
|
|
|
|
if not oldnode_under
|
|
|
|
or not above then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local olddef_under = ItemStack({name=oldnode_under.name}):get_definition()
|
|
|
|
olddef_under = olddef_under or minetest.nodedef_default
|
|
|
|
|
|
|
|
local place_to
|
|
|
|
-- If node under is buildable_to, place into it instead (eg. snow)
|
|
|
|
if olddef_under.buildable_to then
|
|
|
|
place_to = under
|
|
|
|
else
|
|
|
|
-- Place above pointed node
|
|
|
|
place_to = above
|
|
|
|
end
|
|
|
|
|
|
|
|
local level = minetest.get_node_level(place_to)
|
|
|
|
if level == 63 then
|
|
|
|
minetest.set_node(place_to, {name="default:snowblock"})
|
|
|
|
else
|
|
|
|
minetest.set_node_level(place_to, level+7)
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.get_node(place_to).name ~= "default:snow" then
|
|
|
|
local itemstack, placed = minetest.item_place_node(itemstack, placer, pointed_thing)
|
|
|
|
return itemstack, placed
|
|
|
|
end
|
|
|
|
|
|
|
|
itemstack:take_item()
|
|
|
|
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
on_use = snow.shoot_snowball
|
|
|
|
})
|
2016-08-13 13:09:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Do stairs files
|
|
|
|
|
|
|
|
local path = minetest.get_modpath"snow".."/src/"
|
|
|
|
|
|
|
|
dofile(path.."basic_stairs_slabs.lua")
|
|
|
|
|
|
|
|
if minetest.global_exists"stairsplus"
|
|
|
|
and minetest.get_modpath"moreblocks" then
|
|
|
|
dofile(path.."stairsplus.lua")
|
|
|
|
end
|