forked from mtcontrib/minetest-mod-snow
Plusieurs modifications
- Suppression du biome snow_sand - Suppression de plusieurs ABMS pour gagner en performance - Suppression de code obsolète - Suppression de la mapgen V6 - Génération des sapins à base de schematics
This commit is contained in:
parent
794fb251ba
commit
854e10f087
Binary file not shown.
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.
14
src/abms.lua
14
src/abms.lua
@ -1,6 +1,6 @@
|
|||||||
-- 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
|
-- 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
|
||||||
|
|
||||||
minetest.register_abm({
|
--[[minetest.register_abm({
|
||||||
nodenames = {"default:dirt_with_snow"},
|
nodenames = {"default:dirt_with_snow"},
|
||||||
interval = 2,
|
interval = 2,
|
||||||
chance = 20,
|
chance = 20,
|
||||||
@ -17,7 +17,7 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
]]--
|
||||||
|
|
||||||
|
|
||||||
--Melting
|
--Melting
|
||||||
@ -76,6 +76,7 @@ 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
|
||||||
@ -120,7 +121,7 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
]]--
|
||||||
|
|
||||||
|
|
||||||
--Spread moss to cobble.
|
--Spread moss to cobble.
|
||||||
@ -138,7 +139,7 @@ minetest.register_abm({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
--Grow Pine Saplings
|
--Grow Pine Saplings
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"snow:sapling_pine"},
|
nodenames = {"snow:sapling_pine"},
|
||||||
@ -171,7 +172,6 @@ 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"},
|
||||||
@ -196,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,
|
||||||
@ -209,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,
|
||||||
})
|
})
|
||||||
|
]]--
|
||||||
|
@ -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"
|
||||||
}
|
}
|
||||||
})]]
|
})]]--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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!")
|
||||||
|
|
||||||
@ -68,10 +68,10 @@ if not snow.disable_mapgen then
|
|||||||
if mgname == "v6" then
|
if mgname == "v6" then
|
||||||
--Load mapgen_v6 compatibility.
|
--Load mapgen_v6 compatibility.
|
||||||
dofile(path.."/src/mapgen_v6.lua")
|
dofile(path.."/src/mapgen_v6.lua")
|
||||||
else
|
else]]--
|
||||||
--Load mapgen_v7 compatibility.
|
--Load mapgen_v7 compatibility.
|
||||||
dofile(path.."/src/mapgen_v7.lua")
|
dofile(minetest.get_modpath("snow").."/src/mapgen_v7.lua")
|
||||||
end
|
--[[ 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.
|
||||||
@ -200,7 +200,7 @@ function snow.voxelmanip_pine(pos,a,data)
|
|||||||
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{
|
||||||
|
@ -70,7 +70,7 @@ minetest.register_biome({
|
|||||||
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",
|
||||||
@ -83,7 +83,7 @@ minetest.register_biome({
|
|||||||
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({
|
||||||
@ -101,7 +101,7 @@ minetest.register_decoration({
|
|||||||
y_max = 31000,
|
y_max = 31000,
|
||||||
y_min = 4,
|
y_min = 4,
|
||||||
biomes = {"snowy_grassland", "coniferous_forest", "taiga", "snow_biome_alpine"},
|
biomes = {"snowy_grassland", "coniferous_forest", "taiga", "snow_biome_alpine"},
|
||||||
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",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ minetest.register_decoration({
|
|||||||
y_max = 31000,
|
y_max = 31000,
|
||||||
y_min = 4,
|
y_min = 4,
|
||||||
biomes = {"snow_biome_forest", "pine_forest"},
|
biomes = {"snow_biome_forest", "pine_forest"},
|
||||||
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",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ minetest.register_decoration({
|
|||||||
y_max = 31000,
|
y_max = 31000,
|
||||||
y_min = 4,
|
y_min = 4,
|
||||||
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",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
159
src/nodes.lua
159
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 = "Snow 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, leafdecay = 3, flammable = 2, leaves = 1},
|
{
|
||||||
drop = {
|
-- player will get sapling with 1/20 chance
|
||||||
max_items = 1,
|
items = {'snow:sapling_pine'},
|
||||||
items = {
|
rarity = 20,
|
||||||
{
|
},
|
||||||
-- player will get sapling with 1/20 chance
|
{
|
||||||
items = {'snow:sapling_pine'},
|
items = {'snow:needles'},
|
||||||
rarity = 20,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
items = {'snow:needles'},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
after_place_node = default.after_place_leaves,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
@ -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", "default:pine_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
|
||||||
@ -86,25 +132,35 @@ else
|
|||||||
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 = "Snow 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(
|
||||||
sunlight_propagates = true,
|
itemstack,
|
||||||
walkable = false,
|
placer,
|
||||||
groups = {snappy=2,dig_immediate=3, flammable = 3,
|
pointed_thing,
|
||||||
attached_node = 1, sapling = 1},
|
"snow:sapling_pine",
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
{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))
|
||||||
@ -114,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",
|
||||||
@ -229,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"},
|
||||||
@ -265,7 +332,7 @@ nodedef.groups.flammable = 1
|
|||||||
minetest.register_node("snow:apple", nodedef)
|
minetest.register_node("snow:apple", nodedef)
|
||||||
snow.known_plants[minetest.get_content_id("default:apple")] = minetest.get_content_id("snow:apple")
|
snow.known_plants[minetest.get_content_id("default:apple")] = minetest.get_content_id("snow:apple")
|
||||||
|
|
||||||
--[[if not snow.disable_mapgen then
|
if not snow.disable_mapgen then
|
||||||
-- decay from default/nodes.lua:2537
|
-- decay from default/nodes.lua:2537
|
||||||
default.register_leafdecay{
|
default.register_leafdecay{
|
||||||
trunks = {"default:tree"},
|
trunks = {"default:tree"},
|
||||||
|
@ -31,7 +31,7 @@ local function get_gravity()
|
|||||||
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)
|
||||||
@ -48,7 +48,7 @@ function snow.shoot_snowball(item, player)
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user