Updated snow with fixes

This commit is contained in:
LeMagnesium 2015-05-11 20:02:54 +02:00
parent 6c5c9f6ca9
commit ea1d7b65be
79 changed files with 365 additions and 364 deletions

View File

@ -75,7 +75,6 @@ if (minetest.get_modpath("moreblocks")) then
dofile(minetest.get_modpath("snow").."/src/stairsplus.lua")
else
end
--This function places snow checking at the same time for snow level and increasing as needed.

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

View File

Before

Width:  |  Height:  |  Size: 788 B

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

BIN
mods/snow/schematics/pine.mts Executable file → Normal file

Binary file not shown.

View File

@ -1,13 +1,12 @@
--Backwards Compatability.
minetest.register_abm({
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local level = 7*(tonumber(node.name:sub(-1)))
minetest.add_node(pos,{name="default:snow"})
minetest.set_node_level(pos, level)
end,
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"},
interval = 1,
chance = 1,
action = function(pos, node)
minetest.add_node(pos,{name="default:snow"})
minetest.set_node_level(pos, 7*(tonumber(node.name:sub(-1))))
end,
})
@ -19,12 +18,14 @@ minetest.register_abm({
interval = 2,
chance = 20,
action = function(pos, node)
local above = {x=pos.x, y=pos.y+1, z=pos.z}
local name = minetest.get_node(above).name
local name = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none") then
if name ~= "ignore"
and nodedef
and not (
(nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none"
) then
minetest.set_node(pos, {name = "default:dirt"})
end
end
@ -40,16 +41,18 @@ minetest.register_abm({
--3: one water_flowing
minetest.register_abm({
nodenames = {"group:melts"},
neighbors = {"group:igniter","default:torch","default:furnace_active","group:hot"},
interval = 2,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
nodenames = {"group:melts"},
neighbors = {"group:igniter","default:torch","default:furnace_active","group:hot"},
interval = 2,
chance = 2,
action = function(pos, node)
local intensity = minetest.get_item_group(node.name,"melts")
if intensity == 1 then
minetest.add_node(pos,{name="default:water_source"})
elseif intensity == 2 then
--[[ This was causing "melts=2" nodes to just disappear so I changed it to replace the
minetest.add_node(pos,{name="default:water_flowing", param2=7})
--[[ LazyJ, you need to add param2, which defines the amount of the flowing water ~ HybridDog 2015_03_06
This was causing "melts=2" nodes to just disappear so I changed it to replace the
node with a water_source for a couple seconds and then replace the water_source with
air. This way it made a watery mess that quickly evaporated. ~ LazyJ 2014_04_24
local check_place = function(pos,node)
@ -63,7 +66,7 @@ minetest.register_abm({
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
--]]
--]
minetest.add_node(pos,{name="default:water_source"})
minetest.after(2, function() -- 2 seconds gives just enough time for
-- the water to flow and spread before the
@ -72,9 +75,10 @@ minetest.register_abm({
minetest.add_node(pos,{name="air"})
end
end)
end
--]]
end
nodeupdate(pos)
end,
end,
})
@ -83,68 +87,60 @@ minetest.register_abm({
--Freezing
--Water freezes when in contact with snow.
minetest.register_abm({
nodenames = {"default:water_source"},
-- Added "group:icemaker" and snowbrick. ~ LazyJ
neighbors = {"default:snow", "default:snowblock", "snow:snow_brick", "group:icemaker"},
interval = 20,
chance = 4,
action = function(pos, node, active_object_count, active_object_count_wider)
nodenames = {"default:water_source"},
-- Added "group:icemaker" and snowbrick. ~ LazyJ
neighbors = {"default:snow", "default:snowblock", "snow:snow_brick", "group:icemaker"},
interval = 20,
chance = 4,
action = function(pos)
minetest.add_node(pos,{name="default:ice"})
end,
end,
})
--Freeze Ice according to it's param2 value.
minetest.register_abm({
nodenames = {"default:ice"},
neighbors = {"default:water_source"},
interval = 20,
chance = 4,
action = function(pos, node, active_object_count, active_object_count_wider)
if node.param2 > 0 then
if math.random(2) == 2 and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z}).name == "default:water_source" then
minetest.add_node({x=pos.x+1, y=pos.y, z=pos.z},{name="default:ice", param2 = math.random(0,node.param2-1)})
end
if math.random(2) == 2 and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z}).name == "default:water_source" then
minetest.add_node({x=pos.x-1, y=pos.y, z=pos.z},{name="default:ice", param2 = math.random(0,node.param2-1)})
end
if math.random(2) == 2 and minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}).name == "default:water_source" then
minetest.add_node({x=pos.x, y=pos.y, z=pos.z-1},{name="default:ice", param2 = math.random(0,node.param2-1)})
end
if math.random(2) == 2 and minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}).name == "default:water_source" then
minetest.add_node({x=pos.x, y=pos.y, z=pos.z+1},{name="default:ice", param2 = math.random(0,node.param2-1)})
end
if math.random(2) == 2 and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1}).name == "default:water_source" then
minetest.add_node({x=pos.x+1, y=pos.y, z=pos.z-1},{name="default:ice", param2 = math.random(0,node.param2-1)})
end
if math.random(2) == 2 and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1}).name == "default:water_source" then
minetest.add_node({x=pos.x-1, y=pos.y, z=pos.z+1},{name="default:ice", param2 = math.random(0,node.param2-1)})
end
if math.random(2) == 2 and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1}).name == "default:water_source" then
minetest.add_node({x=pos.x+1, y=pos.y, z=pos.z+1},{name="default:ice", param2 = math.random(0,node.param2-1)})
end
if math.random(2) == 2 and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1}).name == "default:water_source" then
minetest.add_node({x=pos.x-1, y=pos.y, z=pos.z-1},{name="default:ice", param2 = math.random(0,node.param2-1)})
nodenames = {"default:ice"},
neighbors = {"default:water_source"},
interval = 20,
chance = 4,
action = function(pos, node)
if node.param2 > 0 then
for l = 0,1 do
for i = -1,1,2 do
for _,p in pairs({
{x=pos.x+i, z=pos.z-l*i},
{x=pos.x+l*i, z=pos.z+i}
}) do
if math.random(2) == 2 then
p.y = pos.y
if minetest.get_node(p).name == "default:water_source" then
minetest.add_node(p,{name="default:ice", param2 = math.random(0,node.param2-1)})
end
end
end
end
end
if math.random(8) == 8 then
minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="default:water_source"})
minetest.add_node(pos, {name="default:water_source"})
else
minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="default:ice", param2 = 0})
minetest.add_node(pos, {name="default:ice", param2 = 0})
end
end
end,
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)
minetest.add_node(pos,{name="default:mossycobble"})
end,
nodenames = {"default:cobble"},
neighbors = {"snow:moss"},
interval = 20,
chance = 6,
action = function(pos, node)
node.name = "default:mossycobble"
minetest.add_node(pos, node)
end,
})
@ -152,35 +148,30 @@ minetest.register_abm({
--Grow Pine Saplings
minetest.register_abm({
nodenames = {"snow:sapling_pine"},
interval = 10,
chance = 50,
action = function(pos, node, active_object_count, active_object_count_wider)
nodenames = {"snow:sapling_pine"},
interval = 10,
chance = 50,
action = function(pos, node)
-- Check if there is enough vertical-space for the sapling to grow without
-- hitting anything else. ~ LazyJ, 2014_04_10
if -- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ
minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+3, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+4, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+5, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+6, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+7, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+8, z=pos.z}).name == "air"
then -- 'then' let the sapling grow into a tree. ~ LazyJ
-- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ
for i = 1,8 do
if minetest.get_node({x=pos.x, y=pos.y+i, z=pos.z}).name ~= "air" then
return
end
end
-- 'then' let the sapling grow into a tree. ~ LazyJ
snow.make_pine(pos,false)
-- This finds the sapling under the grown tree. ~ LazyJ
if minetest.get_node({x = pos.x, y = pos.y, z = pos.z}).name == "snow:sapling_pine" then
-- This switches the sapling to a tree trunk. ~ LazyJ
minetest.set_node(pos, {name="default:tree"})
-- This is more for testing but it may be useful info to some admins when
-- grepping the server logs too. ~ LazyJ
minetest.log("action", "A pine sapling grows into a tree at "..minetest.pos_to_string(pos))
end
else
-- This finds the sapling under the grown tree. ~ LazyJ
if minetest.get_node(pos).name == "snow:sapling_pine" then
-- This switches the sapling to a tree trunk. ~ LazyJ
minetest.set_node(pos, {name="default:pinetree"})
-- This is more for testing but it may be useful info to some admins when
-- grepping the server logs too. ~ LazyJ
minetest.log("action", "A pine sapling grows into a tree at "..minetest.pos_to_string(pos))
end
end
})
@ -190,27 +181,24 @@ minetest.register_abm({
--Grow Christmas Tree Saplings
minetest.register_abm({
nodenames = {"snow:xmas_tree"},
interval = 10,
chance = 50,
action = function(pos, node, active_object_count, active_object_count_wider)
nodenames = {"snow:xmas_tree"},
interval = 10,
chance = 50,
action = function(pos, node, active_object_count, active_object_count_wider)
if -- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ
minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+3, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+4, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+5, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+6, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+7, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y+8, z=pos.z}).name == "air"
then -- 'then' let the sapling grow into a tree. ~ LazyJ
-- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ
for i = 1,8 do
if minetest.get_node({x=pos.x, y=pos.y+i, z=pos.z}).name ~= "air" then
return
end
end
-- 'then' let the sapling grow into a tree. ~ LazyJ
snow.make_pine(pos,false,true)
minetest.log("action", "A pine sapling grows into a Christmas tree at "..minetest.pos_to_string(pos)) -- ~ LazyJ
else -- 'Else', if there isn't air in each of the 8 nodes above the sapling,
--else -- 'Else', if there isn't air in each of the 8 nodes above the sapling,
-- then don't anything; including not allowing the sapling to grow.
-- ~ LazyJ, 2014_04_10
end
end
--end
end
})

View File

@ -40,162 +40,192 @@ near torches and lava.
--=============================================================
if snow.enable_snowfall then
if not snow.enable_snowfall then
return
end
local weather_legacy
local read_weather_legacy = function ()
local file = io.open(minetest.get_worldpath().."/weather_v6", "r")
if not file then return end
local readweather = file:read()
file:close()
return readweather
end
--Weather for legacy versions of minetest.
local save_weather_legacy = function ()
local file = io.open(minetest.get_worldpath().."/weather_v6", "w+")
file:write(weather_legacy)
file:close()
end
weather_legacy = read_weather_legacy() or ""
local weather_legacy
minetest.register_globalstep(function(dtime)
if weather_legacy == "snow" then
if math.random(1, 10000) == 1 then
weather_legacy = "none"
save_weather_legacy()
end
else
if math.random(1, 50000) == 2 then
weather_legacy = "snow"
save_weather_legacy()
end
end
end)
--Get snow at position.
local get_snow = function(pos)
--Legacy support.
local read_weather_legacy = function ()
local file = io.open(minetest.get_worldpath().."/weather_v6", "r")
if not file then return end
local readweather = file:read()
file:close()
return readweather
end
--Weather for legacy versions of minetest.
local save_weather_legacy = function ()
local file = io.open(minetest.get_worldpath().."/weather_v6", "w+")
file:write(weather_legacy)
file:close()
end
weather_legacy = read_weather_legacy() or ""
minetest.register_globalstep(function(dtime)
if weather_legacy == "snow" then
local perlin1 = minetest.env:get_perlin(112,3, 0.5, 150)
if perlin1:get2d( {x=pos.x, y=pos.z} ) > 0.53 then
return true
else
return false
if math.random(1, 10000) == 1 then
weather_legacy = "none"
save_weather_legacy()
end
else
if math.random(1, 50000) == 2 then
weather_legacy = "snow"
save_weather_legacy()
end
end
end)
-- copied from meru mod
local SEEDDIFF3 = 9130 -- 9130 -- Values should match minetest mapgen desert perlin.
local OCTAVES3 = 3 -- 3
local PERSISTENCE3 = 0.5 -- 0.5
local SCALE3 = 250 -- 250
--Get snow at position.
local get_snow = function(pos)
--Legacy support.
if weather_legacy == "snow" then
local perlin1 = minetest.get_perlin(112,3, 0.5, 150)
if perlin1:get2d({x=pos.x, y=pos.z}) <= 0.53 then
return false
end
end
local addvectors = vector and vector.add
--Returns a random position between minp and maxp.
local randpos = function (minp, maxp)
local x,y,z
if minp.x > maxp.x then
x = math.random(maxp.x,minp.x) else x = math.random(minp.x,maxp.x) end
y = minp.y
if minp.z > maxp.z then
z = math.random(maxp.z,minp.z) else z = math.random(minp.z,maxp.z) end
return {x=x,y=y,z=z}
end
local snow_fall=function (pos, player, animate)
local ground_y = nil
for y=pos.y+10,pos.y+20,1 do
local n = minetest.env:get_node({x=pos.x,y=y,z=pos.z}).name
if n ~= "air" and n ~= "ignore" then
return
end
end
for y=pos.y+10,pos.y-15,-1 do
local n = minetest.env:get_node({x=pos.x,y=y,z=pos.z}).name
if n ~= "air" and n ~= "ignore" then
ground_y = y
break
end
end
if not ground_y then return end
pos = {x=pos.x, y=ground_y, z=pos.z}
local spos = {x=pos.x, y=ground_y+10, z=pos.z}
if get_snow(pos) then
if animate then
local minp = addvectors(spos, {x=-9, y=3, z=-9})
local maxp = addvectors(spos, {x= 9, y=5, z= 9})
local vel = {x=0, y= -1, z=-1}
local acc = {x=0, y= 0, z=0}
minetest.add_particlespawner(3, 0.5,
minp, maxp,
vel, vel,
acc, acc,
5, 5,
50, 50,
false, "weather_snow.png", player:get_player_name())
end
snow.place(pos, true)
--minetest.place_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="default:snow"}) -- LazyJ
end
-- disable falling snow in desert
local desert_perlin = minetest.get_perlin(SEEDDIFF3, OCTAVES3, PERSISTENCE3, SCALE3)
local noise3 = desert_perlin:get2d({x=pos.x+150,y=pos.z+50}) -- Offsets must match minetest mapgen desert perlin.
if noise3 > 0.35 then -- Smooth transition 0.35 to 0.45.
return false
end
return true
end
return false
end
-- Snow
minetest.register_globalstep(function(dtime)
for _, player in ipairs(minetest.get_connected_players()) do
local ppos = player:getpos()
local sminp = addvectors(ppos, {x=-20, y=0, z=-20})
local smaxp = addvectors(ppos, {x= 20, y=0, z= 20})
local addvectors = vector and vector.add
--Returns a random position between minp and maxp.
local randpos = function (minp, maxp)
local x,y,z
if minp.x > maxp.x then
x = math.random(maxp.x,minp.x) else x = math.random(minp.x,maxp.x) end
y = minp.y
if minp.z > maxp.z then
z = math.random(maxp.z,minp.z) else z = math.random(minp.z,maxp.z) end
return {x=x,y=y,z=z}
end
local default_snow_particle = {
amount = 3,
time = 0.5,
exptime = 5,
size = 50,
collisiondetection = false,
vertical = false,
}
local function get_snow_particledef(data)
for n,i in pairs(default_snow_particle) do
data[n] = data[n] or i
end
for _,i in pairs({"vel", "acc", "exptime", "size"}) do
data["min"..i] = data[i]
data["max"..i] = data[i]
end
data.texture = "weather_snow.png^[transform"..math.random(0,7)
return data
end
local function snow_fall(pos, player, animate)
local ground_y = nil
for y=pos.y+10,pos.y+20,1 do
local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name
if n ~= "air" and n ~= "ignore" then
return
end
end
for y=pos.y+10,pos.y-15,-1 do
local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name
if n ~= "air" and n ~= "ignore" then
ground_y = y
break
end
end
if not ground_y then return end
pos = {x=pos.x, y=ground_y, z=pos.z}
local spos = {x=pos.x, y=ground_y+10, z=pos.z}
if get_snow(pos) then
if animate then
local minp = addvectors(spos, {x=-9, y=3, z=-9})
local maxp = addvectors(spos, {x= 9, y=5, z= 9})
local vel = {x=0, y= -1, z=-1}
local acc = {x=0, y= 0, z=0}
minetest.add_particlespawner(get_snow_particledef({
minpos = minp,
maxpos = maxp,
vel = vel,
acc = acc,
playername = player:get_player_name()
}))
end
snow.place(pos, true)
--minetest.place_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="default:snow"}) -- LazyJ
end
end
-- Snow
minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
local ppos = player:getpos()
-- Make sure player is not in a cave/house...
if get_snow(ppos) and minetest.env:get_node_light(ppos, 0.5) == 15 then
local sminp = addvectors(ppos, {x=-20, y=0, z=-20})
local smaxp = addvectors(ppos, {x= 20, y=0, z= 20})
-- Make sure player is not in a cave/house...
if get_snow(ppos) and minetest.get_node_light(ppos, 0.5) == 15 then
local minp = addvectors(ppos, {x=-9, y=3, z=-9})
local maxp = addvectors(ppos, {x= 9, y=5, z= 9})
local minp = addvectors(ppos, {x=-9, y=3, z=-9})
local maxp = addvectors(ppos, {x= 9, y=5, z= 9})
local minp_deep = addvectors(ppos, {x=-5, y=3.2, z=-5})
local maxp_deep = addvectors(ppos, {x= 5, y=1.6, z= 5})
local minp_deep = addvectors(ppos, {x=-5, y=3.2, z=-5})
local maxp_deep = addvectors(ppos, {x= 5, y=1.6, z= 5})
local vel = {x=0, y= -1, z=-1}
local acc = {x=0, y= 0, z=0}
if not snow.lighter_snowfall then
minetest.add_particlespawner(5, 0.5,
minp, maxp,
vel, vel,
acc, acc,
5, 5,
25, 25,
false, "weather_snow.png", player:get_player_name())
minetest.add_particlespawner(4, 0.5,
minp_deep, maxp_deep,
vel, vel,
acc, acc,
4, 4,
25, 25,
false, "weather_snow.png", player:get_player_name())
if math.random(1,5) == 4 then
snow_fall(randpos(sminp, smaxp), player)
end
else
if math.random(1,5) == 4 then
snow_fall(randpos(sminp, smaxp), player, true)
end
end
else
local vel = {x=0, y= -1, z=-1}
local acc = {x=0, y= 0, z=0}
if not snow.lighter_snowfall then
minetest.add_particlespawner(get_snow_particledef({
amount = 5,
minpos = minp,
maxpos = maxp,
vel = vel,
acc = acc,
size = 25,
playername = player:get_player_name()
}))
minetest.add_particlespawner(get_snow_particledef({
amount = 4,
minpos = minp_deep,
maxpos = maxp_deep,
vel = vel,
acc = acc,
exptime = 4,
size = 25,
playername = player:get_player_name()
}))
if math.random(1,5) == 4 then
snow_fall(randpos(sminp, smaxp), player)
end
else
if math.random(1,5) == 4 then
snow_fall(randpos(sminp, smaxp), player, true)
end
end
end
end)
end
end
end)

View File

@ -40,7 +40,7 @@ local pine_tree = {
axiom="TABff",
rules_a="[&T+f+ff+ff+ff+f]GA",
rules_b="[&T+f+Gf+Gf+Gf]GB",
trunk="default:tree",
trunk="default:pinetree",
leaves="snow:needles",
angle=90,
iterations=1,
@ -55,7 +55,7 @@ local xmas_tree = {
axiom="TABff",
rules_a="[&T+f+ff+ff+ff+f]GA",
rules_b="[&T+f+Gf+Gf+Gf]GB",
trunk="default:tree",
trunk="default:pinetree",
leaves="snow:needles_decorated",
angle=90,
iterations=1,
@ -68,59 +68,59 @@ local xmas_tree = {
--Makes pine tree
function snow.make_pine(pos,snow,xmas)
local env = minetest.env
local perlin1 = env:get_perlin(112,3, 0.5, 150)
local try_node = function(pos, node)
local n = env:get_node(pos).name
if n == "air" or n == "ignore" then
env:add_node(pos,node)
end
end
--Clear ground.
for x=-1,1 do
for z=-1,1 do
if env:get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snow" then
env:remove_node({x=pos.x+x,y=pos.y,z=pos.z+z})
end
if env:get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snowblock" then
env:remove_node({x=pos.x+x,y=pos.y,z=pos.z+z})
end
end
end
if xmas then
env:remove_node(pos)
minetest.env:spawn_tree(pos, xmas_tree)
else
minetest.env:spawn_tree(pos, pine_tree)
end
if snow then
local x,z = pos.x,pos.z
try_node({x=x+1,y=pos.y+3,z=z+1},{name="default:snow"})
try_node({x=x-1,y=pos.y+3,z=z-1},{name="default:snow"})
try_node({x=x-1,y=pos.y+3,z=z+1},{name="default:snow"})
try_node({x=x+1,y=pos.y+3,z=z-1},{name="default:snow"})
try_node({x=x+1,y=pos.y+5,z=z},{name="default:snow"})
try_node({x=x-1,y=pos.y+5,z=z},{name="default:snow"})
try_node({x=x,y=pos.y+5,z=z+1},{name="default:snow"})
try_node({x=x,y=pos.y+5,z=z-1},{name="default:snow"})
end
if xmas then
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="snow:star_lit"}) -- Added lit star. ~ LazyJ
elseif snow and perlin1:get2d({x=pos.x,y=pos.z}) > 0.53 then
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="default:snow"})
end
local minetest = minetest
local perlin1 = minetest.get_perlin(112,3, 0.5, 150)
local try_node = function(pos, node)
local n = minetest.get_node(pos).name
if n == "air" or n == "ignore" then
minetest.add_node(pos,node)
end
end
--Clear ground.
for x=-1,1 do
for z=-1,1 do
if minetest.get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snow" then
minetest.remove_node({x=pos.x+x,y=pos.y,z=pos.z+z})
end
if minetest.get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snowblock" then
minetest.remove_node({x=pos.x+x,y=pos.y,z=pos.z+z})
end
end
end
if xmas then
minetest.remove_node(pos)
minetest.spawn_tree(pos, xmas_tree)
else
minetest.spawn_tree(pos, pine_tree)
end
if snow then
local x,z = pos.x,pos.z
try_node({x=x+1,y=pos.y+3,z=z+1},{name="default:snow"})
try_node({x=x-1,y=pos.y+3,z=z-1},{name="default:snow"})
try_node({x=x-1,y=pos.y+3,z=z+1},{name="default:snow"})
try_node({x=x+1,y=pos.y+3,z=z-1},{name="default:snow"})
try_node({x=x+1,y=pos.y+5,z=z},{name="default:snow"})
try_node({x=x-1,y=pos.y+5,z=z},{name="default:snow"})
try_node({x=x,y=pos.y+5,z=z+1},{name="default:snow"})
try_node({x=x,y=pos.y+5,z=z-1},{name="default:snow"})
end
if xmas then
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="snow:star_lit"}) -- Added lit star. ~ LazyJ
elseif snow and perlin1:get2d({x=pos.x,y=pos.z}) > 0.53 then
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="default:snow"})
end
end
--Makes pine tree
function snow.voxelmanip_pine(pos,a,data)
local c_snow = minetest.get_content_id("default:snow")
local c_pine_needles = minetest.get_content_id("snow:needles")
local c_tree = minetest.get_content_id("default:tree")
local c_air = minetest.get_content_id("air")
local c_snow = minetest.get_content_id("default:snow")
local c_pine_needles = minetest.get_content_id("snow:needles")
local c_pinetree = minetest.get_content_id("default:pinetree")
local c_air = minetest.get_content_id("air")
local perlin1 = minetest.get_perlin(112,3, 0.5, 150)
--Clear ground.
for x=-1,1 do
@ -170,7 +170,7 @@ function snow.voxelmanip_pine(pos,a,data)
end
end
end
data[a:index(pos.x,pos.y+i,pos.z)] = c_tree
data[a:index(pos.x,pos.y+i,pos.z)] = c_pinetree
end
data[a:index(pos.x,pos.y+5,pos.z)] = c_pine_needles
data[a:index(pos.x,pos.y+6,pos.z)] = c_pine_needles

View File

@ -100,14 +100,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- Choose biomes
local pr = PseudoRandom(seed+57)
local biome
local biome2
-- Land biomes
biome = pr:next(1, 5)
local snowy = biome == 1 -- spawns alot of snow
local plain = biome == 2 -- spawns not much
local alpine = biome == 3 -- rocky terrain
-- Water biomes
biome2 = pr:next(1, 5)
local biome2 = pr:next(1, 5)
local cool = biome == 1 -- only spawns ice on edge of water
local icebergs = biome == 2
local icesheet = biome == 3
@ -151,14 +150,17 @@ minetest.register_on_generated(function(minp, maxp, seed)
if data[vi] == c_leaves or data[vi] == c_jungleleaves then
for y = ground_y, -16, -1 do
local vi = area:index(x, y, z)
if data[vi] ~= c_leaves
and data[vi] ~= c_jungleleaves
and data[vi] ~= c_tree
and data[vi] ~= c_air
and data[vi] ~= c_apple then
break
else
data[vi] = c_air
local id = data[vi]
if id ~= c_air then
if id == c_leaves
or id == c_jungleleaves
or id == c_tree
or id == c_air
or id == c_apple then
data[vi] = c_air
else
break
end
end
end
end
@ -254,24 +256,24 @@ minetest.register_on_generated(function(minp, maxp, seed)
local rand = pr:next(1,4) == 1
if ((x1 and x1 ~= c_water and x1 ~= c_ice
and x1 ~= c_air and x1 ~= c_ignore)
or ((cool or icebergs) and x1 == c_ice and rand))
or (rand and (cool or icebergs) and x1 == c_ice))
or ((z1 and z1 ~= c_water and z1 ~= c_ice
and z1 ~= c_air and z1 ~= c_ignore)
or ((cool or icebergs) and z1 == c_ice and rand))
or (rand and (cool or icebergs) and z1 == c_ice))
or ((xz1 and xz1 ~= c_water and xz1 ~= c_ice
and xz1 ~= c_air and xz1 ~= c_ignore)
or ((cool or icebergs) and xz1 == c_ice and rand))
or (rand and (cool or icebergs) and xz1 == c_ice))
or ((xz2 and xz2 ~= c_water and xz2 ~= c_ice
and xz2 ~= c_air and xz2 ~= c_ignore)
or ((cool or icebergs) and xz2 == c_ice and rand))
or (rand and (cool or icebergs) and xz2 == c_ice))
or ((x2 and x2 ~= c_water and x2 ~= c_ice
and x2 ~= c_air and x2 ~= c_ignore)
or ((cool or icebergs) and x2 == c_ice and rand))
or (rand and (cool or icebergs) and x2 == c_ice))
or ((z2 and z2 ~= c_water and z2 ~= c_ice
and z2 ~= c_air and z2 ~= c_ignore)
or ((cool or icebergs) and z2 == c_ice and rand))
or (y ~= c_water and y ~= c_ice and y ~= "air")
or (pr:next(1,6) == 1 and icebergs) then
or (rand and (cool or icebergs) and z2 == c_ice))
or (y ~= c_water and y ~= c_ice) -- and y ~= "air") …I don't think y can be a string here ~HybridDog
or (icebergs and pr:next(1,6) == 1) then
data[node] = c_ice
end
else

View File

@ -66,7 +66,7 @@ end
--Christmas easter egg
minetest.register_on_mapgen_init( function()
if minetest.get_modpath("skins") ~= nil then
if rawget(_G, "skins") then
skins.add("character_snow_man")
end
end
@ -209,7 +209,7 @@ minetest.register_node("snow:star", {
minetest.register_node("snow:star_lit", {
description = "Star Lighted",
drawtype = "plantlike",
light_source = default.LIGHT_MAX - 1,
light_source = LIGHT_MAX,
tiles = {"snow_star_lit.png"},
wield_image = "snow_star.png",
paramtype = "light",
@ -228,6 +228,7 @@ minetest.register_node("snow:star_lit", {
-- Moss
minetest.register_node("snow:moss", {
description = "Moss",
inventory_image = "snow_moss.png",
tiles = {"snow_moss.png"},
drawtype = "signlike",
paramtype = "light",
@ -242,6 +243,18 @@ minetest.register_node("snow:moss", {
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
-- Snow Brick
minetest.register_node("snow:snow_brick", {
description = "Snow Brick",
@ -265,15 +278,7 @@ minetest.register_node("snow:snow_brick", {
}),
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could also
-- double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass"
-- Thinking in terms of layers, dirt_with_snow could also double as
-- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
or minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name="default:dirt_with_snow"})
end
end
on_construct = snow_onto_dirt
})
@ -299,13 +304,7 @@ minetest.register_node("snow:snow_cobble", {
}),
-- The "on_construct" part below, thinking in terms of layers, dirt_with_snow could also
-- double as dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass"
or minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name="default:dirt_with_snow"})
end
end
on_construct = snow_onto_dirt
})
@ -321,18 +320,12 @@ minetest.override_item("default:ice", {
--param2 is reserved for how much ice will freezeover.
sunlight_propagates = true, -- 2
drawtype = "glasslike",
inventory_image = minetest.inventorycube("default_ice.png"),
inventory_image = minetest.inventorycube("default_ice.png").."^[brighten",
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
groups = {cracky=2, crumbly=1, choppy=1, --[[oddly_breakable_by_hand=1,]] melts=1},
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass"
or minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name="default:dirt_with_snow"})
end
end,
on_construct = snow_onto_dirt,
liquids_pointable = true,
--Make ice freeze over when placed by a maximum of 10 blocks.
after_place_node = function(pos, placer, itemstack, pointed_thing)
@ -350,13 +343,7 @@ minetest.override_item("default:snowblock", {
-- Snow blocks should be easy to dig because they are just fluffy snow. ~ LazyJ
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",
on_construct = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass"
-- Thinking in terms of layers, dirt_with_snow could also double as
-- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
or minetest.get_node(pos).name == "default:dirt" then
minetest.set_node(pos, {name="default:dirt_with_snow"})
end
end
on_construct = snow_onto_dirt
-- Thinking in terms of layers, dirt_with_snow could also double as
-- dirt_with_frost which adds subtlety to the winterscape. ~ LazyJ, 2014_04_04
})

View File

@ -53,7 +53,7 @@ than I originally planned. :p ~ LazyJ
--
local function is_water(pos)
local nn = minetest.env:get_node(pos).name
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
@ -62,16 +62,13 @@ end
-- Sled entity
--
local HUD
-- FIXME: FIND WHAT IS HUD FOR
local sled = {
physical = false,
collisionbox = {-0.6,-0.25,-0.6, 0.6,0.3,0.6},
visual = "mesh",
mesh = "sled.x",
textures = {"sled.png"},
HUD,
nil,
driver = nil,
sliding = false,
@ -184,8 +181,8 @@ minetest.register_craftitem("snow:sled", {
local name = placer:get_player_name()
local player_pos = placer:getpos()
if not players_sled[name] then
if minetest.get_node({x=player_pos.x,y=player_pos.y, z=player_pos.z}).name == "default:snow" then
local sled = minetest.env:add_entity(pos, "snow:sled")
if minetest.get_node(player_pos).name == "default:snow" then
local sled = minetest.add_entity(pos, "snow:sled")
sled:get_luaentity():on_rightclick(placer)
end
end

View File

@ -51,8 +51,9 @@ There is one in each of the "stairsplus.register_all" sections.
-- next section of stairsplus stuff. ~LazyJ
if (minetest.get_modpath("moreblocks"))
and rawget(_G, "stairsplus")
-- 'If' MoreBlocks was found, well, 'then' go ahead with this next part:
-- 'If' MoreBlocks was found and stairsplus is available, well, 'then' go ahead with this next part:
then
@ -271,9 +272,6 @@ for _, name in pairs(snow_nodes) do
local groups = {}
for k, v in pairs(ndef.groups) do groups[k] = v end
local drop
-- FIXME: FIND WHAT IS DROP SUPPOSED TO BE FROM AND FOR WHAT IT IS HERE
stairsplus:register_all("moreblocks", name, nodename, {
description = ndef.description,
drop = drop,

BIN
mods/snow/textures/character_snow_man.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
mods/snow/textures/character_snow_man_preview.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

BIN
mods/snow/textures/character_snow_man_preview_back.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

BIN
mods/snow/textures/default_ice.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

BIN
mods/snow/textures/snow_moss.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 619 B

BIN
mods/snow/textures/snow_needles.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 860 B

After

Width:  |  Height:  |  Size: 660 B

BIN
mods/snow/textures/snow_needles_decorated.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 937 B

After

Width:  |  Height:  |  Size: 884 B

BIN
mods/snow/textures/snow_needles_decorated_animated.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
mods/snow/textures/snow_sapling_pine.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 272 B

BIN
mods/snow/textures/snow_sled.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

BIN
mods/snow/textures/snow_snow_brick.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

BIN
mods/snow/textures/snow_snow_cobble.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

BIN
mods/snow/textures/snow_star.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

After

Width:  |  Height:  |  Size: 349 B

BIN
mods/snow/textures/snow_star_lit.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 302 B

BIN
mods/snow/textures/snow_xmas_tree.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 299 B

BIN
mods/snow/textures/weather_snow.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B