mirror of
https://github.com/Splizard/minetest-mod-snow.git
synced 2025-06-29 23:00:24 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
d3ba0dd21c | |||
3b44907492 | |||
d215ac3fff | |||
854e10f087 | |||
794fb251ba | |||
6120890c5d | |||
d06bec7c52 | |||
df38728f4b | |||
8f34ce940b |
11
.github/workflows/luacheck.yml
vendored
11
.github/workflows/luacheck.yml
vendored
@ -1,11 +0,0 @@
|
|||||||
on: [push, pull_request]
|
|
||||||
name: luacheck
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- name: lint
|
|
||||||
uses: Roang-zero1/factorio-mod-luacheck@master
|
|
||||||
with:
|
|
||||||
luacheckrc_url: ""
|
|
25
.luacheckrc
25
.luacheckrc
@ -1,25 +0,0 @@
|
|||||||
read_globals = {
|
|
||||||
"dump", "vector",
|
|
||||||
"table", "math", "PseudoRandom", "VoxelArea",
|
|
||||||
"stairs", "stairsplus", "skins", "treecapitator",
|
|
||||||
default = {
|
|
||||||
fields = {
|
|
||||||
player_attached = {
|
|
||||||
read_only = false,
|
|
||||||
other_fields = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
other_fields = true
|
|
||||||
},
|
|
||||||
minetest = {
|
|
||||||
fields = {
|
|
||||||
registered_nodes = {
|
|
||||||
read_only = false,
|
|
||||||
other_fields = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
other_fields = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
globals = {"snow"}
|
|
||||||
-- ignore = {"421", "423"}
|
|
@ -1,6 +1,6 @@
|
|||||||
default
|
default
|
||||||
|
christmas_craft?
|
||||||
flowers?
|
flowers?
|
||||||
stairs?
|
|
||||||
moreblocks?
|
moreblocks?
|
||||||
skins?
|
skins?
|
||||||
treecapitator?
|
treecapitator?
|
||||||
|
4
init.lua
4
init.lua
@ -51,7 +51,7 @@ local load_time_start = minetest.get_us_time()
|
|||||||
|
|
||||||
|
|
||||||
-- Original init.lua File Broken into Smaller Files
|
-- Original init.lua File Broken into Smaller Files
|
||||||
local srcpath = minetest.get_modpath"snow".."/src/"
|
local srcpath = minetest.get_modpath("snow").."/src/"
|
||||||
dofile(srcpath.."abms.lua")
|
dofile(srcpath.."abms.lua")
|
||||||
dofile(srcpath.."aliases.lua")
|
dofile(srcpath.."aliases.lua")
|
||||||
dofile(srcpath.."crafting.lua")
|
dofile(srcpath.."crafting.lua")
|
||||||
@ -203,5 +203,5 @@ local msg = "[snow] loaded after ca. " .. time .. " seconds."
|
|||||||
if time > 0.01 then
|
if time > 0.01 then
|
||||||
print(msg)
|
print(msg)
|
||||||
else
|
else
|
||||||
minetest.log("info", msg)
|
minetest.log("action", msg)
|
||||||
end
|
end
|
||||||
|
Binary file not shown.
BIN
schematics/snow_pine.mts
Normal file
BIN
schematics/snow_pine.mts
Normal file
Binary file not shown.
BIN
schematics/snow_pine_from_sapling.mts
Normal file
BIN
schematics/snow_pine_from_sapling.mts
Normal file
Binary file not shown.
BIN
schematics/snow_xmas_from_sapling.mts
Normal file
BIN
schematics/snow_xmas_from_sapling.mts
Normal file
Binary file not shown.
BIN
schematics/snowy_snow_pine_from_sapling.mts
Normal file
BIN
schematics/snowy_snow_pine_from_sapling.mts
Normal file
Binary file not shown.
BIN
schematics/snowy_snow_xmas_from_sapling.mts
Normal file
BIN
schematics/snowy_snow_xmas_from_sapling.mts
Normal file
Binary file not shown.
47
src/abms.lua
47
src/abms.lua
@ -1,12 +1,10 @@
|
|||||||
-- Added to change dirt_with_snow to dirt if covered with blocks that don't let
|
-- Added to change dirt_with_snow to dirt if covered with blocks that don't let light through (sunlight_propagates) or have a light paramtype and liquidtype combination. ~ LazyJ, 2014_03_08
|
||||||
-- light through (sunlight_propagates) or have a light paramtype and
|
|
||||||
-- liquidtype combination. ~ LazyJ, 2014_03_08
|
|
||||||
|
|
||||||
minetest.register_abm({
|
--[[minetest.register_abm({
|
||||||
nodenames = {"default:dirt_with_snow"},
|
nodenames = {"default:dirt_with_snow"},
|
||||||
interval = 2,
|
interval = 2,
|
||||||
chance = 20,
|
chance = 20,
|
||||||
action = function(pos)
|
action = function(pos, node)
|
||||||
local name = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
|
local name = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
|
||||||
local nodedef = minetest.registered_nodes[name]
|
local nodedef = minetest.registered_nodes[name]
|
||||||
if name ~= "ignore"
|
if name ~= "ignore"
|
||||||
@ -19,7 +17,7 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
]]--
|
||||||
|
|
||||||
|
|
||||||
--Melting
|
--Melting
|
||||||
@ -31,7 +29,7 @@ minetest.register_abm({
|
|||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"group:melts"},
|
nodenames = {"group:melts"},
|
||||||
neighbors = {"group:igniter", "default:torch", "default:furnace_active", "group:hot"},
|
neighbors = {"group:igniter", "default:torch", "default:torch_wall", "default:furnace_active", "group:hot"},
|
||||||
interval = 10,
|
interval = 10,
|
||||||
chance = 2,
|
chance = 2,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
@ -39,9 +37,9 @@ minetest.register_abm({
|
|||||||
if intensity == 1 then
|
if intensity == 1 then
|
||||||
minetest.set_node(pos, {name="default:water_source"})
|
minetest.set_node(pos, {name="default:water_source"})
|
||||||
elseif intensity == 2 then
|
elseif intensity == 2 then
|
||||||
minetest.set_node(pos, {name="default:water_flowing", param2=7})
|
minetest.set_node(pos, {name="default:water_flowing", param2=7})
|
||||||
elseif intensity == 3 then
|
elseif intensity == 3 then
|
||||||
minetest.set_node(pos, {name="default:water_flowing", param2=3})
|
minetest.set_node(pos, {name="default:water_flowing", param2=3})
|
||||||
--[[ LazyJ, you need to add param2, which defines the amount of the flowing water ~ HybridDog 2015_03_06
|
--[[ 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
|
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
|
node with a water_source for a couple seconds and then replace the water_source with
|
||||||
@ -63,11 +61,11 @@ minetest.register_abm({
|
|||||||
-- the water to flow and spread before the
|
-- the water to flow and spread before the
|
||||||
-- water_source is changed to air. ~ LazyJ
|
-- water_source is changed to air. ~ LazyJ
|
||||||
if minetest.get_node(pos).name == "default:water_source" then
|
if minetest.get_node(pos).name == "default:water_source" then
|
||||||
minetest.add_node(pos,{name="air"})
|
minetest.add_node(pos,{name="air"})
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
--]]
|
--]]
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -78,9 +76,10 @@ minetest.register_abm({
|
|||||||
|
|
||||||
--Freezing
|
--Freezing
|
||||||
--Water freezes when in contact with snow.
|
--Water freezes when in contact with snow.
|
||||||
|
--[[
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"default:water_source"},
|
nodenames = {"default:water_source"},
|
||||||
-- Added "group:icemaker" and snowbrick. ~ LazyJ
|
-- Added "group:icemaker" and snowbrick. ~ LazyJ
|
||||||
neighbors = {"default:snow", "default:snowblock", "snow:snow_brick", "group:icemaker"},
|
neighbors = {"default:snow", "default:snowblock", "snow:snow_brick", "group:icemaker"},
|
||||||
interval = 20,
|
interval = 20,
|
||||||
chance = 4,
|
chance = 4,
|
||||||
@ -108,10 +107,7 @@ minetest.register_abm({
|
|||||||
if math.random(2) == 2 then
|
if math.random(2) == 2 then
|
||||||
p.y = pos.y
|
p.y = pos.y
|
||||||
if minetest.get_node(p).name == "default:water_source" then
|
if minetest.get_node(p).name == "default:water_source" then
|
||||||
minetest.add_node(p, {
|
minetest.add_node(p,{name="default:ice", param2 = math.random(0,node.param2-1)})
|
||||||
name = "default:ice",
|
|
||||||
param2 = math.random(0,node.param2-1)
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -125,7 +121,7 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
]]--
|
||||||
|
|
||||||
|
|
||||||
--Spread moss to cobble.
|
--Spread moss to cobble.
|
||||||
@ -143,13 +139,13 @@ minetest.register_abm({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
--Grow Pine Saplings
|
--Grow Pine Saplings
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"snow:sapling_pine"},
|
nodenames = {"snow:sapling_pine"},
|
||||||
interval = 10,
|
interval = 10,
|
||||||
chance = 50,
|
chance = 50,
|
||||||
action = function(pos)
|
action = function(pos, node)
|
||||||
|
|
||||||
-- Check if there is enough vertical-space for the sapling to grow without
|
-- Check if there is enough vertical-space for the sapling to grow without
|
||||||
-- hitting anything else. ~ LazyJ, 2014_04_10
|
-- hitting anything else. ~ LazyJ, 2014_04_10
|
||||||
@ -166,7 +162,7 @@ minetest.register_abm({
|
|||||||
-- This finds the sapling under the grown tree. ~ LazyJ
|
-- This finds the sapling under the grown tree. ~ LazyJ
|
||||||
if minetest.get_node(pos).name == "snow:sapling_pine" then
|
if minetest.get_node(pos).name == "snow:sapling_pine" then
|
||||||
-- This switches the sapling to a tree trunk. ~ LazyJ
|
-- This switches the sapling to a tree trunk. ~ LazyJ
|
||||||
minetest.set_node(pos, {name="default:pinetree"})
|
minetest.set_node(pos, {name="default:pine_tree"})
|
||||||
-- This is more for testing but it may be useful info to some admins when
|
-- This is more for testing but it may be useful info to some admins when
|
||||||
-- grepping the server logs too. ~ LazyJ
|
-- grepping the server logs too. ~ LazyJ
|
||||||
minetest.log("action", "A pine sapling grows into a tree at "..minetest.pos_to_string(pos))
|
minetest.log("action", "A pine sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||||
@ -176,13 +172,12 @@ minetest.register_abm({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--Grow Christmas Tree Saplings
|
--Grow Christmas Tree Saplings
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"snow:xmas_tree"},
|
nodenames = {"snow:xmas_tree"},
|
||||||
interval = 10,
|
interval = 10,
|
||||||
chance = 50,
|
chance = 50,
|
||||||
action = function(pos)
|
action = function(pos, node)
|
||||||
|
|
||||||
-- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ
|
-- 'If' there is air in each of the 8 nodes dirctly above the sapling,... ~LazyJ
|
||||||
for i = 1,8 do
|
for i = 1,8 do
|
||||||
@ -201,10 +196,11 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
|
||||||
--Backwards Compatability.
|
--Backwards Compatability.
|
||||||
|
--[[
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"},
|
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
@ -214,3 +210,4 @@ minetest.register_abm({
|
|||||||
minetest.set_node_level(pos, 7*(tonumber(node.name:sub(-1))))
|
minetest.set_node_level(pos, 7*(tonumber(node.name:sub(-1))))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
]]--
|
||||||
|
@ -29,6 +29,7 @@ minetest.register_alias("cobblesnow", "snow:snow_cobble")
|
|||||||
|
|
||||||
-- To clean up my first stairsplus attempt.
|
-- To clean up my first stairsplus attempt.
|
||||||
-- Stair
|
-- Stair
|
||||||
|
--[[
|
||||||
minetest.register_alias(":default:stair_snowblock", "moreblocks:stair_snowblock")
|
minetest.register_alias(":default:stair_snowblock", "moreblocks:stair_snowblock")
|
||||||
minetest.register_alias(":default:stair_snowblock_half", "moreblocks:stair_snowblock_half")
|
minetest.register_alias(":default:stair_snowblock_half", "moreblocks:stair_snowblock_half")
|
||||||
minetest.register_alias(":default:stair_snowblock_right_half", "moreblocks:stair_snowblock_right_half")
|
minetest.register_alias(":default:stair_snowblock_right_half", "moreblocks:stair_snowblock_right_half")
|
||||||
@ -102,3 +103,8 @@ minetest.register_alias(":default:micro_ice_4", "moreblocks:micro_ice_4")
|
|||||||
minetest.register_alias(":default:micro_ice_12", "moreblocks:micro_ice_12")
|
minetest.register_alias(":default:micro_ice_12", "moreblocks:micro_ice_12")
|
||||||
minetest.register_alias(":default:micro_ice_14", "moreblocks:micro_ice_14")
|
minetest.register_alias(":default:micro_ice_14", "moreblocks:micro_ice_14")
|
||||||
minetest.register_alias(":default:micro_ice_15", "moreblocks:micro_ice_15")
|
minetest.register_alias(":default:micro_ice_15", "moreblocks:micro_ice_15")
|
||||||
|
]]--
|
||||||
|
-- If christmas_craft then override his star with this mod one.
|
||||||
|
if minetest.get_modpath("christmas_craft") then
|
||||||
|
minetest.register_alias_force("christmas_craft:christmas_star", "snow:star")
|
||||||
|
end
|
||||||
|
@ -57,7 +57,7 @@ of snowblocks (and then use them to water-grief by melting the snow blocks).
|
|||||||
|
|
||||||
~ LazyJ
|
~ LazyJ
|
||||||
|
|
||||||
--]]
|
]]--
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
@ -77,7 +77,7 @@ minetest.register_craft({
|
|||||||
"default:snowblock",
|
"default:snowblock",
|
||||||
"default:snowblock"
|
"default:snowblock"
|
||||||
}
|
}
|
||||||
})]]
|
})]]--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
local function snow_fall(pos)
|
function snow_fall(pos, player, animate)
|
||||||
local ground_y = nil
|
local ground_y = nil
|
||||||
for y=pos.y+10,pos.y+20,1 do
|
for y=pos.y+10,pos.y+20,1 do
|
||||||
local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name
|
local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name
|
||||||
@ -32,8 +32,8 @@ local PRECSPR = 6 -- Time scale for precipitation variation in minutes
|
|||||||
local PRECOFF = -0.4 -- Precipitation offset, higher = rains more often
|
local PRECOFF = -0.4 -- Precipitation offset, higher = rains more often
|
||||||
local GSCYCLE = 0.5 -- Globalstep cycle (seconds)
|
local GSCYCLE = 0.5 -- Globalstep cycle (seconds)
|
||||||
local FLAKES = 32 -- Snowflakes per cycle
|
local FLAKES = 32 -- Snowflakes per cycle
|
||||||
--~ local DROPS = 128 -- Raindrops per cycle
|
local DROPS = 128 -- Raindrops per cycle
|
||||||
--~ local RAINGAIN = 0.2 -- Rain sound volume
|
local RAINGAIN = 0.2 -- Rain sound volume
|
||||||
local COLLIDE = false -- Whether particles collide with nodes
|
local COLLIDE = false -- Whether particles collide with nodes
|
||||||
local NISVAL = 39 -- Clouds RGB value at night
|
local NISVAL = 39 -- Clouds RGB value at night
|
||||||
local DASVAL = 175 -- Clouds RGB value in daytime
|
local DASVAL = 175 -- Clouds RGB value in daytime
|
||||||
@ -81,6 +81,12 @@ local grad = 14 / 95
|
|||||||
local yint = 1496 / 95
|
local yint = 1496 / 95
|
||||||
|
|
||||||
|
|
||||||
|
-- Initialise noise objects to nil
|
||||||
|
|
||||||
|
local nobj_temp = nil
|
||||||
|
local nobj_humid = nil
|
||||||
|
local nobj_prec = nil
|
||||||
|
|
||||||
|
|
||||||
-- Globalstep function
|
-- Globalstep function
|
||||||
local timer = 0
|
local timer = 0
|
||||||
@ -96,20 +102,20 @@ if snow.enable_snowfall then
|
|||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local pos_player = player:get_pos()
|
local ppos = player:getpos()
|
||||||
local pposy = math.floor(pos_player.y) + 2 -- Precipitation when swimming
|
local pposy = math.floor(ppos.y) + 2 -- Precipitation when swimming
|
||||||
if pposy >= YLIMIT - 2 then
|
if pposy >= YLIMIT - 2 then
|
||||||
local pposx = math.floor(pos_player.x)
|
local pposx = math.floor(ppos.x)
|
||||||
local pposz = math.floor(pos_player.z)
|
local pposz = math.floor(ppos.z)
|
||||||
local ppos = {x = pposx, y = pposy, z = pposz}
|
local ppos = {x = pposx, y = pposy, z = pposz}
|
||||||
|
|
||||||
local nobj_temp = minetest.get_perlin(np_temp)
|
local nobj_temp = nobj_temp or minetest.get_perlin(np_temp)
|
||||||
local nobj_humid = minetest.get_perlin(np_humid)
|
local nobj_humid = nobj_humid or minetest.get_perlin(np_humid)
|
||||||
local nobj_prec = minetest.get_perlin(np_prec)
|
local nobj_prec = nobj_prec or minetest.get_perlin(np_prec)
|
||||||
|
|
||||||
local nval_temp = nobj_temp:get_2d({x = pposx, y = pposz})
|
local nval_temp = nobj_temp:get2d({x = pposx, y = pposz})
|
||||||
local nval_humid = nobj_humid:get_2d({x = pposx, y = pposz})
|
local nval_humid = nobj_humid:get2d({x = pposx, y = pposz})
|
||||||
local nval_prec = nobj_prec:get_2d({x = os.clock() / 60, y = 0})
|
local nval_prec = nobj_prec:get2d({x = os.clock() / 60, y = 0})
|
||||||
|
|
||||||
-- Biome system: Frozen biomes below heat 35,
|
-- Biome system: Frozen biomes below heat 35,
|
||||||
-- deserts below line 14 * t - 95 * h = -1496
|
-- deserts below line 14 * t - 95 * h = -1496
|
||||||
@ -151,13 +157,14 @@ if snow.enable_snowfall then
|
|||||||
((time - 0.1875) / 0.0521) * difsval)
|
((time - 0.1875) / 0.0521) * difsval)
|
||||||
end
|
end
|
||||||
-- Set sky to overcast bluish-grey
|
-- Set sky to overcast bluish-grey
|
||||||
player:set_sky({
|
player:set_sky(
|
||||||
base_color = {r = sval, g = sval, b = sval + 16, a = 255},
|
{r = sval, g = sval, b = sval + 16, a = 255},
|
||||||
type = "plain",
|
"plain",
|
||||||
})
|
{}
|
||||||
|
)
|
||||||
else
|
else
|
||||||
-- Reset sky to normal
|
-- Reset sky to normal
|
||||||
player:set_sky({type = "regular"})
|
player:set_sky({}, "regular", {})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -177,7 +184,7 @@ if snow.enable_snowfall then
|
|||||||
}, true)
|
}, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for _ = 1, FLAKES do
|
for flake = 1, FLAKES do
|
||||||
|
|
||||||
x, y, z = pposx - 24 + math.random(0, 48), pposy + 12, pposz - 24 + math.random(0, 48)
|
x, y, z = pposx - 24 + math.random(0, 48), pposy + 12, pposz - 24 + math.random(0, 48)
|
||||||
|
|
||||||
@ -200,7 +207,7 @@ if snow.enable_snowfall then
|
|||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "snowdrift_snowflake" ..
|
texture = "snowdrift_snowflake" ..
|
||||||
math.random(1, 12) .. ".png",
|
math.random(1, 12) .. ".png",
|
||||||
playername = player_name
|
playername = player:get_player_name()
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,7 +12,7 @@ saplings grow into trees. --]]
|
|||||||
|
|
||||||
-- Part 1: To disable the mapgen, add the *starting* comment under this line.
|
-- Part 1: To disable the mapgen, add the *starting* comment under this line.
|
||||||
|
|
||||||
local perlin_scale, nosmooth_rarity
|
--[[local perlin_scale, nosmooth_rarity
|
||||||
if not snow.disable_mapgen then
|
if not snow.disable_mapgen then
|
||||||
print("[snow] Mapgen enabled!")
|
print("[snow] Mapgen enabled!")
|
||||||
|
|
||||||
@ -32,6 +32,7 @@ if not snow.disable_mapgen then
|
|||||||
nosmooth_rarity = 1-rarity/50
|
nosmooth_rarity = 1-rarity/50
|
||||||
perlin_scale = size*100/rarity
|
perlin_scale = size*100/rarity
|
||||||
mg.perlin_scale = perlin_scale
|
mg.perlin_scale = perlin_scale
|
||||||
|
local smooth_rarity_max, smooth_rarity_min, smooth_rarity_dif
|
||||||
if smooth then
|
if smooth then
|
||||||
local smooth_trans_size = 4 --snow.smooth_trans_size
|
local smooth_trans_size = 4 --snow.smooth_trans_size
|
||||||
mg.smooth_rarity_max = upper_rarity(nosmooth_rarity+smooth_trans_size*2/perlin_scale)
|
mg.smooth_rarity_max = upper_rarity(nosmooth_rarity+smooth_trans_size*2/perlin_scale)
|
||||||
@ -59,18 +60,18 @@ if not snow.disable_mapgen then
|
|||||||
|
|
||||||
|
|
||||||
--Identify the mapgen.
|
--Identify the mapgen.
|
||||||
local mgname = minetest.get_mapgen_setting"mg_name"
|
local mgname = minetest.get_mapgen_setting("mg_name")
|
||||||
if not mgname then
|
if not mgname then
|
||||||
minetest.log("error", "[MOD] Snow Biomes: WARNING! mapgen could not be identifyed!")
|
minetest.log("error", "[MOD] Snow Biomes: WARNING! mapgen could not be identifyed!")
|
||||||
end
|
end
|
||||||
local path = minetest.get_modpath"snow"
|
local path = minetest.get_modpath("snow")
|
||||||
if mgname == "v7" then
|
if mgname == "v6" then
|
||||||
--Load mapgen_v7 compatibility.
|
|
||||||
dofile(path.."/src/mapgen_v7.lua")
|
|
||||||
else
|
|
||||||
--Load mapgen_v6 compatibility.
|
--Load mapgen_v6 compatibility.
|
||||||
dofile(path.."/src/mapgen_v6.lua")
|
dofile(path.."/src/mapgen_v6.lua")
|
||||||
end
|
else]]--
|
||||||
|
--Load mapgen_v7 compatibility.
|
||||||
|
dofile(minetest.get_modpath("snow").."/src/mapgen_v7.lua")
|
||||||
|
--[[ end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- To complete the commenting-out add the *closing* comment under this line.
|
-- To complete the commenting-out add the *closing* comment under this line.
|
||||||
@ -80,7 +81,7 @@ local pine_tree = {
|
|||||||
axiom="TABff",
|
axiom="TABff",
|
||||||
rules_a="[&T+f+ff+ff+ff+f]GA",
|
rules_a="[&T+f+ff+ff+ff+f]GA",
|
||||||
rules_b="[&T+f+Gf+Gf+Gf]GB",
|
rules_b="[&T+f+Gf+Gf+Gf]GB",
|
||||||
trunk="default:pinetree",
|
trunk="default:pine_tree",
|
||||||
leaves="snow:needles",
|
leaves="snow:needles",
|
||||||
angle=90,
|
angle=90,
|
||||||
iterations=1,
|
iterations=1,
|
||||||
@ -95,7 +96,7 @@ local xmas_tree = {
|
|||||||
axiom="TABff",
|
axiom="TABff",
|
||||||
rules_a="[&T+f+ff+ff+ff+f]GA",
|
rules_a="[&T+f+ff+ff+ff+f]GA",
|
||||||
rules_b="[&T+f+Gf+Gf+Gf]GB",
|
rules_b="[&T+f+Gf+Gf+Gf]GB",
|
||||||
trunk="default:pinetree",
|
trunk="default:pine_tree",
|
||||||
leaves="snow:needles_decorated",
|
leaves="snow:needles_decorated",
|
||||||
angle=90,
|
angle=90,
|
||||||
iterations=1,
|
iterations=1,
|
||||||
@ -109,11 +110,11 @@ local xmas_tree = {
|
|||||||
--Makes pine tree
|
--Makes pine tree
|
||||||
function snow.make_pine(pos,snow,xmas)
|
function snow.make_pine(pos,snow,xmas)
|
||||||
local minetest = minetest
|
local minetest = minetest
|
||||||
local function try_node(p, node)
|
local try_node = function(pos, node)
|
||||||
local n = minetest.get_node(p).name
|
local n = minetest.get_node(pos).name
|
||||||
if n == "air"
|
if n == "air"
|
||||||
or n == "ignore" then
|
or n == "ignore" then
|
||||||
minetest.add_node(p, node)
|
minetest.add_node(pos, node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if xmas then
|
if xmas then
|
||||||
@ -137,7 +138,7 @@ function snow.make_pine(pos,snow,xmas)
|
|||||||
if xmas then
|
if xmas then
|
||||||
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="snow:star_lit"}) -- Added lit star. ~ LazyJ
|
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="snow:star_lit"}) -- Added lit star. ~ LazyJ
|
||||||
elseif snow
|
elseif snow
|
||||||
and minetest.get_perlin(112,3, 0.5, perlin_scale):get_2d({x=pos.x,y=pos.z}) > nosmooth_rarity then
|
and minetest.get_perlin(112,3, 0.5, perlin_scale):get2d({x=pos.x,y=pos.z}) > nosmooth_rarity then
|
||||||
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="default:snow"})
|
try_node({x=pos.x,y=pos.y+7,z=pos.z},{name="default:snow"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -148,20 +149,21 @@ end
|
|||||||
function snow.voxelmanip_pine(pos,a,data)
|
function snow.voxelmanip_pine(pos,a,data)
|
||||||
local c_snow = minetest.get_content_id("default:snow")
|
local c_snow = minetest.get_content_id("default:snow")
|
||||||
local c_pine_needles = minetest.get_content_id("snow:needles")
|
local c_pine_needles = minetest.get_content_id("snow:needles")
|
||||||
local c_pinetree = minetest.get_content_id("default:pinetree")
|
local c_pinetree = minetest.get_content_id("default:pine_tree")
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
|
||||||
local perlin1 = minetest.get_perlin(112,3, 0.5, perlin_scale)
|
local perlin1 = minetest.get_perlin(112,3, 0.5, perlin_scale)
|
||||||
for off_z = -1,1 do
|
for z = -1,1 do
|
||||||
local z = pos.z + off_z
|
local z = pos.z + z
|
||||||
for off_x = -1,1 do
|
for x = -1,1 do
|
||||||
local x = pos.x + off_x
|
local x = pos.x + x
|
||||||
|
|
||||||
--Make tree.
|
--Make tree.
|
||||||
for i = 1,2 do
|
for i = 1,2 do
|
||||||
data[a:index(x,pos.y+i,z)] = c_pine_needles
|
data[a:index(x,pos.y+i,z)] = c_pine_needles
|
||||||
if x ~= 0
|
if x ~= 0
|
||||||
and z ~= 0
|
and z ~= 0
|
||||||
and perlin1:get_2d({x=x,y=z}) > nosmooth_rarity then
|
and perlin1:get2d({x=x,y=z}) > nosmooth_rarity then
|
||||||
local abovenode = a:index(x,pos.y+i+1,z)
|
local abovenode = a:index(x,pos.y+i+1,z)
|
||||||
data[abovenode] = c_snow
|
data[abovenode] = c_snow
|
||||||
end
|
end
|
||||||
@ -176,16 +178,16 @@ function snow.voxelmanip_pine(pos,a,data)
|
|||||||
data[a:index(x-1,y,z)] = c_pine_needles
|
data[a:index(x-1,y,z)] = c_pine_needles
|
||||||
data[a:index(x,y,z+1)] = c_pine_needles
|
data[a:index(x,y,z+1)] = c_pine_needles
|
||||||
data[a:index(x,y,z-1)] = c_pine_needles
|
data[a:index(x,y,z-1)] = c_pine_needles
|
||||||
if perlin1:get_2d({x=x+1,y=z}) > nosmooth_rarity then
|
if perlin1:get2d({x=x+1,y=z}) > nosmooth_rarity then
|
||||||
data[a:index(x+1,y+1,z)] = c_snow
|
data[a:index(x+1,y+1,z)] = c_snow
|
||||||
end
|
end
|
||||||
if perlin1:get_2d({x=x+1,y=z}) > nosmooth_rarity then
|
if perlin1:get2d({x=x+1,y=z}) > nosmooth_rarity then
|
||||||
data[a:index(x-1,y+1,z)] = c_snow
|
data[a:index(x-1,y+1,z)] = c_snow
|
||||||
end
|
end
|
||||||
if perlin1:get_2d({x=x,y=z+1}) > nosmooth_rarity then
|
if perlin1:get2d({x=x,y=z+1}) > nosmooth_rarity then
|
||||||
data[a:index(x,y+1,z+1)] = c_snow
|
data[a:index(x,y+1,z+1)] = c_snow
|
||||||
end
|
end
|
||||||
if perlin1:get_2d({x=x,y=z-1}) > nosmooth_rarity then
|
if perlin1:get2d({x=x,y=z-1}) > nosmooth_rarity then
|
||||||
data[a:index(x,y+1,z-1)] = c_snow
|
data[a:index(x,y+1,z-1)] = c_snow
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -194,13 +196,13 @@ function snow.voxelmanip_pine(pos,a,data)
|
|||||||
end
|
end
|
||||||
data[a:index(pos.x,pos.y+5,pos.z)] = c_pine_needles
|
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
|
data[a:index(pos.x,pos.y+6,pos.z)] = c_pine_needles
|
||||||
if perlin1:get_2d({x=pos.x,y=pos.z}) > nosmooth_rarity then
|
if perlin1:get2d({x=pos.x,y=pos.z}) > nosmooth_rarity then
|
||||||
data[a:index(pos.x,pos.y+7,pos.z)] = c_snow
|
data[a:index(pos.x,pos.y+7,pos.z)] = c_snow
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
]]--
|
||||||
-- treecapitator support
|
-- treecapitator support
|
||||||
if minetest.global_exists"treecapitator" then
|
if minetest.global_exists("treecapitator") then
|
||||||
treecapitator.register_tree{
|
treecapitator.register_tree{
|
||||||
trees = {"default:pine_tree"},
|
trees = {"default:pine_tree"},
|
||||||
leaves = {"snow:needles"},
|
leaves = {"snow:needles"},
|
||||||
|
@ -14,11 +14,11 @@ local np_default = {
|
|||||||
-- 2D noise for coldness
|
-- 2D noise for coldness
|
||||||
|
|
||||||
local mg = snow.mapgen
|
local mg = snow.mapgen
|
||||||
local scale_coldness = mg.perlin_scale
|
local scale = mg.perlin_scale
|
||||||
local np_cold = {
|
local np_cold = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
spread = {x=scale_coldness, y=scale_coldness, z=scale_coldness},
|
spread = {x=scale, y=scale, z=scale},
|
||||||
seed = 112,
|
seed = 112,
|
||||||
octaves = 3,
|
octaves = 3,
|
||||||
persist = 0.5
|
persist = 0.5
|
||||||
@ -142,10 +142,10 @@ local function define_contents()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local smooth = snow.smooth_biomes
|
local smooth = snow.smooth_biomes
|
||||||
local smooth_rarity_max = mg.smooth_rarity_max
|
local smooth_rarity_max = mg.smooth_rarity_max or 0
|
||||||
local smooth_rarity_min = mg.smooth_rarity_min
|
local smooth_rarity_min = mg.smooth_rarity_min or 0
|
||||||
local smooth_rarity_dif = mg.smooth_rarity_dif
|
local smooth_rarity_dif = mg.smooth_rarity_dif or 0
|
||||||
local nosmooth_rarity = mg.nosmooth_rarity
|
local nosmooth_rarity = mg.nosmooth_rarity or 0
|
||||||
|
|
||||||
snow.register_on_configuring(function(name, v)
|
snow.register_on_configuring(function(name, v)
|
||||||
if name == "debug" then
|
if name == "debug" then
|
||||||
@ -186,9 +186,7 @@ local function get_perlins(sidelen)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local nbuf_default = {}
|
local nbuf_default, nbuf_cold, nbuf_ice
|
||||||
local nbuf_cold = {}
|
|
||||||
local nbuf_ice = {}
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
local t1 = os.clock()
|
local t1 = os.clock()
|
||||||
|
|
||||||
@ -201,18 +199,18 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
define_contents()
|
define_contents()
|
||||||
end
|
end
|
||||||
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object"voxelmanip"
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||||
local data = vm:get_data()
|
local data = vm:get_data()
|
||||||
local param2s = vm:get_param2_data()
|
local param2s = vm:get_param2_data()
|
||||||
|
|
||||||
local heightmap = minetest.get_mapgen_object"heightmap"
|
local heightmap = minetest.get_mapgen_object("heightmap")
|
||||||
|
|
||||||
local snow_tab,num = {},1
|
local snow_tab,num = {},1
|
||||||
local pines_tab,pnum = {},1
|
local pines_tab,pnum = {},1
|
||||||
|
|
||||||
get_perlins(x1 - x0 + 1)
|
get_perlins(x1 - x0 + 1)
|
||||||
local nvals_default = perlin_objs.default:get_2dMap_flat({x=x0+150, y=z0+50}, nbuf_default)
|
local nvals_default = perlin_objs.default:get2dMap_flat({x=x0+150, y=z0+50}, nbuf_default)
|
||||||
local nvals_cold, nvals_ice, ndia
|
local nvals_cold, nvals_ice, ndia
|
||||||
|
|
||||||
-- Choose biomes
|
-- Choose biomes
|
||||||
@ -231,7 +229,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local nodes_added
|
local nodes_added
|
||||||
|
|
||||||
-- Loop through columns in chunk
|
-- Loop through columns in chunk
|
||||||
local is_smooth = smooth and not snowy
|
local smooth = smooth and not snowy
|
||||||
local write_to_map = false
|
local write_to_map = false
|
||||||
local ni = 1
|
local ni = 1
|
||||||
for z = z0, z1 do
|
for z = z0, z1 do
|
||||||
@ -239,9 +237,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local in_biome = false
|
local in_biome = false
|
||||||
local test
|
local test
|
||||||
if nvals_default[ni] < 0.35 then
|
if nvals_default[ni] < 0.35 then
|
||||||
nvals_cold = nvals_cold or perlin_objs.cold:get_2dMap_flat({x=x0, y=z0}, nbuf_cold)
|
nvals_cold = nvals_cold or perlin_objs.cold:get2dMap_flat({x=x0, y=z0}, nbuf_cold)
|
||||||
test = math.min(nvals_cold[ni], 1)
|
test = math.min(nvals_cold[ni], 1)
|
||||||
if is_smooth then
|
if smooth then
|
||||||
if test >= smooth_rarity_max
|
if test >= smooth_rarity_max
|
||||||
or (
|
or (
|
||||||
test > smooth_rarity_min
|
test > smooth_rarity_min
|
||||||
@ -257,7 +255,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if not in_biome then
|
if not in_biome then
|
||||||
if alpine
|
if alpine
|
||||||
and test
|
and test
|
||||||
and test > (is_smooth and smooth_rarity_min or nosmooth_rarity) then
|
and test > (smooth and smooth_rarity_min or nosmooth_rarity) then
|
||||||
-- remove trees near alpine
|
-- remove trees near alpine
|
||||||
local ground_y
|
local ground_y
|
||||||
if data[area:index(x, maxp.y, z)] == c.air then
|
if data[area:index(x, maxp.y, z)] == c.air then
|
||||||
@ -291,7 +289,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not nvals_ice then
|
if not nvals_ice then
|
||||||
nvals_ice = perlin_objs.ice:get_2dMap_flat({x=x0, y=z0}, nbuf_ice)
|
nvals_ice = perlin_objs.ice:get2dMap_flat({x=x0, y=z0}, nbuf_ice)
|
||||||
|
|
||||||
nodes_added = true
|
nodes_added = true
|
||||||
write_to_map = true
|
write_to_map = true
|
||||||
@ -347,7 +345,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
data[area:index(x, ground_y+1, z)] = c.dry_shrub
|
data[area:index(x, ground_y+1, z)] = c.dry_shrub
|
||||||
else
|
else
|
||||||
if snowy
|
if snowy
|
||||||
or test > (is_smooth and smooth_rarity_max or
|
or test > (smooth and smooth_rarity_max or
|
||||||
nosmooth_rarity) then
|
nosmooth_rarity) then
|
||||||
-- more, deeper snow
|
-- more, deeper snow
|
||||||
data[node] = c.snow_block
|
data[node] = c.snow_block
|
||||||
@ -390,13 +388,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
and (cool or icebergs)
|
and (cool or icebergs)
|
||||||
and pr:next(1,4) == 1 then
|
and pr:next(1,4) == 1 then
|
||||||
|
|
||||||
local vi_ice = node + 1
|
local vi = node + 1
|
||||||
for i = 1,6 do
|
for i = 1,6 do
|
||||||
if data[vi_ice] == c.ice then
|
if data[vi] == c.ice then
|
||||||
ice = true
|
ice = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
vi_ice = vi_ice + ndia[i]
|
vi = vi + ndia[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -507,8 +505,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
-- set snow
|
-- set snow
|
||||||
data[area:index(i[3], i[1]+1, i[2])] = c.snow
|
data[area:index(i[3], i[1]+1, i[2])] = c.snow
|
||||||
end
|
end
|
||||||
for k = 1, num-1 do
|
for i = 1, num-1 do
|
||||||
local i = snow_tab[k]
|
i = snow_tab[i]
|
||||||
local y,z,x,test = unpack(i)
|
local y,z,x,test = unpack(i)
|
||||||
test = (test-nosmooth_rarity)/(1-nosmooth_rarity) -- /(1-0.53)
|
test = (test-nosmooth_rarity)/(1-nosmooth_rarity) -- /(1-0.53)
|
||||||
if test > 0 then
|
if test > 0 then
|
||||||
@ -518,8 +516,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if h ~= 1 then
|
if h ~= 1 then
|
||||||
-- search for nearby snow
|
-- search for nearby snow
|
||||||
y = y+1
|
y = y+1
|
||||||
for off = -1,1,2 do
|
for i = -1,1,2 do
|
||||||
for _,cord in pairs({{x+off,z}, {x,z+off}}) do
|
for _,cord in pairs({{x+i,z}, {x,z+i}}) do
|
||||||
local nd = data[area:index(cord[1], y, cord[2])]
|
local nd = data[area:index(cord[1], y, cord[2])]
|
||||||
if nd == c.air
|
if nd == c.air
|
||||||
or is_plantlike(nd) then
|
or is_plantlike(nd) then
|
||||||
@ -579,7 +577,7 @@ local biome_strings = {
|
|||||||
{"snowy", "plain", "alpine", "normal", "normal"},
|
{"snowy", "plain", "alpine", "normal", "normal"},
|
||||||
{"cool", "icebergs", "icesheet", "icecave", "icehole"}
|
{"cool", "icebergs", "icesheet", "icecave", "icehole"}
|
||||||
}
|
}
|
||||||
function biome_to_string(num)
|
function biome_to_string(num,num2)
|
||||||
local biome = biome_strings[1][num] or "unknown "..num
|
local biome = biome_strings[1][num] or "unknown "..num
|
||||||
return biome
|
return biome
|
||||||
end
|
end
|
||||||
|
@ -1,41 +1,58 @@
|
|||||||
minetest.register_biome({
|
--[[minetest.register_biome({
|
||||||
name = "snow_biome_default",
|
name = "snow_biome_default",
|
||||||
|
node_dust = "default:snow",
|
||||||
node_top = "default:dirt_with_snow",
|
node_top = "default:dirt_with_snow",
|
||||||
depth_top = 1,
|
depth_top = 1,
|
||||||
node_filler = "default:dirt",
|
node_filler = "default:dirt",
|
||||||
depth_filler = 2,
|
depth_filler = 1,
|
||||||
|
node_riverbed = "default:sand",
|
||||||
height_min = snow.min_height,
|
depth_riverbed = 2,
|
||||||
height_max = snow.min_height+60,
|
y_min = 5,
|
||||||
|
y_max = 31000,
|
||||||
heat_point = 10.0,
|
heat_point = 10.0,
|
||||||
humidity_point = 40.0,
|
humidity_point = 40.0,
|
||||||
})
|
})
|
||||||
|
]]--
|
||||||
minetest.register_biome({
|
minetest.register_biome({
|
||||||
name = "snow_biome_forest",
|
name = "snow_biome_forest",
|
||||||
|
node_dust = "default:snow",
|
||||||
node_top = "default:dirt_with_snow",
|
node_top = "default:dirt_with_snow",
|
||||||
depth_top = 1,
|
depth_top = 1,
|
||||||
node_filler = "default:dirt",
|
node_filler = "default:dirt",
|
||||||
depth_filler = 2,
|
depth_filler = 2,
|
||||||
|
node_riverbed = "default:sand",
|
||||||
|
depth_riverbed = 2,
|
||||||
|
y_min = 2,
|
||||||
|
y_max = 31000,
|
||||||
|
heat_point = 20.0,
|
||||||
|
humidity_point = 70.0,
|
||||||
|
})
|
||||||
|
|
||||||
height_min = snow.min_height,
|
minetest.register_biome({
|
||||||
height_max = snow.min_height+60,
|
name = "pine_forest",
|
||||||
heat_point = 10.0,
|
node_top = "default:dirt_with_grass",
|
||||||
humidity_point = 55.0,
|
depth_top = 1,
|
||||||
|
node_filler = "default:dirt",
|
||||||
|
depth_filler = 3,
|
||||||
|
node_riverbed = "default:sand",
|
||||||
|
depth_riverbed = 2,
|
||||||
|
y_min = 60,
|
||||||
|
y_max = 31000,
|
||||||
|
heat_point = 40,
|
||||||
|
humidity_point = 68,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_biome({
|
minetest.register_biome({
|
||||||
name = "snow_biome_lush",
|
name = "snow_biome_lush",
|
||||||
|
node_dust = "default:snow",
|
||||||
node_top = "default:dirt_with_snow",
|
node_top = "default:dirt_with_snow",
|
||||||
depth_top = 1,
|
depth_top = 1,
|
||||||
node_filler = "default:dirt",
|
node_filler = "default:dirt",
|
||||||
depth_filler = 2,
|
depth_filler = 2,
|
||||||
|
node_riverbed = "default:sand",
|
||||||
height_min = snow.min_height,
|
depth_riverbed = 2,
|
||||||
height_max = snow.min_height+60,
|
y_min = 2,
|
||||||
|
y_max = 31000,
|
||||||
heat_point = 10.0,
|
heat_point = 10.0,
|
||||||
humidity_point = 70.0,
|
humidity_point = 70.0,
|
||||||
})
|
})
|
||||||
@ -43,17 +60,17 @@ minetest.register_biome({
|
|||||||
minetest.register_biome({
|
minetest.register_biome({
|
||||||
name = "snow_biome_alpine",
|
name = "snow_biome_alpine",
|
||||||
|
|
||||||
node_top = "default:stone",
|
node_top = "default:dirt_with_snow",
|
||||||
depth_top = 1,
|
depth_top = 1,
|
||||||
node_filler = "default:stone",
|
node_filler = "default:stone",
|
||||||
|
|
||||||
height_min = snow.min_height+60,
|
y_min = 60,
|
||||||
height_max = 31000,
|
y_max = 31000,
|
||||||
heat_point = 10.0,
|
heat_point = 10.0,
|
||||||
humidity_point = 40.0,
|
humidity_point = 40.0,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_biome({
|
--[[minetest.register_biome({
|
||||||
name = "snow_biome_sand",
|
name = "snow_biome_sand",
|
||||||
|
|
||||||
node_top = "default:sand",
|
node_top = "default:sand",
|
||||||
@ -61,21 +78,50 @@ minetest.register_biome({
|
|||||||
node_filler = "default:stone",
|
node_filler = "default:stone",
|
||||||
depth_filler = 0,
|
depth_filler = 0,
|
||||||
|
|
||||||
height_min = -31000,
|
y_min = -2,
|
||||||
height_max = 2,
|
y_max = 31000,
|
||||||
heat_point = 10.0,
|
heat_point = 10.0,
|
||||||
humidity_point = 40.0,
|
humidity_point = 40.0,
|
||||||
})
|
})
|
||||||
|
]]--
|
||||||
|
|
||||||
--Pine tree.
|
--Pine tree.
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "schematic",
|
deco_type = "schematic",
|
||||||
place_on = "default:dirt_with_snow",
|
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
fill_ratio = 0.005,
|
noise_params = {
|
||||||
biomes = {"snow_biome_default"},
|
offset = -0.004,
|
||||||
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
scale = 0.01,
|
||||||
|
spread = {x = 100, y = 100, z = 100},
|
||||||
|
seed = 4087,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.7,
|
||||||
|
},
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 4,
|
||||||
|
biomes = {"snowy_grassland", "coniferous_forest", "taiga", "snow_biome_alpine"},
|
||||||
|
schematic = minetest.get_modpath("snow").."/schematics/snow_pine.mts",
|
||||||
|
flags = "place_center_x, place_center_z",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
--offset = 0.036,
|
||||||
|
offset = 0.020,
|
||||||
|
scale = 0.002,
|
||||||
|
spread = {x = 250, y = 250, z = 250},
|
||||||
|
seed = 2861,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.66
|
||||||
|
},
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 4,
|
||||||
|
biomes = {"snow_biome_forest", "pine_forest"},
|
||||||
|
schematic = minetest.get_modpath("snow").."/schematics/snow_pine.mts",
|
||||||
flags = "place_center_x, place_center_z",
|
flags = "place_center_x, place_center_z",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -84,18 +130,10 @@ minetest.register_decoration({
|
|||||||
place_on = "default:dirt_with_snow",
|
place_on = "default:dirt_with_snow",
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
fill_ratio = 0.05,
|
fill_ratio = 0.05,
|
||||||
biomes = {"snow_biome_forest"},
|
y_max = 31000,
|
||||||
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
y_min = 4,
|
||||||
flags = "place_center_x, place_center_z",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_decoration({
|
|
||||||
deco_type = "schematic",
|
|
||||||
place_on = "default:dirt_with_snow",
|
|
||||||
sidelen = 16,
|
|
||||||
fill_ratio = 0.1,
|
|
||||||
biomes = {"snow_biome_lush"},
|
biomes = {"snow_biome_lush"},
|
||||||
schematic = minetest.get_modpath("snow").."/schematics/pine.mts",
|
schematic = minetest.get_modpath("snow").."/schematics/snow_pine.mts",
|
||||||
flags = "place_center_x, place_center_z",
|
flags = "place_center_x, place_center_z",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -104,27 +142,84 @@ minetest.register_decoration({
|
|||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
place_on = "default:dirt_with_snow",
|
place_on = "default:dirt_with_snow",
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
fill_ratio = 0.005,
|
fill_ratio = 0.001,
|
||||||
biomes = {"snow_biome_default"},
|
y_max = 31000,
|
||||||
|
y_min = 1,
|
||||||
|
biomes = {"snowy_grassland"},
|
||||||
decoration = "default:dry_shrub",
|
decoration = "default:dry_shrub",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = "default:dirt_with_snow",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 0.01,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1,
|
||||||
|
biomes = {"snow_biome_forest", "snow_biome_lush"},
|
||||||
|
decoration = "default:dry_shrub",
|
||||||
|
})
|
||||||
|
|
||||||
|
--Snow shrubs.
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = "default:dirt_with_snow",
|
||||||
|
sidelen = 16,
|
||||||
|
fill_ratio = 0.005,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1,
|
||||||
|
biomes = {"snowy_grassland"},
|
||||||
|
decoration = "snow:shrub_covered",
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
place_on = "default:dirt_with_snow",
|
place_on = "default:dirt_with_snow",
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
fill_ratio = 0.05,
|
fill_ratio = 0.05,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1,
|
||||||
biomes = {"snow_biome_forest", "snow_biome_lush"},
|
biomes = {"snow_biome_forest", "snow_biome_lush"},
|
||||||
decoration = "default:dry_shrub",
|
decoration = "snow:shrub_covered",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Snow Flowers
|
||||||
|
local function register_flower(seed, name)
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = {"default:dirt_with_snow"},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
offset = -0.015,
|
||||||
|
scale = 0.025,
|
||||||
|
spread = {x = 200, y = 200, z = 200},
|
||||||
|
seed = seed,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.6
|
||||||
|
},
|
||||||
|
biomes = {"snow_biome_lush", "snow_biome_forest", "taiga", "snowy_grassland", "tundra"},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
decoration = "snow:flower_"..name,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
register_flower(436, "rose")
|
||||||
|
register_flower(19822, "tulip")
|
||||||
|
register_flower(1220999, "dandelion_yellow")
|
||||||
|
register_flower(36662, "geranium")
|
||||||
|
register_flower(1133, "viola")
|
||||||
|
register_flower(73133, "dandelion_white")
|
||||||
|
|
||||||
--Snow.
|
--Snow.
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "simple",
|
deco_type = "simple",
|
||||||
place_on = "default:dirt_with_snow",
|
place_on = "default:dirt_with_snow",
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
fill_ratio = 10,
|
fill_ratio = 10,
|
||||||
biomes = {"snow_biome_default", "snow_biome_forest", "snow_biome_lush"},
|
y_max = 31000,
|
||||||
|
y_min = 1,
|
||||||
|
biomes = {"snow_biome_forest", "snow_biome_lush"},
|
||||||
decoration = "default:snow",
|
decoration = "default:snow",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -133,6 +228,8 @@ minetest.register_decoration({
|
|||||||
place_on = "default:stone",
|
place_on = "default:stone",
|
||||||
sidelen = 16,
|
sidelen = 16,
|
||||||
fill_ratio = 10,
|
fill_ratio = 10,
|
||||||
|
y_max = 31000,
|
||||||
|
y_min = 1,
|
||||||
biomes = {"snow_biome_alpine"},
|
biomes = {"snow_biome_alpine"},
|
||||||
decoration = "default:snow",
|
decoration = "default:snow",
|
||||||
})
|
})
|
||||||
|
241
src/nodes.lua
241
src/nodes.lua
@ -1,29 +1,81 @@
|
|||||||
-- NODES
|
-- NODES
|
||||||
|
|
||||||
|
-- Grow sapling
|
||||||
|
|
||||||
|
local function grow_pine_tree(pos)
|
||||||
|
local path = minetest.get_modpath("snow").."/schematics/snow_pine_from_sapling.mts"
|
||||||
|
minetest.place_schematic({x= pos.x -2, y = pos.y - 1, z = pos.z - 2}, path, "0", nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function grow_snowy_pine_tree(pos)
|
||||||
|
local path = minetest.get_modpath("snow").."/schematics/snowy_snow_pine_from_sapling.mts"
|
||||||
|
minetest.place_schematic({x= pos.x -2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function grow_xmas_tree(pos)
|
||||||
|
local path = minetest.get_modpath("snow").."/schematics/snow_xmas_from_sapling.mts"
|
||||||
|
minetest.place_schematic({x= pos.x -2, y = pos.y - 1, z = pos.z - 2}, path, "0", nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function grow_snowy_xmas_tree(pos)
|
||||||
|
local path = minetest.get_modpath("snow").."/schematics/snowy_snow_xmas_from_sapling.mts"
|
||||||
|
minetest.place_schematic({x= pos.x -2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_snow_nearby(pos)
|
||||||
|
return minetest.find_node_near(pos, 1, {"group:snowy"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function grow_sapling(pos)
|
||||||
|
if not default.can_grow(pos) then
|
||||||
|
-- try again 5 min later
|
||||||
|
minetest.get_node_timer(pos):start(300)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == "snow:sapling_pine" then
|
||||||
|
minetest.log("action", "A Snow Pine sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||||
|
if is_snow_nearby(pos) then
|
||||||
|
grow_snowy_pine_tree(pos)
|
||||||
|
else
|
||||||
|
grow_pine_tree(pos)
|
||||||
|
end
|
||||||
|
elseif node.name == "snow:xmas_tree" then
|
||||||
|
minetest.log("action", "A Christmas sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||||
|
if is_snow_nearby(pos) then
|
||||||
|
grow_snowy_xmas_tree(pos)
|
||||||
|
else
|
||||||
|
grow_xmas_tree(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "snow:convert_saplings_to_node_timer",
|
||||||
|
nodenames = {"snow:sapling_pine", "snow:xmas_tree"},
|
||||||
|
action = function(pos)
|
||||||
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- Pine Needles
|
-- Pine Needles
|
||||||
local nodedef = {
|
local nodedef = table.copy(minetest.registered_nodes["default:pine_needles"])
|
||||||
description = "Pine Needles",
|
nodedef.description = "Snow Pine Needles"
|
||||||
drawtype = "allfaces_optional",
|
nodedef.tiles = {"snow_needles.png"}
|
||||||
visual_scale = 1.3,
|
nodedef.visual_scale = 1.3
|
||||||
tiles = {"snow_needles.png"},
|
nodedef.drop = {
|
||||||
waving = 1,
|
max_items = 1,
|
||||||
paramtype = "light",
|
items = {
|
||||||
groups = {snappy=3},
|
{
|
||||||
furnace_burntime = 1,
|
-- player will get sapling with 1/20 chance
|
||||||
drop = {
|
items = {'snow:sapling_pine'},
|
||||||
max_items = 1,
|
rarity = 20,
|
||||||
items = {
|
},
|
||||||
{
|
{
|
||||||
-- player will get sapling with 1/20 chance
|
items = {'snow:needles'},
|
||||||
items = {'snow:sapling_pine'},
|
|
||||||
rarity = 20,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
items = {'snow:needles'},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
@ -32,7 +84,7 @@ If christmas_content is enabled, then this next part will override the pine need
|
|||||||
The Xmas tree needles are registred and defined a farther down in this nodes.lua file.
|
The Xmas tree needles are registred and defined a farther down in this nodes.lua file.
|
||||||
|
|
||||||
~ LazyJ
|
~ LazyJ
|
||||||
]]
|
]]--
|
||||||
if snow.christmas_content then
|
if snow.christmas_content then
|
||||||
table.insert(nodedef.drop.items, 1, {
|
table.insert(nodedef.drop.items, 1, {
|
||||||
-- player will get xmas tree with 1/120 chance
|
-- player will get xmas tree with 1/120 chance
|
||||||
@ -43,12 +95,6 @@ end
|
|||||||
|
|
||||||
minetest.register_node("snow:needles", table.copy(nodedef))
|
minetest.register_node("snow:needles", table.copy(nodedef))
|
||||||
|
|
||||||
default.register_leafdecay{
|
|
||||||
trunks = {"default:pine_tree"},
|
|
||||||
leaves = {"snow:needles"},
|
|
||||||
radius = 2,
|
|
||||||
}
|
|
||||||
|
|
||||||
snow.register_on_configuring(function(name, v)
|
snow.register_on_configuring(function(name, v)
|
||||||
if name == "christmas_content" then
|
if name == "christmas_content" then
|
||||||
local drop = minetest.registered_nodes["snow:needles"].drop
|
local drop = minetest.registered_nodes["snow:needles"].drop
|
||||||
@ -64,9 +110,7 @@ snow.register_on_configuring(function(name, v)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Christmas egg
|
||||||
|
|
||||||
-- Christmas egg
|
|
||||||
if minetest.global_exists("skins") then
|
if minetest.global_exists("skins") then
|
||||||
skins.add("character_snow_man")
|
skins.add("character_snow_man")
|
||||||
end
|
end
|
||||||
@ -82,32 +126,41 @@ if snow.disable_deco_needle_ani then
|
|||||||
else
|
else
|
||||||
-- Animated, "blinking lights" version. ~ LazyJ
|
-- Animated, "blinking lights" version. ~ LazyJ
|
||||||
nodedef.inventory_image = minetest.inventorycube("snow_needles_decorated.png")
|
nodedef.inventory_image = minetest.inventorycube("snow_needles_decorated.png")
|
||||||
nodedef.tiles = {{
|
nodedef.tiles = {
|
||||||
name="snow_needles_decorated_animated.png",
|
{name="snow_needles_decorated_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=20.0}}
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16,
|
}
|
||||||
length=20.0}
|
|
||||||
}}
|
|
||||||
end
|
end
|
||||||
nodedef.drop.items[#nodedef.drop.items] = {items = {'snow:needles_decorated'}}
|
nodedef.drop.items[#nodedef.drop.items] = {items = {'snow:needles_decorated'}}
|
||||||
|
|
||||||
minetest.register_node("snow:needles_decorated", nodedef)
|
minetest.register_node("snow:needles_decorated", table.copy(nodedef))
|
||||||
|
|
||||||
|
-- Leaf decay
|
||||||
|
|
||||||
|
default.register_leafdecay{
|
||||||
|
trunks = {"default:pine_tree"},
|
||||||
|
leaves = {"snow:needles", "default:pine_needles", "snow:needles_decorated"},
|
||||||
|
radius = 2,
|
||||||
|
}
|
||||||
|
|
||||||
-- Saplings
|
-- Saplings
|
||||||
|
|
||||||
nodedef = {
|
nodedef = table.copy(minetest.registered_nodes["default:pine_sapling"])
|
||||||
description = "Pine Sapling",
|
nodedef.description = "Snow Pine Sapling"
|
||||||
drawtype = "plantlike",
|
nodedef.tiles = {"snow_sapling_pine.png"}
|
||||||
visual_scale = 1.0,
|
nodedef.inventory_image = "snow_sapling_pine.png"
|
||||||
tiles = {"snow_sapling_pine.png"},
|
nodedef.wield_image = "snow_sapling_pine.png"
|
||||||
inventory_image = "snow_sapling_pine.png",
|
nodedef.on_timer = grow_sapling
|
||||||
wield_image = "snow_sapling_pine.png",
|
nodedef.on_place = function(itemstack, placer, pointed_thing)
|
||||||
paramtype = "light",
|
itemstack = default.sapling_on_place(
|
||||||
walkable = false,
|
itemstack,
|
||||||
groups = {snappy=2,dig_immediate=3},
|
placer,
|
||||||
furnace_burntime = 10,
|
pointed_thing,
|
||||||
sounds = default.node_sound_defaults(),
|
"snow:sapling_pine",
|
||||||
}
|
{x = -2, y = 1, z = -2},
|
||||||
|
{x = 2, y = 13, z = 2},
|
||||||
|
4)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
-- Pine Sapling
|
-- Pine Sapling
|
||||||
minetest.register_node("snow:sapling_pine", table.copy(nodedef))
|
minetest.register_node("snow:sapling_pine", table.copy(nodedef))
|
||||||
@ -117,10 +170,21 @@ nodedef.description = "Christmas Tree"
|
|||||||
nodedef.tiles = {"snow_xmas_tree.png"}
|
nodedef.tiles = {"snow_xmas_tree.png"}
|
||||||
nodedef.inventory_image = "snow_xmas_tree.png"
|
nodedef.inventory_image = "snow_xmas_tree.png"
|
||||||
nodedef.wield_image = "snow_xmas_tree.png"
|
nodedef.wield_image = "snow_xmas_tree.png"
|
||||||
|
nodedef.on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
itemstack = default.sapling_on_place(
|
||||||
|
itemstack,
|
||||||
|
placer,
|
||||||
|
pointed_thing,
|
||||||
|
"snow:xmas_tree",
|
||||||
|
{x= -2, y = 1, z = -2},
|
||||||
|
{x = 2, y = 14, z = 2},
|
||||||
|
4)
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("snow:xmas_tree", nodedef)
|
minetest.register_node("snow:xmas_tree", nodedef)
|
||||||
|
|
||||||
|
-- Star
|
||||||
nodedef = {
|
nodedef = {
|
||||||
description = "Star",
|
description = "Star",
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
@ -131,13 +195,9 @@ nodedef = {
|
|||||||
walkable = false,
|
walkable = false,
|
||||||
-- Don't want the ornament breaking too easily because you have to punch it to turn it on and off. ~ LazyJ
|
-- 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},
|
groups = {cracky=1, crumbly=1, choppy=1, oddly_breakable_by_hand=1},
|
||||||
-- Breaking "glass" sound makes it sound like a real, broken, Xmas tree
|
-- Breaking "glass" sound makes it sound like a real, broken, Xmas tree ornament (Sorry, Mom!). ;)- ~ LazyJ
|
||||||
-- ornament (Sorry, Mom!). ;)- ~ LazyJ
|
sounds = default.node_sound_glass_defaults({dig = {name="default_glass_footstep", gain=0.2}}),
|
||||||
sounds = default.node_sound_glass_defaults(
|
on_punch = function(pos, node) -- Added a "lit" star that can be punched on or off depending on your preference. ~ LazyJ
|
||||||
{dig = {name="default_glass_footstep", gain=0.2}}),
|
|
||||||
-- Added a "lit" star that can be punched on or off depending on your
|
|
||||||
-- preference. ~ LazyJ
|
|
||||||
on_punch = function(pos, node)
|
|
||||||
node.name = "snow:star_lit"
|
node.name = "snow:star_lit"
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
end,
|
end,
|
||||||
@ -148,7 +208,7 @@ minetest.register_node("snow:star", table.copy(nodedef))
|
|||||||
|
|
||||||
-- Star (Lit Version) on Xmas Trees
|
-- Star (Lit Version) on Xmas Trees
|
||||||
nodedef.description = nodedef.description.." Lighted"
|
nodedef.description = nodedef.description.." Lighted"
|
||||||
nodedef.light_source = minetest.LIGHT_MAX
|
nodedef.light_source = LIGHT_MAX
|
||||||
nodedef.tiles = {"snow_star_lit.png"}
|
nodedef.tiles = {"snow_star_lit.png"}
|
||||||
nodedef.drop = "snow:star"
|
nodedef.drop = "snow:star"
|
||||||
nodedef.groups.not_in_creative_inventory = 1
|
nodedef.groups.not_in_creative_inventory = 1
|
||||||
@ -236,7 +296,7 @@ if rawget(_G, "flowers") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Leaves
|
-- Leaves
|
||||||
local leaves = minetest.registered_nodes["default:leaves"]
|
--[[local leaves = minetest.registered_nodes["default:leaves"]
|
||||||
nodedef = {
|
nodedef = {
|
||||||
description = "Snow Leaves",
|
description = "Snow Leaves",
|
||||||
tiles = {"snow_leaves.png"},
|
tiles = {"snow_leaves.png"},
|
||||||
@ -277,10 +337,10 @@ if not snow.disable_mapgen then
|
|||||||
default.register_leafdecay{
|
default.register_leafdecay{
|
||||||
trunks = {"default:tree"},
|
trunks = {"default:tree"},
|
||||||
leaves = {"snow:apple", "snow:leaves"},
|
leaves = {"snow:apple", "snow:leaves"},
|
||||||
radius = minetest.get_mapgen_setting"mg_name" == "v6" and 2 or 3,
|
radius = minetest.get_mapgen_setting("mg_name") == "v6" and 2 or 3,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
]]--
|
||||||
-- TODO
|
-- TODO
|
||||||
snow.known_plants[minetest.get_content_id("default:jungleleaves")] = minetest.get_content_id("default:jungleleaves")
|
snow.known_plants[minetest.get_content_id("default:jungleleaves")] = minetest.get_content_id("default:jungleleaves")
|
||||||
|
|
||||||
@ -291,7 +351,8 @@ local function snow_onto_dirt(pos)
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if node.name == "default:dirt_with_grass"
|
if node.name == "default:dirt_with_grass"
|
||||||
or node.name == "default:dirt" then
|
or node.name == "default:dirt" then
|
||||||
minetest.set_node(pos, {name = "default:dirt_with_snow"})
|
node.name = "default:dirt_with_snow"
|
||||||
|
minetest.set_node(pos, node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -311,10 +372,14 @@ nodedef = {
|
|||||||
-- by player position. ~ LazyJ
|
-- by player position. ~ LazyJ
|
||||||
-- I made this a little harder to dig than snow blocks because
|
-- I made this a little harder to dig than snow blocks because
|
||||||
-- I imagine snow brick as being much more dense and solid than fluffy snow. ~ LazyJ
|
-- 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,
|
groups = {cracky=2, crumbly=2, choppy=2, oddly_breakable_by_hand=2, melts=1, icemaker=1, cooks_into_ice=1},
|
||||||
icemaker=1, cooks_into_ice=1, cools_lava = 1, snowy = 1},
|
|
||||||
--Let's use the new snow sounds instead of the old grass sounds. ~ LazyJ
|
--Let's use the new snow sounds instead of the old grass sounds. ~ LazyJ
|
||||||
sounds = default.node_sound_snow_defaults(),
|
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}
|
||||||
|
}),
|
||||||
-- The "on_construct" part below, thinking in terms of layers,
|
-- The "on_construct" part below, thinking in terms of layers,
|
||||||
-- dirt_with_snow could also double as dirt_with_frost which adds subtlety
|
-- dirt_with_snow could also double as dirt_with_frost which adds subtlety
|
||||||
-- to the winterscape. ~ LazyJ
|
-- to the winterscape. ~ LazyJ
|
||||||
@ -324,14 +389,17 @@ nodedef = {
|
|||||||
-- Snow Brick
|
-- Snow Brick
|
||||||
minetest.register_node("snow:snow_brick", table.copy(nodedef))
|
minetest.register_node("snow:snow_brick", table.copy(nodedef))
|
||||||
|
|
||||||
|
|
||||||
-- hard Ice Brick, original texture from LazyJ
|
-- hard Ice Brick, original texture from LazyJ
|
||||||
local ibdef = table.copy(nodedef)
|
local ibdef = table.copy(nodedef)
|
||||||
ibdef.description = "Ice Brick"
|
ibdef.description = "Ice Brick"
|
||||||
ibdef.tiles = {"snow_ice_brick.png"}
|
ibdef.tiles = {"snow_ice_brick.png"}
|
||||||
ibdef.use_texture_alpha = "blend"
|
ibdef.use_texture_alpha = true
|
||||||
ibdef.drawtype = "glasslike"
|
ibdef.drawtype = "glasslike"
|
||||||
ibdef.groups = {cracky=1, crumbly=1, choppy=1, melts=1, cools_lava = 1, slippery = 3}
|
ibdef.groups = {cracky=1, crumbly=1, choppy=1, melts=1}
|
||||||
ibdef.sounds = default.node_sound_ice_defaults()
|
ibdef.sounds = default.node_sound_glass_defaults({
|
||||||
|
dug = {name="default_hard_footstep", gain=1}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("snow:ice_brick", ibdef)
|
minetest.register_node("snow:ice_brick", ibdef)
|
||||||
|
|
||||||
@ -343,38 +411,43 @@ nodedef.tiles = {"snow_snow_cobble.png"}
|
|||||||
|
|
||||||
minetest.register_node("snow:snow_cobble", nodedef)
|
minetest.register_node("snow:snow_cobble", nodedef)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Override Default Nodes to Add Extra Functions
|
-- Override Default Nodes to Add Extra Functions
|
||||||
|
|
||||||
local groups = minetest.registered_nodes["default:ice"].groups
|
|
||||||
groups["melt"] = 1
|
|
||||||
minetest.override_item("default:ice", {
|
minetest.override_item("default:ice", {
|
||||||
|
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
|
||||||
drawtype = "glasslike",
|
drawtype = "glasslike",
|
||||||
use_texture_alpha = "blend",
|
tiles = {"default_ice.png^[brighten"},
|
||||||
param2 = 0, --param2 is reserved for how much ice will freezeover.
|
|
||||||
sunlight_propagates = true, -- necessary for dirt_with_grass/snow/just dirt ABMs
|
|
||||||
tiles = {"snow_ice.png^[brighten"},
|
|
||||||
liquidtype = "none",
|
liquidtype = "none",
|
||||||
groups = groups,
|
-- 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 = snow_onto_dirt,
|
on_construct = snow_onto_dirt,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
--Make ice freeze over when placed by a maximum of 10 blocks.
|
--Make ice freeze over when placed by a maximum of 10 blocks.
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
minetest.set_node(pos, {name="default:ice", param2=math.random(0,10)})
|
minetest.set_node(pos, {name="default:ice", param2=math.random(0,10)})
|
||||||
end,
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
groups = minetest.registered_nodes["default:snowblock"].groups
|
|
||||||
for g,v in pairs({melts=1, icemaker=1, cooks_into_ice=1, falling_node=1}) do
|
|
||||||
groups[g] = v
|
|
||||||
end
|
|
||||||
minetest.override_item("default:snowblock", {
|
minetest.override_item("default:snowblock", {
|
||||||
|
-- LazyJ to make dirt below change to dirt_with_snow (see default, nodes.lua, dirt ABM)
|
||||||
liquidtype = "none",
|
liquidtype = "none",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
on_construct = snow_onto_dirt,
|
-- Snow blocks should be easy to dig because they are just fluffy snow. ~ LazyJ
|
||||||
groups = groups,
|
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 = 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
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.override_item("default:snow", {
|
minetest.override_item("default:snow", {
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 2,
|
max_items = 2,
|
||||||
|
14
src/sled.lua
14
src/sled.lua
@ -53,6 +53,8 @@ than I originally planned. :p ~ LazyJ
|
|||||||
-- Helper functions
|
-- Helper functions
|
||||||
--
|
--
|
||||||
|
|
||||||
|
vector.zero = vector.zero or {x=0, y=0, z=0}
|
||||||
|
|
||||||
local function table_find(t, v)
|
local function table_find(t, v)
|
||||||
for i = 1,#t do
|
for i = 1,#t do
|
||||||
if t[i] == v then
|
if t[i] == v then
|
||||||
@ -81,7 +83,7 @@ local sled = {
|
|||||||
|
|
||||||
local players_sled = {}
|
local players_sled = {}
|
||||||
local function join_sled(self, player)
|
local function join_sled(self, player)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:getpos()
|
||||||
player:setpos(pos)
|
player:setpos(pos)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
players_sled[name] = true
|
players_sled[name] = true
|
||||||
@ -89,7 +91,7 @@ local function join_sled(self, player)
|
|||||||
default.player_set_animation(player, "sit" , 30)
|
default.player_set_animation(player, "sit" , 30)
|
||||||
self.driver = name
|
self.driver = name
|
||||||
self.object:set_attach(player, "", {x=0,y=-9,z=0}, {x=0,y=90,z=0})
|
self.object:set_attach(player, "", {x=0,y=-9,z=0}, {x=0,y=90,z=0})
|
||||||
self.object:set_yaw(player:get_look_yaw())-- - math.pi/2)
|
self.object:setyaw(player:get_look_yaw())-- - math.pi/2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function leave_sled(self, player)
|
local function leave_sled(self, player)
|
||||||
@ -154,9 +156,9 @@ function sled:on_rightclick(player)
|
|||||||
on_sled_click(self, player)
|
on_sled_click(self, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
function sled:on_activate(staticdata)
|
function sled:on_activate(staticdata, dtime_s)
|
||||||
self.object:set_armor_groups({immortal=1})
|
self.object:set_armor_groups({immortal=1})
|
||||||
self.object:set_acceleration({x=0, y=-10, z=0})
|
self.object:setacceleration({x=0, y=-10, z=0})
|
||||||
if staticdata then
|
if staticdata then
|
||||||
self.v = tonumber(staticdata)
|
self.v = tonumber(staticdata)
|
||||||
end
|
end
|
||||||
@ -200,7 +202,7 @@ function sled:on_step(dtime)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if player:get_player_control().sneak
|
if player:get_player_control().sneak
|
||||||
or not accelerating_possible(vector.round(self.object:get_pos())) then
|
or not accelerating_possible(vector.round(self.object:getpos())) then
|
||||||
leave_sled(self, player)
|
leave_sled(self, player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -220,7 +222,7 @@ minetest.register_craftitem("snow:sled", {
|
|||||||
if players_sled[placer:get_player_name()] then
|
if players_sled[placer:get_player_name()] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local pos = placer:get_pos()
|
local pos = placer:getpos()
|
||||||
if accelerating_possible(vector.round(pos)) then
|
if accelerating_possible(vector.round(pos)) then
|
||||||
pos.y = pos.y+0.5
|
pos.y = pos.y+0.5
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
-- Quite a bit of trial-and-error learning here and it boiled down to a
|
-- Quite a bit of trial-and-error learning here and it boiled down to a
|
||||||
-- small handful of code lines making the difference. ~ LazyJ
|
-- small handful of code lines making the difference. ~ LazyJ
|
||||||
|
|
||||||
local creative_mode = minetest.settings:get_bool"creative_mode"
|
local creative_mode = minetest.settings:get_bool("creative_mode")
|
||||||
|
|
||||||
|
|
||||||
local snowball_velocity, entity_attack_delay
|
local snowball_velocity, entity_attack_delay
|
||||||
local function update_snowball_vel(v)
|
local function update_snowball_vel(v)
|
||||||
snowball_velocity = v
|
snowball_velocity = v
|
||||||
local walkspeed = tonumber(minetest.settings:get"movement_speed_walk") or 4
|
local walkspeed = tonumber(minetest.settings:get("movement_speed_walk")) or 4
|
||||||
entity_attack_delay = (walkspeed+1)/v
|
entity_attack_delay = (walkspeed+1)/v
|
||||||
end
|
end
|
||||||
update_snowball_vel(snow.snowball_velocity)
|
update_snowball_vel(snow.snowball_velocity)
|
||||||
@ -27,11 +27,11 @@ snow.register_on_configuring(function(name, v)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local function get_gravity()
|
local function get_gravity()
|
||||||
local grav = tonumber(minetest.settings:get"movement_gravity") or 9.81
|
local grav = tonumber(minetest.settings:get("movement_gravity")) or 9.81
|
||||||
return grav*snowball_gravity
|
return grav*snowball_gravity
|
||||||
end
|
end
|
||||||
|
|
||||||
local someone_throwing, just_acitvated
|
local someone_throwing, just_activated
|
||||||
|
|
||||||
--Shoot snowball
|
--Shoot snowball
|
||||||
function snow.shoot_snowball(item, player)
|
function snow.shoot_snowball(item, player)
|
||||||
@ -40,15 +40,15 @@ function snow.shoot_snowball(item, player)
|
|||||||
local dif = 2*math.sqrt(dir.z*dir.z+dir.x*dir.x)
|
local dif = 2*math.sqrt(dir.z*dir.z+dir.x*dir.x)
|
||||||
addp.x = dir.z/dif -- + (math.random()-0.5)/5
|
addp.x = dir.z/dif -- + (math.random()-0.5)/5
|
||||||
addp.z = -dir.x/dif -- + (math.random()-0.5)/5
|
addp.z = -dir.x/dif -- + (math.random()-0.5)/5
|
||||||
local pos = vector.add(player:get_pos(), addp)
|
local pos = vector.add(player:getpos(), addp)
|
||||||
local obj = minetest.add_entity(pos, "snow:snowball_entity")
|
local obj = minetest.add_entity(pos, "snow:snowball_entity")
|
||||||
obj:set_velocity(vector.multiply(dir, snowball_velocity))
|
obj:setvelocity(vector.multiply(dir, snowball_velocity))
|
||||||
obj:set_acceleration({x=dir.x*-3, y=-get_gravity(), z=dir.z*-3})
|
obj:setacceleration({x=dir.x*-3, y=-get_gravity(), z=dir.z*-3})
|
||||||
obj:get_luaentity().thrower = player:get_player_name()
|
obj:get_luaentity().thrower = player:get_player_name()
|
||||||
if creative_mode then
|
if creative_mode then
|
||||||
if not someone_throwing then
|
if not someone_throwing then
|
||||||
someone_throwing = true
|
someone_throwing = true
|
||||||
just_acitvated = true
|
just_activated = true
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -82,12 +82,12 @@ if creative_mode then
|
|||||||
local timer
|
local timer
|
||||||
-- only if one holds left click
|
-- only if one holds left click
|
||||||
if someone_throwing
|
if someone_throwing
|
||||||
and not just_acitvated then
|
and not just_activated then
|
||||||
update_step()
|
update_step()
|
||||||
timer = 0.006
|
timer = 0.006
|
||||||
else
|
else
|
||||||
timer = 0.5
|
timer = 0.5
|
||||||
just_acitvated = false
|
just_activated = false
|
||||||
end
|
end
|
||||||
minetest.after(timer, do_step)
|
minetest.after(timer, do_step)
|
||||||
end
|
end
|
||||||
@ -103,25 +103,25 @@ local snow_snowball_ENTITY = {
|
|||||||
|
|
||||||
function snow_snowball_ENTITY.on_activate(self)
|
function snow_snowball_ENTITY.on_activate(self)
|
||||||
self.object:set_properties({textures = {"default_snowball.png^[transform"..math.random(0,7)}})
|
self.object:set_properties({textures = {"default_snowball.png^[transform"..math.random(0,7)}})
|
||||||
self.object:set_acceleration({x=0, y=-get_gravity(), z=0})
|
self.object:setacceleration({x=0, y=-get_gravity(), z=0})
|
||||||
self.lastpos = self.object:get_pos()
|
self.lastpos = self.object:getpos()
|
||||||
minetest.after(0.1, function(obj)
|
minetest.after(0.1, function(obj)
|
||||||
if not obj then
|
if not obj then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local vel = obj:get_velocity()
|
local vel = obj:getvelocity()
|
||||||
if vel
|
if vel
|
||||||
and vel.y ~= 0 then
|
and vel.y ~= 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.after(0, function(object)
|
minetest.after(0, function(obj)
|
||||||
if not object then
|
if not obj then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local vel_obj = object:get_velocity()
|
local vel = obj:getvelocity()
|
||||||
if not vel_obj
|
if not vel
|
||||||
or vel_obj.y == 0 then
|
or vel.y == 0 then
|
||||||
object:remove()
|
obj:remove()
|
||||||
end
|
end
|
||||||
end, obj)
|
end, obj)
|
||||||
end, self.object)
|
end, self.object)
|
||||||
@ -137,7 +137,7 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.physical then
|
if self.physical then
|
||||||
local vel = self.object:get_velocity()
|
local vel = self.object:getvelocity()
|
||||||
local fell = vel.y == 0
|
local fell = vel.y == 0
|
||||||
if not fell then
|
if not fell then
|
||||||
if self.probably_stuck then
|
if self.probably_stuck then
|
||||||
@ -155,7 +155,7 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
|||||||
self.probably_stuck = nil
|
self.probably_stuck = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local pos = vector.round(self.object:get_pos())
|
local pos = vector.round(self.object:getpos())
|
||||||
if minetest.get_node(pos).name == "air" then
|
if minetest.get_node(pos).name == "air" then
|
||||||
pos.y = pos.y-1
|
pos.y = pos.y-1
|
||||||
if minetest.get_node(pos).name == "air" then
|
if minetest.get_node(pos).name == "air" then
|
||||||
@ -171,16 +171,16 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = vector.round(self.object:get_pos())
|
local pos = vector.round(self.object:getpos())
|
||||||
if vector.equals(pos, self.lastpos) then
|
if vector.equals(pos, self.lastpos) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if minetest.get_node(pos).name ~= "air" then
|
if minetest.get_node(pos).name ~= "air" then
|
||||||
self.object:set_acceleration({x=0, y=-get_gravity(), z=0})
|
self.object:setacceleration({x=0, y=-get_gravity(), z=0})
|
||||||
--self.object:set_velocity({x=0, y=0, z=0})
|
--self.object:setvelocity({x=0, y=0, z=0})
|
||||||
pos = self.lastpos
|
pos = self.lastpos
|
||||||
self.object:setpos(pos)
|
self.object:setpos(pos)
|
||||||
minetest.sound_play("default_snow_footstep", {pos=pos, gain=vector.length(self.object:get_velocity())/30})
|
minetest.sound_play("default_snow_footstep", {pos=pos, gain=vector.length(self.object:getvelocity())/30})
|
||||||
self.object:set_properties({physical = true})
|
self.object:set_properties({physical = true})
|
||||||
self.physical = true
|
self.physical = true
|
||||||
return
|
return
|
||||||
@ -199,8 +199,8 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
|||||||
or (entity_name ~= "snow:snowball_entity"
|
or (entity_name ~= "snow:snowball_entity"
|
||||||
and entity_name ~= "__builtin:item"
|
and entity_name ~= "__builtin:item"
|
||||||
and entity_name ~= "gauges:hp_bar") then
|
and entity_name ~= "gauges:hp_bar") then
|
||||||
local vvel = v:get_velocity() or v:get_player_velocity()
|
local vvel = v:getvelocity() or v:get_player_velocity()
|
||||||
local veldif = self.object:get_velocity()
|
local veldif = self.object:getvelocity()
|
||||||
if vvel then
|
if vvel then
|
||||||
veldif = vector.subtract(veldif, vvel)
|
veldif = vector.subtract(veldif, vvel)
|
||||||
end
|
end
|
||||||
@ -214,7 +214,7 @@ function snow_snowball_ENTITY.on_step(self, dtime)
|
|||||||
minetest.sound_play("default_snow_footstep", {pos=pos, gain=gain})
|
minetest.sound_play("default_snow_footstep", {pos=pos, gain=gain})
|
||||||
|
|
||||||
-- spawn_falling_node
|
-- spawn_falling_node
|
||||||
local obj = minetest.add_entity(pos, "__builtin:falling_node")
|
local obj = core.add_entity(pos, "__builtin:falling_node")
|
||||||
if obj then
|
if obj then
|
||||||
obj:get_luaentity():set_node{name = "default:snow"}
|
obj:get_luaentity():set_node{name = "default:snow"}
|
||||||
else
|
else
|
||||||
@ -265,16 +265,11 @@ minetest.register_node(":default:snow", {
|
|||||||
dug = {name="default_snow_footstep", gain=0.75},
|
dug = {name="default_snow_footstep", gain=0.75},
|
||||||
}),
|
}),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:dirt_with_grass" or minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:dirt" then
|
||||||
== "default:dirt_with_grass"
|
|
||||||
or minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:dirt" then
|
|
||||||
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="default:dirt_with_snow"})
|
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="default:dirt_with_snow"})
|
||||||
end
|
end
|
||||||
-- Now, let's turn the snow pile into a snowblock. ~ LazyJ
|
-- Now, let's turn the snow pile into a snowblock. ~ LazyJ
|
||||||
if minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name == "default:snow"
|
if minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z}).name == "default:snow" and -- Minus 2 because at the end of this, the layer that triggers the change to a snowblock is the second layer more than a full block, starting into a second block (-2) ~ LazyJ, 2014_04_11
|
||||||
and -- Minus 2 because at the end of this, the layer that triggers
|
|
||||||
--the change to a snowblock is the second layer more than a full block,
|
|
||||||
--starting into a second block (-2) ~ LazyJ, 2014_04_11
|
|
||||||
minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "default:snow" then
|
minetest.get_node({x=pos.x, y=pos.y, z=pos.z}).name == "default:snow" then
|
||||||
minetest.set_node({x=pos.x, y=pos.y-2, z=pos.z}, {name="default:snowblock"})
|
minetest.set_node({x=pos.x, y=pos.y-2, z=pos.z}, {name="default:snowblock"})
|
||||||
end
|
end
|
||||||
|
@ -32,8 +32,8 @@ if minetest.get_modpath("moreblocks") and
|
|||||||
ice_brick = false,
|
ice_brick = false,
|
||||||
snow_brick = true,
|
snow_brick = true,
|
||||||
snow_cobble = true,
|
snow_cobble = true,
|
||||||
ice = true,
|
ice = false,
|
||||||
snowblock = true,
|
snowblock = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
for mod, nodes in pairs(snow_nodes) do
|
for mod, nodes in pairs(snow_nodes) do
|
||||||
@ -45,11 +45,7 @@ if minetest.get_modpath("moreblocks") and
|
|||||||
ndef.groups.icemaker = nil
|
ndef.groups.icemaker = nil
|
||||||
ndef.groups.cooks_into_ice = nil
|
ndef.groups.cooks_into_ice = nil
|
||||||
ndef.after_place_node = nil
|
ndef.after_place_node = nil
|
||||||
if string.find(name, "ice") then
|
|
||||||
ndef.use_texture_alpha = "blend"
|
|
||||||
else
|
|
||||||
ndef.use_texture_alpha = "opaque"
|
|
||||||
end
|
|
||||||
stairsplus:register_all(mod, name, nodename, ndef)
|
stairsplus:register_all(mod, name, nodename, ndef)
|
||||||
|
|
||||||
if was_in_stairs[name] then
|
if was_in_stairs[name] then
|
||||||
|
@ -3,7 +3,7 @@ snow = {
|
|||||||
snowball_gravity = tonumber(minetest.settings:get("snow_snowball_gravity")) or 0.91,
|
snowball_gravity = tonumber(minetest.settings:get("snow_snowball_gravity")) or 0.91,
|
||||||
snowball_velocity = tonumber(minetest.settings:get("snow_snowball_velocity")) or 19,
|
snowball_velocity = tonumber(minetest.settings:get("snow_snowball_velocity")) or 19,
|
||||||
sleds = minetest.settings:get_bool("snow_sleds", true),
|
sleds = minetest.settings:get_bool("snow_sleds", true),
|
||||||
enable_snowfall = minetest.settings:get_bool("snow_enable_snowfall", true),
|
enable_snowfall = minetest.settings:get_bool("snow_enable_snowfall", false),
|
||||||
lighter_snowfall = minetest.settings:get_bool("snow_lighter_snowfall", false),
|
lighter_snowfall = minetest.settings:get_bool("snow_lighter_snowfall", false),
|
||||||
debug = minetest.settings:get_bool("snow_debug", false),
|
debug = minetest.settings:get_bool("snow_debug", false),
|
||||||
smooth_biomes = minetest.settings:get_bool("snow_smooth_biomes", true),
|
smooth_biomes = minetest.settings:get_bool("snow_smooth_biomes", true),
|
||||||
@ -12,14 +12,12 @@ snow = {
|
|||||||
min_height = tonumber(minetest.settings:get("snow_min_height")) or 3,
|
min_height = tonumber(minetest.settings:get("snow_min_height")) or 3,
|
||||||
mapgen_rarity = tonumber(minetest.settings:get("snow_mapgen_rarity")) or 18,
|
mapgen_rarity = tonumber(minetest.settings:get("snow_mapgen_rarity")) or 18,
|
||||||
mapgen_size = tonumber(minetest.settings:get("snow_mapgen_size")) or 210,
|
mapgen_size = tonumber(minetest.settings:get("snow_mapgen_size")) or 210,
|
||||||
disable_mapgen = minetest.settings:get_bool("snow_disable_mapgen", true),
|
disable_mapgen = minetest.settings:get_bool("snow_disable_mapgen", false),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- functions for dynamically changing settings
|
-- functions for dynamically changing settings
|
||||||
|
|
||||||
snow.register_on_configuring = function() end
|
|
||||||
--[[
|
|
||||||
local on_configurings,n = {},1
|
local on_configurings,n = {},1
|
||||||
function snow.register_on_configuring(func)
|
function snow.register_on_configuring(func)
|
||||||
on_configurings[n] = func
|
on_configurings[n] = func
|
||||||
@ -52,4 +50,3 @@ local function value_from_string(v)
|
|||||||
end
|
end
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
|
Before Width: | Height: | Size: 643 B After Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 606 B |
Reference in New Issue
Block a user