Minecraft-style snow stuff

This commit is contained in:
Wuzzy 2017-01-04 11:26:35 +01:00
parent 3a8898634a
commit 0045d00a82
3 changed files with 21 additions and 16 deletions

View file

@ -594,16 +594,15 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
output = 'default:snowblock', output = 'default:snowblock',
recipe = { recipe = {
{'default:snow', 'default:snow', 'default:snow'}, {'default:snowball', 'default:snowball'},
{'default:snow', 'default:snow', 'default:snow'}, {'default:snowball', 'default:snowball'},
{'default:snow', 'default:snow', 'default:snow'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:snow 9', output = 'default:snow 6',
recipe = { recipe = {
{'default:snowblock'}, {'default:snowblock', 'default:snowblock', 'default:snowblock'},
} }
}) })

View file

@ -1868,10 +1868,8 @@ minetest.register_node("default:packedice", {
}) })
minetest.register_node("default:snow", { minetest.register_node("default:snow", {
description = "Snow Layer", description = "Top Snow",
tiles = {"default_snow.png"}, tiles = {"default_snow.png"},
inventory_image = "default_snowball.png",
wield_image = "default_snowball.png",
is_ground_content = true, is_ground_content = true,
paramtype = "light", paramtype = "light",
buildable_to = true, buildable_to = true,
@ -1887,13 +1885,7 @@ minetest.register_node("default:snow", {
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
on_use = snow_shoot_snowball, drop = "default:snowball 2",
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.env:get_node(pos).name == "default:dirt_with_grass" then
minetest.env:set_node(pos, {name="default:dirt_with_snow"})
end
end,
}) })
minetest.register_node("default:snowblock", { minetest.register_node("default:snowblock", {
@ -1905,7 +1897,7 @@ minetest.register_node("default:snowblock", {
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
drop = "default:snow 4", drop = "default:snowball 4",
}) })
minetest.register_node("default:cobweb", { minetest.register_node("default:cobweb", {

View file

@ -339,3 +339,17 @@ minetest.register_tool("default:shears", {
} }
} }
}) })
-- Snowball
minetest.register_craftitem("default:snowball", {
description = "Snowball",
inventory_image = "default_snowball.png",
stack_max = 64,
on_use = snow_shoot_snowball,
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.env:get_node(pos).name == "default:dirt_with_grass" then
minetest.env:set_node(pos, {name="default:dirt_with_snow"})
end
end,
})