2012-07-22 08:27:54 +02:00
|
|
|
--[[
|
|
|
|
Snow Biomes
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA.
|
|
|
|
]]--
|
|
|
|
|
2013-08-06 08:25:01 +02:00
|
|
|
dofile(minetest.get_modpath("snow").."/util.lua")
|
2012-07-22 08:27:54 +02:00
|
|
|
dofile(minetest.get_modpath("snow").."/mapgen.lua")
|
2013-08-06 08:25:01 +02:00
|
|
|
dofile(minetest.get_modpath("snow").."/falling_snow.lua")
|
2012-07-22 08:27:54 +02:00
|
|
|
|
2013-08-06 08:25:01 +02:00
|
|
|
local needles = {
|
2012-07-26 05:43:56 +02:00
|
|
|
description = "Pine Needles",
|
|
|
|
drawtype = "allfaces_optional",
|
|
|
|
visual_scale = 1.3,
|
|
|
|
tiles = {"snow_needles.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
groups = {snappy=3, leafdecay=3, flammable=2},
|
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
|
|
|
{
|
|
|
|
-- player will get sapling with 1/20 chance
|
|
|
|
items = {'snow:sapling_pine'},
|
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- player will get leaves only if he get no saplings,
|
|
|
|
-- this is because max_items is 1
|
|
|
|
items = {'snow:needles'},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2013-08-06 08:25:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if snow.christmas_content then
|
|
|
|
needles["drop"]["items"][3] = {
|
|
|
|
-- player will get xmas tree with 1/50 chance
|
|
|
|
items = {'snow:xmas_tree'},
|
|
|
|
rarity = 50,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
--Pine leaves.
|
|
|
|
minetest.register_node("snow:needles", needles)
|
2012-07-26 05:43:56 +02:00
|
|
|
|
2012-12-18 23:34:58 +01:00
|
|
|
--Decorated Pine leaves.
|
|
|
|
minetest.register_node("snow:needles_decorated", {
|
|
|
|
description = "Decorated Pine Needles",
|
|
|
|
drawtype = "allfaces_optional",
|
|
|
|
tiles = {"snow_needles_decorated.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
groups = {snappy=3, leafdecay=3, flammable=2},
|
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
|
|
|
{
|
|
|
|
-- player will get xmas tree with 1/20 chance
|
|
|
|
items = {'snow:xmas_tree'},
|
|
|
|
rarity = 50,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- player will get sapling with 1/20 chance
|
|
|
|
items = {'snow:sapling_pine'},
|
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- player will get leaves only if he get no saplings,
|
|
|
|
-- this is because max_items is 1
|
|
|
|
items = {'snow:needles_decorated'},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("snow:xmas_tree", {
|
|
|
|
description = "Christmas Tree",
|
|
|
|
drawtype = "plantlike",
|
|
|
|
visual_scale = 1.0,
|
|
|
|
tiles = {"snow_xmas_tree.png"},
|
|
|
|
inventory_image = "snow_xmas_tree.png",
|
|
|
|
wield_image = "snow_xmas_tree.png",
|
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
groups = {snappy=2,dig_immediate=3,flammable=2},
|
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
|
2012-07-26 05:43:56 +02:00
|
|
|
minetest.register_node("snow:sapling_pine", {
|
|
|
|
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,flammable=2},
|
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
|
2012-12-18 23:34:58 +01:00
|
|
|
minetest.register_node("snow:star", {
|
|
|
|
description = "Star",
|
|
|
|
drawtype = "torchlike",
|
|
|
|
tiles = {"snow_star.png"},
|
|
|
|
inventory_image = "snow_star.png",
|
|
|
|
wield_image = "snow_star.png",
|
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
groups = {snappy=2,dig_immediate=3},
|
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
|
2012-10-02 14:37:05 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "snow:needles",
|
|
|
|
burntime = 1,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "snow:sapling_pine",
|
|
|
|
burntime = 10,
|
|
|
|
})
|
|
|
|
|
2012-12-19 08:15:54 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "snow:needles_decorated",
|
|
|
|
burntime = 1,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "snow:xmas_tree",
|
|
|
|
burntime = 10,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2012-10-02 14:37:05 +02:00
|
|
|
|
2012-07-22 08:27:54 +02:00
|
|
|
--Snowballs
|
|
|
|
-------------
|
2013-08-06 08:25:01 +02:00
|
|
|
local snowball_GRAVITY=9
|
|
|
|
local snowball_VELOCITY=19
|
2012-07-22 08:27:54 +02:00
|
|
|
|
|
|
|
--Shoot snowball.
|
|
|
|
local snow_shoot_snowball=function (item, player, pointed_thing)
|
|
|
|
local playerpos=player:getpos()
|
2013-08-06 08:25:01 +02:00
|
|
|
local obj=minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "snow:snowball_entity")
|
2012-07-22 08:27:54 +02:00
|
|
|
local dir=player:get_look_dir()
|
|
|
|
obj:setvelocity({x=dir.x*snowball_VELOCITY, y=dir.y*snowball_VELOCITY, z=dir.z*snowball_VELOCITY})
|
|
|
|
obj:setacceleration({x=dir.x*-3, y=-snowball_GRAVITY, z=dir.z*-3})
|
|
|
|
item:take_item()
|
|
|
|
return item
|
|
|
|
end
|
|
|
|
|
|
|
|
--The snowball Entity
|
|
|
|
snow_snowball_ENTITY={
|
|
|
|
physical = false,
|
|
|
|
timer=0,
|
|
|
|
textures = {"snow_snowball.png"},
|
|
|
|
lastpos={},
|
|
|
|
collisionbox = {0,0,0,0,0,0},
|
|
|
|
}
|
|
|
|
|
|
|
|
--Snowball_entity.on_step()--> called when snowball is moving.
|
|
|
|
snow_snowball_ENTITY.on_step = function(self, dtime)
|
|
|
|
self.timer=self.timer+dtime
|
|
|
|
local pos = self.object:getpos()
|
2013-08-06 08:25:01 +02:00
|
|
|
local node = minetest.get_node(pos)
|
2012-07-22 08:27:54 +02:00
|
|
|
|
|
|
|
--Become item when hitting a node.
|
|
|
|
if self.lastpos.x~=nil then --If there is no lastpos for some reason.
|
|
|
|
if node.name ~= "air" then
|
2013-08-06 08:25:01 +02:00
|
|
|
snow.place(pos)
|
2012-07-22 08:27:54 +02:00
|
|
|
self.object:remove()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
self.lastpos={x=pos.x, y=pos.y, z=pos.z} -- Set lastpos-->Node will be added at last pos outside the node
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_entity("snow:snowball_entity", snow_snowball_ENTITY)
|
|
|
|
|
|
|
|
--Snowball.
|
|
|
|
minetest.register_craftitem("snow:snowball", {
|
2012-08-01 03:58:34 +02:00
|
|
|
description = "Snowball",
|
2012-07-22 08:27:54 +02:00
|
|
|
inventory_image = "snow_snowball.png",
|
|
|
|
on_use = snow_shoot_snowball,
|
|
|
|
})
|
|
|
|
|
2013-08-06 08:25:01 +02:00
|
|
|
for i=1,8 do
|
|
|
|
local snow_box =
|
|
|
|
{
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5 + i/9., 0.5}
|
|
|
|
}
|
|
|
|
minetest.register_node("snow:snow"..(tostring(i) ~= "1" and tostring(i) or ""), {
|
|
|
|
description = "Snow",
|
|
|
|
tiles = {"snow_snow.png"},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 == "leveled",
|
|
|
|
groups = {crumbly=3,melts=3,falling_node=1,not_in_creative_inventory=1},
|
|
|
|
buildable_to = true,
|
|
|
|
drop = {
|
|
|
|
max_items = 2,
|
|
|
|
items = {
|
|
|
|
{
|
|
|
|
-- player will get sapling with 1/20 chance
|
|
|
|
items = {'snow:moss'},
|
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- player will get leaves only if he get no saplings,
|
|
|
|
-- this is because max_items is 1
|
|
|
|
items = {'snow:snowball'},
|
|
|
|
}
|
|
|
|
}
|
2012-07-22 08:27:54 +02:00
|
|
|
},
|
2013-08-06 08:25:01 +02:00
|
|
|
leveled = 7*i,
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = snow_box,
|
|
|
|
sounds = default.node_sound_dirt_defaults({
|
|
|
|
footstep = {name="default_snow_footstep", gain=0.45},
|
|
|
|
}),
|
|
|
|
on_construct = function(pos)
|
|
|
|
pos.y = pos.y - 1
|
|
|
|
if minetest.get_node(pos).name == "default:dirt_with_grass" then
|
|
|
|
minetest.add_node(pos, {name="snow:dirt_with_snow"})
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
after_destruct = function(pos)
|
|
|
|
pos.y = pos.y - 1
|
|
|
|
if minetest.get_node(pos).name == "snow:dirt_with_snow" then
|
|
|
|
minetest.add_node(pos, {name="default:dirt_with_grass"})
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
if not snow.legacy then
|
|
|
|
--Snow.
|
|
|
|
minetest.register_node("snow:snow", {
|
|
|
|
description = "Snow",
|
|
|
|
tiles = {"snow_snow.png"},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 == "leveled",
|
|
|
|
groups = {crumbly=3,melts=3,falling_node=1,not_in_creative_inventory=1},
|
|
|
|
buildable_to = true,
|
|
|
|
drop = {
|
|
|
|
max_items = 2,
|
|
|
|
items = {
|
|
|
|
{
|
|
|
|
-- player will get sapling with 1/20 chance
|
|
|
|
items = {'snow:moss'},
|
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
-- player will get leaves only if he get no saplings,
|
|
|
|
-- this is because max_items is 1
|
|
|
|
items = {'snow:snowball'},
|
|
|
|
}
|
|
|
|
}
|
2012-07-22 08:27:54 +02:00
|
|
|
},
|
2013-08-06 08:25:01 +02:00
|
|
|
leveled = 7,
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "leveled",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
sounds = default.node_sound_dirt_defaults({
|
|
|
|
footstep = {name="default_snow_footstep", gain=0.45},
|
|
|
|
}),
|
|
|
|
on_construct = function(pos)
|
|
|
|
pos.y = pos.y - 1
|
|
|
|
if minetest.get_node(pos).name == "default:dirt_with_grass" then
|
|
|
|
minetest.add_node(pos, {name="snow:dirt_with_snow"})
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
after_destruct = function(pos)
|
|
|
|
pos.y = pos.y - 1
|
|
|
|
if minetest.get_node(pos).name == "snow:dirt_with_snow" then
|
|
|
|
minetest.add_node(pos, {name="default:dirt_with_grass"})
|
2012-07-25 00:22:34 +02:00
|
|
|
end
|
2013-08-06 08:25:01 +02:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
else
|
|
|
|
minetest.add_node_level = function(pos, amount)
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
if node.name == "snow:snow" then
|
|
|
|
minetest.add_node(pos,{name="snow:snow2"})
|
|
|
|
elseif node.name:find("snow:snow") and node.name:sub(-1)~="8" then
|
|
|
|
minetest.add_node(pos,{name="snow:snow"..tonumber(node.name:sub(-1))+1})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
minetest.get_node_level = function(pos)
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
if node.name == "snow:snow" then
|
|
|
|
return 7
|
|
|
|
elseif node.name:find("snow:snow") and node.name:sub(-1) then
|
|
|
|
return 7*(tonumber(node.name:sub(-1)))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function snow.place(pos)
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
local drawtype = minetest.registered_nodes[node.name].drawtype
|
|
|
|
|
|
|
|
local bnode = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
|
|
|
if node.name:find("snow:snow") and minetest.get_node_level(pos) < 63 then
|
|
|
|
if minetest.get_item_group(bnode.name, "leafdecay") == 0 and snow.is_uneven(pos) ~= true then
|
|
|
|
minetest.add_node_level(pos, 7)
|
2012-07-22 08:27:54 +02:00
|
|
|
end
|
2013-08-06 08:25:01 +02:00
|
|
|
elseif node.name:find("snow:snow") and minetest.get_node_level(pos) == 63 then
|
|
|
|
local p = minetest.find_node_near(pos, 10, "default:dirt_with_grass")
|
|
|
|
if p and minetest.get_node_light(p, 0.5) == 15 then
|
|
|
|
minetest.add_node(p,{name="snow:snow"})
|
|
|
|
else
|
|
|
|
minetest.add_node(pos,{name="snow:snowblock"})
|
2012-07-22 08:27:54 +02:00
|
|
|
end
|
2013-08-06 08:25:01 +02:00
|
|
|
elseif node.name ~= "snow:ice" and node.name ~= "air" then
|
|
|
|
if drawtype == "normal" or drawtype == "allfaces_optional" then
|
|
|
|
minetest.add_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="snow:snow"})
|
|
|
|
elseif drawtype == "plantlike" then
|
|
|
|
pos.y = pos.y - 1
|
|
|
|
if minetest.get_node(pos).name == "default:dirt_with_grass" then
|
|
|
|
minetest.add_node(pos, {name="snow:dirt_with_snow"})
|
|
|
|
end
|
2012-07-22 08:27:54 +02:00
|
|
|
end
|
2013-08-06 08:25:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--Checks if the snow level is even at any given pos.
|
|
|
|
--Smooth snow
|
|
|
|
local smooth_snow = snow.smooth_snow
|
|
|
|
snow.is_uneven = function(pos)
|
|
|
|
if smooth_snow then
|
|
|
|
local num = minetest.get_node_level(pos)
|
|
|
|
local get_node = minetest.get_node
|
|
|
|
local add_node = minetest.add_node
|
|
|
|
local found
|
|
|
|
local foundx
|
|
|
|
local foundy
|
|
|
|
for x=-1,1 do
|
|
|
|
for z=-1,1 do
|
|
|
|
local node = get_node({x=pos.x+x,y=pos.y,z=pos.z+z})
|
|
|
|
local bnode = get_node({x=pos.x+x,y=pos.y-1,z=pos.z+z})
|
|
|
|
local drawtype = minetest.registered_nodes[node.name].drawtype
|
|
|
|
|
|
|
|
if drawtype == "plantlike" then
|
|
|
|
if bnode.name == "default:dirt_with_grass" then
|
|
|
|
add_node({x=pos.x+x,y=pos.y-1,z=pos.z+z}, {name="snow:dirt_with_snow"})
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if (not(x == 0 and y == 0)) and node.name == "snow:snow" and minetest.get_node_level({x=pos.x+x,y=pos.y,z=pos.z+z}) < num then
|
|
|
|
found = true
|
|
|
|
foundx = x
|
|
|
|
foundz=z
|
|
|
|
elseif node.name == "air" and bnode.name ~= "air" then
|
|
|
|
if not (bnode.name:find("snow:snow")) then
|
|
|
|
snow.place({x=pos.x+x,y=pos.y,z=pos.z+z})
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if found then
|
|
|
|
local node = get_node({x=pos.x+foundx,y=pos.y,z=pos.z+foundz})
|
|
|
|
if snow.is_uneven({x=pos.x+foundx,y=pos.y,z=pos.z+foundz}) ~= true then
|
|
|
|
minetest.add_node_level({x=pos.x+foundx,y=pos.y,z=pos.z+foundz}, 7)
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2012-07-22 08:27:54 +02:00
|
|
|
|
|
|
|
--Snow with dirt.
|
|
|
|
minetest.register_node("snow:dirt_with_snow", {
|
|
|
|
description = "Dirt with Snow",
|
|
|
|
tiles = {"snow_snow.png", "default_dirt.png", "default_dirt.png^snow_snow_side.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {crumbly=3},
|
|
|
|
drop = 'default:dirt',
|
|
|
|
sounds = default.node_sound_dirt_defaults({
|
2013-08-06 08:25:01 +02:00
|
|
|
footstep = {name="default_snow_footstep", gain=0.4},
|
2012-07-22 08:27:54 +02:00
|
|
|
}),
|
|
|
|
})
|
|
|
|
|
|
|
|
--Snow block.
|
|
|
|
minetest.register_node("snow:snow_block", {
|
|
|
|
description = "Snow",
|
|
|
|
tiles = {"snow_snow.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {crumbly=3,melts=2,falling_node=1},
|
|
|
|
drop = 'snow:snow_block',
|
|
|
|
sounds = default.node_sound_dirt_defaults({
|
2013-08-06 08:25:01 +02:00
|
|
|
footstep = {name="default_snow_footstep", gain=0.4},
|
2012-07-22 08:27:54 +02:00
|
|
|
}),
|
|
|
|
})
|
|
|
|
|
2012-12-12 08:41:39 +01:00
|
|
|
--Snow brick.
|
|
|
|
minetest.register_node("snow:snow_brick", {
|
|
|
|
description = "Snow Brick",
|
|
|
|
tiles = {"snow_snow_brick.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {crumbly=3,melts=2},
|
|
|
|
drop = 'snow:snow_brick',
|
|
|
|
sounds = default.node_sound_dirt_defaults({
|
|
|
|
footstep = {name="default_grass_footstep", gain=0.4},
|
|
|
|
}),
|
|
|
|
})
|
|
|
|
|
2012-07-22 08:27:54 +02:00
|
|
|
--Ice.
|
|
|
|
minetest.register_node("snow:ice", {
|
|
|
|
description = "Ice",
|
|
|
|
tiles = {"snow_ice.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {snappy=2,cracky=3,melts=1},
|
|
|
|
drop = 'snow:ice',
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
sounds = default.node_sound_glass_defaults({
|
|
|
|
footstep = {name="default_stone_footstep", gain=0.4},
|
|
|
|
}),
|
|
|
|
})
|
|
|
|
|
|
|
|
--Moss.
|
|
|
|
minetest.register_node("snow:moss", {
|
|
|
|
description = "Moss",
|
|
|
|
tiles = {"snow_moss.png"},
|
|
|
|
drawtype = "signlike",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
},
|
|
|
|
is_ground_content = true,
|
2012-12-19 10:04:54 +01:00
|
|
|
groups = {crumbly=3, flammable=2, attached_node=1},
|
2012-07-22 08:27:54 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = 'snow:snow_block',
|
|
|
|
recipe = {
|
|
|
|
{'snow:snowball', 'snow:snowball'},
|
|
|
|
{'snow:snowball', 'snow:snowball'},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2012-12-12 08:41:39 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
output = 'snow:snow_brick',
|
|
|
|
recipe = {
|
|
|
|
{'snow:snow_block', 'snow:snow_block'},
|
|
|
|
{'snow:snow_block', 'snow:snow_block'},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2012-07-22 08:27:54 +02:00
|
|
|
--Melting
|
|
|
|
--Any node part of the group melting will melt when near warm nodes such as lava, fire, torches, etc.
|
|
|
|
--The amount of water that replaces the node is defined by the number on the group:
|
2012-07-23 05:14:58 +02:00
|
|
|
--1: one water_source
|
2012-07-22 08:27:54 +02:00
|
|
|
--2: four water_flowings
|
2012-07-23 05:14:58 +02:00
|
|
|
--3: one water_flowing
|
2012-07-22 08:27:54 +02:00
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"group:melts"},
|
2012-07-26 06:19:33 +02:00
|
|
|
neighbors = {"group:igniter","default:torch","default:furnace_active","group:hot"},
|
2012-07-22 08:27:54 +02:00
|
|
|
interval = 2,
|
|
|
|
chance = 2,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
|
|
local intensity = minetest.get_item_group(node.name,"melts")
|
|
|
|
if intensity == 1 then
|
2013-08-06 08:25:01 +02:00
|
|
|
minetest.add_node(pos,{name="default:water_source"})
|
2012-07-22 08:27:54 +02:00
|
|
|
elseif intensity == 2 then
|
|
|
|
local check_place = function(pos,node)
|
2013-08-06 08:25:01 +02:00
|
|
|
if minetest.get_node(pos).name == "air" then
|
|
|
|
minetest.place_node(pos,node)
|
2012-07-22 08:27:54 +02:00
|
|
|
end
|
|
|
|
end
|
2013-08-06 08:25:01 +02:00
|
|
|
minetest.add_node(pos,{name="default:water_flowing"})
|
2012-07-22 08:27:54 +02:00
|
|
|
check_place({x=pos.x+1,y=pos.y,z=pos.z},{name="default:water_flowing"})
|
|
|
|
check_place({x=pos.x-1,y=pos.y,z=pos.z},{name="default:water_flowing"})
|
|
|
|
check_place({x=pos.x,y=pos.y+1,z=pos.z},{name="default:water_flowing"})
|
|
|
|
check_place({x=pos.x,y=pos.y-1,z=pos.z},{name="default:water_flowing"})
|
|
|
|
elseif intensity == 3 then
|
2013-08-06 08:25:01 +02:00
|
|
|
minetest.add_node(pos,{name="default:water_flowing"})
|
2012-07-22 08:27:54 +02:00
|
|
|
end
|
|
|
|
nodeupdate(pos)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
--Freezing
|
|
|
|
--Water freezes when in contact with snow.
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"default:water_source"},
|
|
|
|
neighbors = {"snow:snow", "snow:snow_block"},
|
|
|
|
interval = 20,
|
|
|
|
chance = 4,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
2013-08-06 08:25:01 +02:00
|
|
|
minetest.add_node(pos,{name="snow:ice"})
|
2012-07-22 08:27:54 +02:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
--Spread moss to cobble.
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"default:cobble"},
|
|
|
|
neighbors = {"snow:moss"},
|
|
|
|
interval = 20,
|
|
|
|
chance = 6,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
2013-08-06 08:25:01 +02:00
|
|
|
minetest.add_node(pos,{name="default:mossycobble"})
|
2012-07-22 08:27:54 +02:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2012-07-26 05:43:56 +02:00
|
|
|
--Grow saplings
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"snow:sapling_pine"},
|
|
|
|
interval = 10,
|
|
|
|
chance = 50,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
|
|
snow.make_pine(pos,false)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2012-12-18 23:34:58 +01:00
|
|
|
--Grow saplings
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"snow:xmas_tree"},
|
|
|
|
interval = 10,
|
|
|
|
chance = 50,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
|
|
snow.make_pine(pos,false,true)
|
|
|
|
end,
|
|
|
|
})
|