From 0045d00a824466db7483bdb0c51e1327000ea099 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 4 Jan 2017 11:26:35 +0100 Subject: [PATCH] Minecraft-style snow stuff --- mods/default/crafting.lua | 9 ++++----- mods/default/nodes.lua | 14 +++----------- mods/default/tools.lua | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index 08073c1f29..1c0fd378f3 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -594,16 +594,15 @@ minetest.register_craft({ minetest.register_craft({ output = 'default:snowblock', recipe = { - {'default:snow', 'default:snow', 'default:snow'}, - {'default:snow', 'default:snow', 'default:snow'}, - {'default:snow', 'default:snow', 'default:snow'}, + {'default:snowball', 'default:snowball'}, + {'default:snowball', 'default:snowball'}, } }) minetest.register_craft({ - output = 'default:snow 9', + output = 'default:snow 6', recipe = { - {'default:snowblock'}, + {'default:snowblock', 'default:snowblock', 'default:snowblock'}, } }) diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 366f07da10..89220c6c33 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1868,10 +1868,8 @@ minetest.register_node("default:packedice", { }) minetest.register_node("default:snow", { - description = "Snow Layer", + description = "Top Snow", tiles = {"default_snow.png"}, - inventory_image = "default_snowball.png", - wield_image = "default_snowball.png", is_ground_content = true, paramtype = "light", buildable_to = true, @@ -1887,13 +1885,7 @@ minetest.register_node("default:snow", { sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.4}, }), - 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, + drop = "default:snowball 2", }) minetest.register_node("default:snowblock", { @@ -1905,7 +1897,7 @@ minetest.register_node("default:snowblock", { sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.4}, }), - drop = "default:snow 4", + drop = "default:snowball 4", }) minetest.register_node("default:cobweb", { diff --git a/mods/default/tools.lua b/mods/default/tools.lua index 2c94620c82..9bf144efea 100644 --- a/mods/default/tools.lua +++ b/mods/default/tools.lua @@ -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, +})