1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

Updated moretrees and plantlife

- Solves #220
 - Related to #222 ?
This commit is contained in:
LeMagnesium 2015-08-19 12:01:15 +02:00
parent 0818c7996f
commit 57aad89094
7 changed files with 28 additions and 139 deletions

View File

@ -14,13 +14,13 @@ moretrees.enable_birch = true
moretrees.enable_spruce = true moretrees.enable_spruce = true
moretrees.enable_jungle_tree = true moretrees.enable_jungle_tree = true
moretrees.enable_fir = true moretrees.enable_fir = true
moretrees.enable_beech = true moretrees.enable_beech = false
-- set this to true to make moretrees spawn saplings at mapgen time instead -- set this to true to make moretrees spawn saplings at mapgen time instead
-- of fully-grown trees, which will grow into full trees very quickly. With -- of fully-grown trees, which will grow into full trees after a very short
-- older versions of biome_lib, doing this will reduce mapgen lag. -- delay. This reduces mapgen lag in some situations.
moretrees.spawn_saplings = true moretrees.spawn_saplings = false
-- Set this to true to allow defining stairs/slabs/etc. If Moreblocks is -- Set this to true to allow defining stairs/slabs/etc. If Moreblocks is
-- installed, this will use that mod's Stairs Plus component. Otherwise, it -- installed, this will use that mod's Stairs Plus component. Otherwise, it
@ -34,26 +34,21 @@ moretrees.enable_stairs = true
moretrees.plantlike_leaves = false moretrees.plantlike_leaves = false
-- Set this to true to enable leaf decay of all trees except the default ones.
moretrees.enable_leafdecay = true
-- Enable this if you want moretrees to redefine default apples so that they -- Enable this if you want moretrees to redefine default apples so that they
-- fall when leaves decay/are dug. -- fall when leaves decay/are dug.
moretrees.enable_redefine_apple = true moretrees.enable_redefine_apple = true
-- various settings to configure default and default-jungle leaf decay. -- Set this to true to enable leaf decay of all trees except the default ones.
moretrees.enable_leafdecay = true
-- various related settings to configure leaf decay.
moretrees.leafdecay_delay = 2 moretrees.leafdecay_delay = 2
moretrees.leafdecay_chance = 100 moretrees.leafdecay_chance = 5
moretrees.leafdecay_radius = 5 moretrees.leafdecay_radius = 5
moretrees.palm_leafdecay_radius = 10
moretrees.palm_leafdecay_radius = 15
moretrees.default_leafdecay_delay = 3
moretrees.default_leafdecay_chance = 50
moretrees.default_leafdecay_radius = 4
-- Change these settings if you want default trees to be gradually cut down -- Change these settings if you want default trees to be gradually cut down
-- above the elevation where firs normally generate. -- above the elevation where firs normally generate.

View File

@ -24,21 +24,8 @@ local modpath=minetest.get_modpath("moretrees")
dofile(modpath.."/default_settings.txt") dofile(modpath.."/default_settings.txt")
if io.open(worldpath.."/moretrees_settings.txt","r") == nil then if io.open(worldpath.."/moretrees_settings.txt","r") then
io.input(modpath.."/default_settings.txt")
io.output(worldpath.."/moretrees_settings.txt")
local size = 2^13 -- good buffer size (8K)
while true do
local block = io.read(size)
if not block then
io.close() io.close()
break
end
io.write(block)
end
else
dofile(worldpath.."/moretrees_settings.txt") dofile(worldpath.."/moretrees_settings.txt")
end end
@ -90,7 +77,6 @@ dofile(modpath.."/node_defs.lua")
dofile(modpath.."/biome_defs.lua") dofile(modpath.."/biome_defs.lua")
dofile(modpath.."/saplings.lua") dofile(modpath.."/saplings.lua")
dofile(modpath.."/crafts.lua") dofile(modpath.."/crafts.lua")
dofile(modpath.."/leafdecay.lua")
-- tree spawning setup -- tree spawning setup

View File

@ -1,87 +0,0 @@
-- leaf decay
-- this function is based on the default leafdecay code
local process_drops = function(pos, name)
local drops = minetest.get_node_drops(name)
for _,dropitem in ipairs(drops) do
if dropitem ~= name
or (string.find(name, "leaves") and moretrees.decay_leaves_as_items) then
local newpos = {
x=pos.x + math.random() - 0.5,
y=pos.y + math.random() - 0.5,
z=pos.z + math.random() - 0.5
}
minetest.add_item(newpos, dropitem)
end
end
end
if moretrees.enable_leafdecay then
for i in ipairs(moretrees.treelist) do
local treename = moretrees.treelist[i][1]
if treename ~= "jungletree" and treename ~= "pine" and treename ~= "acacia" and treename ~= "fir" and treename ~= "palm" then
minetest.register_abm({
nodenames = "moretrees:"..treename.."_leaves",
interval = moretrees.leafdecay_delay,
chance = moretrees.leafdecay_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.find_node_near(pos, moretrees.leafdecay_radius, { "ignore", "moretrees:"..treename.."_trunk" }) then return end
process_drops(pos, node.name)
minetest.remove_node(pos)
nodeupdate(pos)
end
})
end
end
minetest.register_abm({
nodenames = {"default:jungleleaves", "moretrees:jungletree_leaves_red", "moretrees:jungletree_leaves_yellow"},
interval = moretrees.leafdecay_delay,
chance = moretrees.leafdecay_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.find_node_near(pos, moretrees.leafdecay_radius, {"ignore", "default:jungletree"}) then return end
process_drops(pos, node.name)
minetest.remove_node(pos)
nodeupdate(pos)
end
})
minetest.register_abm({
nodenames = {"moretrees:fir_leaves", "moretrees:fir_leaves_bright"},
interval = moretrees.leafdecay_delay,
chance = moretrees.leafdecay_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.find_node_near(pos, moretrees.leafdecay_radius, { "ignore", "moretrees:fir_trunk" }) then return end
process_drops(pos, node.name)
minetest.remove_node(pos)
nodeupdate(pos)
end
})
minetest.register_abm({
nodenames = "moretrees:palm_leaves",
interval = moretrees.leafdecay_delay,
chance = moretrees.leafdecay_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.find_node_near(pos, moretrees.palm_leafdecay_radius, { "ignore", "moretrees:palm_trunk" }) then return end
process_drops(pos, node.name)
minetest.remove_node(pos)
nodeupdate(pos)
end
})
end
-- Decay apple tree blossoms from nature_classic mod
if minetest.get_modpath("nature_classic") then
minetest.register_abm({
nodenames = "moretrees:apple_blossoms",
interval = moretrees.default_leafdecay_delay,
chance = moretrees.default_leafdecay_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.find_node_near(pos, moretrees.leafdecay_radius, { "ignore", "moretrees:apple_tree_trunk" }) then return end
process_drops(pos, "moretrees:apple_tree_leaves")
minetest.remove_node(pos)
nodeupdate(pos)
end
})
end

View File

@ -33,11 +33,6 @@ end
-- redefine default leaves to handle plantlike and/or leaf decay options -- redefine default leaves to handle plantlike and/or leaf decay options
if moretrees.enable_default_leafdecay then
minetest.override_item("default:leaves", {
groups = { snappy = 3, flammable = 2, leaves = 1 }
})
end
if moretrees.plantlike_leaves then if moretrees.plantlike_leaves then
minetest.override_item("default:leaves", { minetest.override_item("default:leaves", {
inventory_image = minetest.inventorycube("default_leaves.png"), inventory_image = minetest.inventorycube("default_leaves.png"),
@ -52,11 +47,6 @@ end
-- redefine default jungle leaves for same -- redefine default jungle leaves for same
if moretrees.enable_default_leafdecay then
minetest.override_item("default:jungleleaves", {
groups = { snappy = 3, flammable = 2, leaves = 1 }
})
end
if moretrees.plantlike_leaves then if moretrees.plantlike_leaves then
minetest.override_item("default:jungleleaves", { minetest.override_item("default:jungleleaves", {
inventory_image = minetest.inventorycube("default_jungleleaves.png"), inventory_image = minetest.inventorycube("default_jungleleaves.png"),
@ -76,12 +66,15 @@ for i in ipairs(moretrees.treelist) do
local fruitdesc = moretrees.treelist[i][4] local fruitdesc = moretrees.treelist[i][4]
local selbox = moretrees.treelist[i][5] local selbox = moretrees.treelist[i][5]
local vscale = moretrees.treelist[i][6] local vscale = moretrees.treelist[i][6]
local saptext = moretrees.treelist[i][7] or "moretrees_"..treename.."_sapling.png"
local saptex = moretrees.treelist[i][7]
if treename ~= "jungletree" -- the default game provides jungle tree, acacia, and pine trunk/planks nodes. if treename ~= "jungletree" -- the default game provides jungle tree, acacia, and pine trunk/planks nodes.
and treename ~= "acacia" and treename ~= "acacia"
and treename ~= "pine" then and treename ~= "pine" then
saptex = "moretrees_"..treename.."_sapling.png"
minetest.register_node("moretrees:"..treename.."_trunk", { minetest.register_node("moretrees:"..treename.."_trunk", {
description = S(treedesc.." Trunk"), description = S(treedesc.." Trunk"),
tiles = { tiles = {
@ -107,8 +100,8 @@ for i in ipairs(moretrees.treelist) do
minetest.register_node("moretrees:"..treename.."_sapling", { minetest.register_node("moretrees:"..treename.."_sapling", {
description = S(treedesc.." Sapling"), description = S(treedesc.." Sapling"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = {saptext}, tiles = {saptex},
inventory_image = saptext, inventory_image = saptex,
paramtype = "light", paramtype = "light",
paramtype2 = "waving", paramtype2 = "waving",
walkable = false, walkable = false,
@ -125,9 +118,11 @@ for i in ipairs(moretrees.treelist) do
-- this is because max_items is 1 -- this is because max_items is 1
local droprarity = 100 local droprarity = 100
local decay = moretrees.leafdecay_radius
if treename == "palm" then if treename == "palm" then
droprarity = 20 droprarity = 20
decay = moretrees.palm_leafdecay_radius
end end
local moretrees_leaves_inventory_image = nil local moretrees_leaves_inventory_image = nil
@ -147,7 +142,7 @@ for i in ipairs(moretrees.treelist) do
tiles = { "moretrees_"..treename.."_leaves.png" }, tiles = { "moretrees_"..treename.."_leaves.png" },
inventory_image = moretrees_leaves_inventory_image, inventory_image = moretrees_leaves_inventory_image,
paramtype = "light", paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1}, groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = decay},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = { drop = {
@ -222,8 +217,8 @@ for i in ipairs(moretrees.treelist) do
minetest.register_node("moretrees:"..treename.."_sapling_ongen", { minetest.register_node("moretrees:"..treename.."_sapling_ongen", {
description = S(treedesc.." Sapling"), description = S(treedesc.." Sapling"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = {saptext}, tiles = {saptex},
inventory_image = saptext, inventory_image = saptex,
paramtype = "light", paramtype = "light",
paramtype2 = "waving", paramtype2 = "waving",
walkable = false, walkable = false,
@ -298,7 +293,7 @@ for color = 1, #jungleleaves do
tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..".png"}, tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..".png"},
inventory_image = moretrees_leaves_inventory_image, inventory_image = moretrees_leaves_inventory_image,
paramtype = "light", paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1}, groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = moretrees.leafdecay_radius },
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {
@ -326,7 +321,7 @@ minetest.register_node("moretrees:fir_leaves_bright", {
tiles = { "moretrees_fir_leaves_bright.png" }, tiles = { "moretrees_fir_leaves_bright.png" },
inventory_image = moretrees_leaves_inventory_image, inventory_image = moretrees_leaves_inventory_image,
paramtype = "light", paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1 }, groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = moretrees.leafdecay_radius },
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {

View File

@ -1,2 +1,3 @@
default default
watershed? watershed?

View File

@ -16,7 +16,7 @@ minetest.register_node(":"..nature.blossom_node, {
drawtype = "allfaces_optional", drawtype = "allfaces_optional",
tiles = nature.blossom_textures, tiles = nature.blossom_textures,
paramtype = "light", paramtype = "light",
groups = { snappy = 3, leafdecay = 3, flammable = 2 }, groups = { snappy = 3, leafdecay = 3, flammable = 2, leafdecay = 3 },
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
waving = 1 waving = 1
}) })

View File

@ -103,7 +103,6 @@ biome_lib:register_generate_plant({
"moretrees:jungletree_sapling_ongen", "moretrees:jungletree_sapling_ongen",
"moretrees:oak_sapling_ongen", "moretrees:oak_sapling_ongen",
"moretrees:palm_sapling_ongen", "moretrees:palm_sapling_ongen",
"moretrees:pine_sapling_ongen",
"moretrees:rubber_tree_sapling_ongen", "moretrees:rubber_tree_sapling_ongen",
"moretrees:sequoia_sapling_ongen", "moretrees:sequoia_sapling_ongen",
"moretrees:spruce_sapling_ongen", "moretrees:spruce_sapling_ongen",