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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
|
||||
|
||||
minetest.register_abm({
|
||||
--[[minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_snow"},
|
||||
interval = 2,
|
||||
chance = 20,
|
||||
|
@ -17,7 +17,7 @@ minetest.register_abm({
|
|||
end
|
||||
end
|
||||
})
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
--Melting
|
||||
|
@ -76,6 +76,7 @@ minetest.register_abm({
|
|||
|
||||
--Freezing
|
||||
--Water freezes when in contact with snow.
|
||||
--[[
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:water_source"},
|
||||
-- Added "group:icemaker" and snowbrick. ~ LazyJ
|
||||
|
@ -120,7 +121,7 @@ minetest.register_abm({
|
|||
end
|
||||
end,
|
||||
})
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
--Spread moss to cobble.
|
||||
|
@ -138,7 +139,7 @@ minetest.register_abm({
|
|||
|
||||
|
||||
|
||||
|
||||
--[[
|
||||
--Grow Pine Saplings
|
||||
minetest.register_abm({
|
||||
nodenames = {"snow:sapling_pine"},
|
||||
|
@ -171,7 +172,6 @@ minetest.register_abm({
|
|||
|
||||
|
||||
|
||||
|
||||
--Grow Christmas Tree Saplings
|
||||
minetest.register_abm({
|
||||
nodenames = {"snow:xmas_tree"},
|
||||
|
@ -196,10 +196,11 @@ minetest.register_abm({
|
|||
end
|
||||
})
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
--Backwards Compatability.
|
||||
--[[
|
||||
minetest.register_abm({
|
||||
nodenames = {"snow:snow1","snow:snow2","snow:snow3","gsnow4","snow:snow5","snow:snow6","snow:snow7","snow:snow8"},
|
||||
interval = 1,
|
||||
|
@ -209,3 +210,4 @@ minetest.register_abm({
|
|||
minetest.set_node_level(pos, 7*(tonumber(node.name:sub(-1))))
|
||||
end,
|
||||
})
|
||||
]]--
|
||||
|
|
|
@ -57,7 +57,7 @@ of snowblocks (and then use them to water-grief by melting the snow blocks).
|
|||
|
||||
~ LazyJ
|
||||
|
||||
]]
|
||||
]]--
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
|
@ -77,7 +77,7 @@ minetest.register_craft({
|
|||
"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.
|
||||
|
||||
local perlin_scale, nosmooth_rarity
|
||||
--[[local perlin_scale, nosmooth_rarity
|
||||
if not snow.disable_mapgen then
|
||||
print("[snow] Mapgen enabled!")
|
||||
|
||||
|
@ -68,10 +68,10 @@ if not snow.disable_mapgen then
|
|||
if mgname == "v6" then
|
||||
--Load mapgen_v6 compatibility.
|
||||
dofile(path.."/src/mapgen_v6.lua")
|
||||
else
|
||||
else]]--
|
||||
--Load mapgen_v7 compatibility.
|
||||
dofile(path.."/src/mapgen_v7.lua")
|
||||
end
|
||||
dofile(minetest.get_modpath("snow").."/src/mapgen_v7.lua")
|
||||
--[[ end
|
||||
end
|
||||
|
||||
-- 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
|
||||
end
|
||||
end
|
||||
|
||||
]]--
|
||||
-- treecapitator support
|
||||
if minetest.global_exists("treecapitator") then
|
||||
treecapitator.register_tree{
|
||||
|
|
|
@ -70,7 +70,7 @@ minetest.register_biome({
|
|||
humidity_point = 40.0,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
--[[minetest.register_biome({
|
||||
name = "snow_biome_sand",
|
||||
|
||||
node_top = "default:sand",
|
||||
|
@ -83,7 +83,7 @@ minetest.register_biome({
|
|||
heat_point = 10.0,
|
||||
humidity_point = 40.0,
|
||||
})
|
||||
|
||||
]]--
|
||||
|
||||
--Pine tree.
|
||||
minetest.register_decoration({
|
||||
|
@ -101,7 +101,7 @@ minetest.register_decoration({
|
|||
y_max = 31000,
|
||||
y_min = 4,
|
||||
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",
|
||||
})
|
||||
|
||||
|
@ -121,7 +121,7 @@ minetest.register_decoration({
|
|||
y_max = 31000,
|
||||
y_min = 4,
|
||||
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",
|
||||
})
|
||||
|
||||
|
@ -133,7 +133,7 @@ minetest.register_decoration({
|
|||
y_max = 31000,
|
||||
y_min = 4,
|
||||
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",
|
||||
})
|
||||
|
||||
|
|
159
src/nodes.lua
159
src/nodes.lua
|
@ -1,29 +1,81 @@
|
|||
-- 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
|
||||
local nodedef = {
|
||||
description = "Snow Pine Needles",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"snow_needles.png"},
|
||||
waving = 1,
|
||||
paramtype = "light",
|
||||
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
-- player will get sapling with 1/20 chance
|
||||
items = {'snow:sapling_pine'},
|
||||
rarity = 20,
|
||||
},
|
||||
{
|
||||
items = {'snow:needles'},
|
||||
}
|
||||
local nodedef = table.copy(minetest.registered_nodes["default:pine_needles"])
|
||||
nodedef.description = "Snow Pine Needles"
|
||||
nodedef.tiles = {"snow_needles.png"}
|
||||
nodedef.visual_scale = 1.3
|
||||
nodedef.drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
-- player will get sapling with 1/20 chance
|
||||
items = {'snow:sapling_pine'},
|
||||
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))
|
||||
|
||||
default.register_leafdecay{
|
||||
trunks = {"default:pine_tree"},
|
||||
leaves = {"snow:needles", "default:pine_needles"},
|
||||
radius = 2,
|
||||
}
|
||||
|
||||
snow.register_on_configuring(function(name, v)
|
||||
if name == "christmas_content" then
|
||||
local drop = minetest.registered_nodes["snow:needles"].drop
|
||||
|
@ -86,25 +132,35 @@ else
|
|||
end
|
||||
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
|
||||
|
||||
nodedef = {
|
||||
description = "Snow Pine Sapling",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles = {"snow_sapling_pine.png"},
|
||||
inventory_image = "snow_sapling_pine.png",
|
||||
wield_image = "snow_sapling_pine.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = {snappy=2,dig_immediate=3, flammable = 3,
|
||||
attached_node = 1, sapling = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
}
|
||||
nodedef = table.copy(minetest.registered_nodes["default:pine_sapling"])
|
||||
nodedef.description = "Snow Pine Sapling"
|
||||
nodedef.tiles = {"snow_sapling_pine.png"}
|
||||
nodedef.inventory_image = "snow_sapling_pine.png"
|
||||
nodedef.wield_image = "snow_sapling_pine.png"
|
||||
nodedef.on_timer = grow_sapling
|
||||
nodedef.on_place = function(itemstack, placer, pointed_thing)
|
||||
itemstack = default.sapling_on_place(
|
||||
itemstack,
|
||||
placer,
|
||||
pointed_thing,
|
||||
"snow:sapling_pine",
|
||||
{x = -2, y = 1, z = -2},
|
||||
{x = 2, y = 13, z = 2},
|
||||
4)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Pine Sapling
|
||||
minetest.register_node("snow:sapling_pine", table.copy(nodedef))
|
||||
|
@ -114,10 +170,21 @@ nodedef.description = "Christmas Tree"
|
|||
nodedef.tiles = {"snow_xmas_tree.png"}
|
||||
nodedef.inventory_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)
|
||||
|
||||
|
||||
-- Star
|
||||
nodedef = {
|
||||
description = "Star",
|
||||
drawtype = "plantlike",
|
||||
|
@ -229,7 +296,7 @@ if rawget(_G, "flowers") then
|
|||
end
|
||||
|
||||
-- Leaves
|
||||
local leaves = minetest.registered_nodes["default:leaves"]
|
||||
--[[local leaves = minetest.registered_nodes["default:leaves"]
|
||||
nodedef = {
|
||||
description = "Snow Leaves",
|
||||
tiles = {"snow_leaves.png"},
|
||||
|
@ -265,7 +332,7 @@ nodedef.groups.flammable = 1
|
|||
minetest.register_node("snow:apple", nodedef)
|
||||
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
|
||||
default.register_leafdecay{
|
||||
trunks = {"default:tree"},
|
||||
|
|
|
@ -31,7 +31,7 @@ local function get_gravity()
|
|||
return grav*snowball_gravity
|
||||
end
|
||||
|
||||
local someone_throwing, just_acitvated
|
||||
local someone_throwing, just_activated
|
||||
|
||||
--Shoot snowball
|
||||
function snow.shoot_snowball(item, player)
|
||||
|
@ -48,7 +48,7 @@ function snow.shoot_snowball(item, player)
|
|||
if creative_mode then
|
||||
if not someone_throwing then
|
||||
someone_throwing = true
|
||||
just_acitvated = true
|
||||
just_activated = true
|
||||
end
|
||||
return
|
||||
end
|
||||
|
@ -82,12 +82,12 @@ if creative_mode then
|
|||
local timer
|
||||
-- only if one holds left click
|
||||
if someone_throwing
|
||||
and not just_acitvated then
|
||||
and not just_activated then
|
||||
update_step()
|
||||
timer = 0.006
|
||||
else
|
||||
timer = 0.5
|
||||
just_acitvated = false
|
||||
just_activated = false
|
||||
end
|
||||
minetest.after(timer, do_step)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue