19 Commits

Author SHA1 Message Date
e72c539cdc add minimum minetest version key for contentdb 2020-06-03 13:00:26 -04:00
66fd6724c5 Merge branch 'respect_protection' into 'master'
Respect protection when placing saplings

See merge request VanessaE/moretrees!6
2020-04-23 02:40:25 +00:00
fa83e1b262 Respect protection when placing saplings 2020-04-22 22:09:04 +00:00
f94f1bea26 Merge branch 'patch-1' into 'master'
Fix missing comma messing with load order

See merge request VanessaE/moretrees!5
2020-04-20 08:14:05 +00:00
09f08b50bc Fix missing comma messing with load order 2020-04-20 08:04:21 +00:00
d335eceecc Merge branch 'cocomilk-axe-bugfix' into 'master'
Fix bug with coconut-milk craft

See merge request VanessaE/moretrees!3
2020-02-02 19:19:47 +00:00
89bffdecaf Fix bug with coconut-milk craft
When crafting, tool used was fully repaired.
Now crafting will do damages on tool used instead.
2020-02-02 15:13:41 +01:00
6fd3729669 Merge branch 'fences' into 'master'
add optional fences and gates

See merge request VanessaE/moretrees!2
2019-10-03 18:13:57 +00:00
25250e6eea add optional fences and gates 2019-10-03 18:13:57 +00:00
9bc0bc1b68 Merge branch 'jungletree_drop' into 'master'
make moretrees:jungletree_trunk drop default:jungletree

See merge request VanessaE/moretrees!1
2019-10-03 18:10:58 +00:00
d097fd6044 make moretrees:jungletree_trunk drop default:jungletree 2019-10-03 18:10:58 +00:00
216acdc6b1 override default sapling/tree/leaves/wood/etc
get rid of "apple" from descriptions
2019-06-18 14:51:50 -04:00
dde035cb5e use table.copy instead of clone-node 2019-06-18 14:37:06 -04:00
acb534d8d0 fix derps in tables 2019-05-22 21:05:04 -04:00
f45ffc09bf Use a "set" for surface list rather than a plain table
(requires biome_lib from commit a96f015c or later)
2019-05-22 20:03:15 -04:00
e912fba6c8 tweak on-gen to be faster still 2019-05-22 19:16:30 -04:00
7161cfbdee rework how sapling growth is defined
if on-gen, saplings grow per their biome_defs.lua settings
if placed, they grow on the surfaces given in the tables:

* anything but palms will grow on the dirt surfaces
* conifers can also grow on a cold surface, but other trees will not
* only palms can grow on sand, but they will not grow on dirt or cold
2019-05-22 19:09:41 -04:00
a27af10d2e put on_gen saplings into creative inv, adjust description 2019-05-22 18:44:09 -04:00
e474194daf speed up sapling growth.
they're just too damned slow

also sped up the on_gen ones
they were slower than they needed to be
2019-05-22 18:41:03 -04:00
7 changed files with 207 additions and 100 deletions

View File

@ -117,10 +117,39 @@ for i in ipairs(moretrees.cutting_tools) do
},
replacements = {
{ "moretrees:coconut", "moretrees:raw_coconut" },
{ tool, tool }
}
})
end
-- give tool back with wear preserved
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
if (itemstack:get_name() == "moretrees:coconut_milk") then
for i, j in pairs(old_craft_grid) do
-- find tool used to do the craft
local ocg_name = j:get_name()
if ((ocg_name ~= "") and (ocg_name ~= "moretrees:coconut") and (ocg_name ~= "vessels:drinking_glass")) then
-- create a new tool and set wear
local t = ItemStack(ocg_name)
local w = j:get_wear()
-- works if tool used is an axe
local uses = j:get_tool_capabilities().groupcaps.choppy.uses or 0
if (w == 0 and uses ~= 0) then
-- tool has never been used
-- use tool once
t:set_wear(65535/(9*(uses - 1)))
else
-- set wear back
t:set_wear(w)
-- use tool once
if (uses ~= 0) then
t:add_wear(65535/(9*(uses - 1)))
end
end
-- add to craft inventory
craft_inv:add_item("craft", t)
end
end
end
end)
minetest.register_craft({
type = "shapeless",

View File

@ -25,12 +25,16 @@ moretrees.enable_beech = false
moretrees.spawn_saplings = true
-- 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
-- will use the default stairs mod in minetest_game, if present
moretrees.enable_stairs = true
-- Set this to true if you want the plantlike drawtype for leaves, which
-- If this variable is set to true, register fences for moretrees wood
moretrees.enable_fences = false
-- Set this to true if you want the plantlike drawtype for leaves, which
-- improves some peoples' framerates without resorting to making leaf nodes opaque.
-- Affects default leaves and default jungle leaves also.
@ -122,8 +126,8 @@ moretrees.dates_item_drop_ichance = 10 -- inverse probability of ripe dates dr
-- Sapling settings
moretrees.sapling_interval = 500
moretrees.sapling_chance = 20
moretrees.sapling_interval = 100
moretrees.sapling_chance = 5
-- If this variable is set to true, drop leaves out as entities during leaf
-- decay, rather than just disappearing them.

View File

@ -1,6 +1,7 @@
default
biome_lib
vessels
doors?
stairs?
moreblocks?
intllib?

View File

@ -15,6 +15,41 @@
moretrees = {}
minetest.override_item("default:sapling", {
description = "Sapling"
})
minetest.override_item("default:tree", {
description = "Tree"
})
minetest.override_item("default:wood", {
description = "Wooden Planks"
})
minetest.override_item("default:leaves", {
description = "Leaves"
})
minetest.override_item("default:fence_wood", {
description = "Wooden Fence"
})
minetest.override_item("default:fence_rail_wood", {
description = "Wooden Fence Rail"
})
if minetest.get_modpath("doors") then
minetest.override_item("doors:gate_wood_closed", {
description = "Wooden Fence Gate"
})
minetest.override_item("doors:gate_wood_open", {
description = "Wooden Fence Gate"
})
end
-- Read the default config file (and if necessary, copy it to the world folder).
local worldpath=minetest.get_worldpath()
@ -36,17 +71,6 @@ else
end
moretrees.intllib = S
-- clone node
function moretrees.clone_node(name)
local node2 = {}
local node = minetest.registered_nodes[name]
for k,v in pairs(node) do
node2[k]=v
end
return node2
end
-- infinite stacks checking
if minetest.get_modpath("unified_inventory") or not

View File

@ -1 +1,4 @@
name = moretrees
depends = default, biome_lib, vessels
optional_depends = doors, stairs, moreblocks, intllib, farming
min_minetest_version = 5.2.0

View File

@ -119,6 +119,18 @@ for i in ipairs(moretrees.treelist) do
},
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
sounds = default.node_sound_defaults(),
on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
{x = -3, y = 1, z = -3},
{x = 3, y = 6, z = 3},
-- maximum interval of interior volume check
4)
return itemstack
end,
})
local moretrees_leaves_inventory_image = nil
@ -209,10 +221,45 @@ for i in ipairs(moretrees.treelist) do
end
end
if moretrees.enable_fences then
local planks_name = "moretrees:" .. treename .. "_planks"
local planks_tile = "moretrees_" .. treename .. "_wood.png"
default.register_fence("moretrees:" .. treename .. "_fence", {
description = S(treedesc.." Fence"),
texture = planks_tile,
inventory_image = "default_fence_overlay.png^" .. planks_tile ..
"^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^" .. planks_tile ..
"^default_fence_overlay.png^[makealpha:255,126,126",
material = planks_name,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
})
default.register_fence_rail("moretrees:" .. treename .. "_fence_rail", {
description = S(treedesc.." Fence Rail"),
texture = planks_tile,
inventory_image = "default_fence_rail_overlay.png^" .. planks_tile ..
"^default_fence_rail_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_rail_overlay.png^" .. planks_tile ..
"^default_fence_rail_overlay.png^[makealpha:255,126,126",
material = planks_name,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
})
if minetest.global_exists("doors") then
doors.register_fencegate("moretrees:" .. treename .. "_gate", {
description = S(treedesc .. " Fence Gate"),
texture = planks_tile,
material = planks_name,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
})
end
end
end
minetest.register_node("moretrees:"..treename.."_sapling_ongen", {
description = S(treedesc.." Sapling (on-generated)"),
description = S(treedesc.." Sapling (fast growth)"),
drawtype = "plantlike",
tiles = {saptex},
inventory_image = saptex,
@ -224,9 +271,21 @@ for i in ipairs(moretrees.treelist) do
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,not_in_creative_inventory=1,sapling=1},
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
sounds = default.node_sound_defaults(),
drop = "moretrees:"..treename.."_sapling"
drop = "moretrees:"..treename.."_sapling",
on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling_ongen",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
{x = -3, y = 1, z = -3},
{x = 3, y = 6, z = 3},
-- maximum interval of interior volume check
4)
return itemstack
end,
})
local fruitname = nil
@ -360,6 +419,7 @@ end
-- we need our own copy of that node, which moretrees will match against.
local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"])
jungle_tree.drop = "default:jungletree"
minetest.register_node("moretrees:jungletree_trunk", jungle_tree)
default.register_leafdecay({
@ -404,7 +464,7 @@ default.register_leafdecay({
if moretrees.enable_redefine_apple then
local appledef = moretrees.clone_node("default:apple")
local appledef = table.copy(minetest.registered_nodes["default:apple"])
appledef.groups.attached_node = 1
minetest.register_node(":default:apple", appledef)
end

View File

@ -1,98 +1,84 @@
-- sapling growth
-- these tables only affect hand-placed saplings
-- mapgen-placed always use their biome def settings, which are much more
-- limited, in the interest of speed.
local dirt_surfaces = {
set = true,
["default:dirt"] = true,
["default:dirt_with_grass"] = true,
["default:dirt_with_dry_grass"] = true,
["default:dirt_with_coniferous_litter"] = true,
["default:dirt_with_rainforest_litter"] = true,
["woodsoils:dirt_with_leaves_1"] = true,
["woodsoils:dirt_with_leaves_2"] = true,
["woodsoils:grass_with_leaves_1"] = true,
["woodsoils:grass_with_leaves_2"] = true
}
local conifer_surfaces = {
set = true,
["default:dirt"] = true,
["default:dirt_with_grass"] = true,
["default:dirt_with_dry_grass"] = true,
["default:dirt_with_coniferous_litter"] = true,
["default:dirt_with_rainforest_litter"] = true,
["woodsoils:dirt_with_leaves_1"] = true,
["woodsoils:dirt_with_leaves_2"] = true,
["woodsoils:grass_with_leaves_1"] = true,
["woodsoils:grass_with_leaves_2"] = true,
["default:dirt_with_snow"] = true
}
local sand_surfaces = {
set = true,
["default:sand"] = true,
["default:desert_sand"] = true,
["cottages:loam"] = true,
-- note, no silver sand here.
-- too cold for a palm, too... well... sandy for anything else.
}
for i in ipairs(moretrees.treelist) do
local treename = moretrees.treelist[i][1]
local tree_model = treename.."_model"
local tree_biome = treename.."_biome"
local surfaces
local grow_function = moretrees[tree_model]
if treename ~= "birch" and treename ~= "spruce" and treename ~= "fir" and treename ~= "jungletree" then
biome_lib:dbg(dump(moretrees[tree_biome].surface))
biome_lib:grow_plants({
grow_delay = moretrees.sapling_interval,
grow_chance = moretrees.sapling_chance,
grow_plant = "moretrees:"..treename.."_sapling",
grow_nodes = moretrees[tree_biome].surface,
grow_function = moretrees[tree_model],
})
if moretrees.spawn_saplings then
biome_lib:grow_plants({
grow_delay = 2,
grow_chance = 30,
grow_plant = "moretrees:"..treename.."_sapling_ongen",
grow_nodes = moretrees[tree_biome].surface,
grow_function = moretrees[tree_model],
})
end
if treename == "spruce"
or treename == "fir"
or treename == "cedar"
or treename == "pine" then
surfaces = conifer_surfaces
elseif string.find(treename, "palm") then
surfaces = sand_surfaces
else
surfaces = dirt_surfaces
end
end
biome_lib:grow_plants({
grow_delay = moretrees.sapling_interval,
grow_chance = moretrees.sapling_chance,
grow_plant = "moretrees:birch_sapling",
grow_nodes = moretrees.birch_biome.surface,
grow_function = "moretrees.grow_birch"
})
if treename == "spruce"
or treename == "fir"
or treename == "birch"
or treename == "jungletree" then
grow_function = "moretrees.grow_"..treename
end
biome_lib:dbg(dump(moretrees[tree_biome].surface))
biome_lib:grow_plants({
grow_delay = moretrees.sapling_interval,
grow_chance = moretrees.sapling_chance,
grow_plant = "moretrees:spruce_sapling",
grow_nodes = moretrees.spruce_biome.surface,
grow_function = "moretrees.grow_spruce"
})
biome_lib:grow_plants({
grow_delay = moretrees.sapling_interval,
grow_chance = moretrees.sapling_chance,
grow_plant = "moretrees:fir_sapling",
grow_nodes = moretrees.fir_biome.surface,
grow_function = "moretrees.grow_fir"
})
biome_lib:grow_plants({
grow_delay = moretrees.sapling_interval,
grow_chance = moretrees.sapling_chance,
grow_plant = "default:junglesapling",
grow_nodes = moretrees.jungletree_biome.surface,
grow_function = "moretrees.grow_jungletree"
})
if moretrees.spawn_saplings then
biome_lib:grow_plants({
grow_delay = 2,
grow_chance = 30,
grow_plant = "moretrees:jungletree_sapling_ongen",
grow_nodes = moretrees.jungletree_biome.surface,
grow_function = "moretrees.grow_jungletree"
grow_delay = moretrees.sapling_interval,
grow_chance = moretrees.sapling_chance,
grow_plant = "moretrees:"..treename.."_sapling",
grow_nodes = surfaces,
grow_function = grow_function,
})
biome_lib:grow_plants({
grow_delay = 2,
grow_chance = 30,
grow_plant = "moretrees:fir_sapling_ongen",
grow_nodes = moretrees.fir_biome.surface,
grow_function = "moretrees.grow_fir"
})
biome_lib:grow_plants({
grow_delay = 2,
grow_chance = 30,
grow_plant = "moretrees:spruce_sapling_ongen",
grow_nodes = moretrees.spruce_biome.surface,
grow_function = "moretrees.grow_spruce"
})
biome_lib:grow_plants({
grow_delay = 2,
grow_chance = 30,
grow_plant = "moretrees:birch_sapling_ongen",
grow_nodes = moretrees.birch_biome.surface,
grow_function = "moretrees.grow_birch"
grow_chance = 1,
grow_plant = "moretrees:"..treename.."_sapling_ongen",
grow_nodes = surfaces,
grow_function = grow_function,
})
end