forked from mtcontrib/moretrees
Compare commits
19 Commits
nalc-1.0
...
20200603-1
Author | SHA1 | Date | |
---|---|---|---|
e72c539cdc | |||
66fd6724c5 | |||
fa83e1b262 | |||
f94f1bea26 | |||
09f08b50bc | |||
d335eceecc | |||
89bffdecaf | |||
6fd3729669 | |||
25250e6eea | |||
9bc0bc1b68 | |||
d097fd6044 | |||
216acdc6b1 | |||
dde035cb5e | |||
acb534d8d0 | |||
f45ffc09bf | |||
e912fba6c8 | |||
7161cfbdee | |||
a27af10d2e | |||
e474194daf |
31
crafts.lua
31
crafts.lua
@ -117,10 +117,39 @@ for i in ipairs(moretrees.cutting_tools) do
|
|||||||
},
|
},
|
||||||
replacements = {
|
replacements = {
|
||||||
{ "moretrees:coconut", "moretrees:raw_coconut" },
|
{ "moretrees:coconut", "moretrees:raw_coconut" },
|
||||||
{ tool, tool }
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
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({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
|
@ -25,12 +25,16 @@ moretrees.enable_beech = false
|
|||||||
moretrees.spawn_saplings = true
|
moretrees.spawn_saplings = true
|
||||||
|
|
||||||
-- 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
|
||||||
-- will use the default stairs mod in minetest_game, if present
|
-- will use the default stairs mod in minetest_game, if present
|
||||||
|
|
||||||
moretrees.enable_stairs = true
|
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.
|
-- improves some peoples' framerates without resorting to making leaf nodes opaque.
|
||||||
-- Affects default leaves and default jungle leaves also.
|
-- 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
|
-- Sapling settings
|
||||||
|
|
||||||
moretrees.sapling_interval = 500
|
moretrees.sapling_interval = 100
|
||||||
moretrees.sapling_chance = 20
|
moretrees.sapling_chance = 5
|
||||||
|
|
||||||
-- If this variable is set to true, drop leaves out as entities during leaf
|
-- If this variable is set to true, drop leaves out as entities during leaf
|
||||||
-- decay, rather than just disappearing them.
|
-- decay, rather than just disappearing them.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
default
|
default
|
||||||
biome_lib
|
biome_lib
|
||||||
vessels
|
vessels
|
||||||
|
doors?
|
||||||
stairs?
|
stairs?
|
||||||
moreblocks?
|
moreblocks?
|
||||||
intllib?
|
intllib?
|
||||||
|
46
init.lua
46
init.lua
@ -15,6 +15,41 @@
|
|||||||
|
|
||||||
moretrees = {}
|
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).
|
-- Read the default config file (and if necessary, copy it to the world folder).
|
||||||
|
|
||||||
local worldpath=minetest.get_worldpath()
|
local worldpath=minetest.get_worldpath()
|
||||||
@ -36,17 +71,6 @@ else
|
|||||||
end
|
end
|
||||||
moretrees.intllib = S
|
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
|
-- infinite stacks checking
|
||||||
|
|
||||||
if minetest.get_modpath("unified_inventory") or not
|
if minetest.get_modpath("unified_inventory") or not
|
||||||
|
3
mod.conf
3
mod.conf
@ -1 +1,4 @@
|
|||||||
name = moretrees
|
name = moretrees
|
||||||
|
depends = default, biome_lib, vessels
|
||||||
|
optional_depends = doors, stairs, moreblocks, intllib, farming
|
||||||
|
min_minetest_version = 5.2.0
|
||||||
|
@ -119,6 +119,18 @@ for i in ipairs(moretrees.treelist) do
|
|||||||
},
|
},
|
||||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
|
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
|
||||||
sounds = default.node_sound_defaults(),
|
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
|
local moretrees_leaves_inventory_image = nil
|
||||||
@ -209,10 +221,45 @@ for i in ipairs(moretrees.treelist) do
|
|||||||
|
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
minetest.register_node("moretrees:"..treename.."_sapling_ongen", {
|
minetest.register_node("moretrees:"..treename.."_sapling_ongen", {
|
||||||
description = S(treedesc.." Sapling (on-generated)"),
|
description = S(treedesc.." Sapling (fast growth)"),
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = {saptex},
|
tiles = {saptex},
|
||||||
inventory_image = saptex,
|
inventory_image = saptex,
|
||||||
@ -224,9 +271,21 @@ for i in ipairs(moretrees.treelist) do
|
|||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
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(),
|
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
|
local fruitname = nil
|
||||||
@ -360,6 +419,7 @@ end
|
|||||||
-- we need our own copy of that node, which moretrees will match against.
|
-- we need our own copy of that node, which moretrees will match against.
|
||||||
|
|
||||||
local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"])
|
local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"])
|
||||||
|
jungle_tree.drop = "default:jungletree"
|
||||||
minetest.register_node("moretrees:jungletree_trunk", jungle_tree)
|
minetest.register_node("moretrees:jungletree_trunk", jungle_tree)
|
||||||
|
|
||||||
default.register_leafdecay({
|
default.register_leafdecay({
|
||||||
@ -404,7 +464,7 @@ default.register_leafdecay({
|
|||||||
|
|
||||||
|
|
||||||
if moretrees.enable_redefine_apple then
|
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
|
appledef.groups.attached_node = 1
|
||||||
minetest.register_node(":default:apple", appledef)
|
minetest.register_node(":default:apple", appledef)
|
||||||
end
|
end
|
||||||
|
146
saplings.lua
146
saplings.lua
@ -1,98 +1,84 @@
|
|||||||
-- sapling growth
|
-- 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
|
for i in ipairs(moretrees.treelist) do
|
||||||
local treename = moretrees.treelist[i][1]
|
local treename = moretrees.treelist[i][1]
|
||||||
local tree_model = treename.."_model"
|
local tree_model = treename.."_model"
|
||||||
local tree_biome = treename.."_biome"
|
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
|
if treename == "spruce"
|
||||||
|
or treename == "fir"
|
||||||
biome_lib:dbg(dump(moretrees[tree_biome].surface))
|
or treename == "cedar"
|
||||||
biome_lib:grow_plants({
|
or treename == "pine" then
|
||||||
grow_delay = moretrees.sapling_interval,
|
surfaces = conifer_surfaces
|
||||||
grow_chance = moretrees.sapling_chance,
|
elseif string.find(treename, "palm") then
|
||||||
grow_plant = "moretrees:"..treename.."_sapling",
|
surfaces = sand_surfaces
|
||||||
grow_nodes = moretrees[tree_biome].surface,
|
else
|
||||||
grow_function = moretrees[tree_model],
|
surfaces = dirt_surfaces
|
||||||
})
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
biome_lib:grow_plants({
|
if treename == "spruce"
|
||||||
grow_delay = moretrees.sapling_interval,
|
or treename == "fir"
|
||||||
grow_chance = moretrees.sapling_chance,
|
or treename == "birch"
|
||||||
grow_plant = "moretrees:birch_sapling",
|
or treename == "jungletree" then
|
||||||
grow_nodes = moretrees.birch_biome.surface,
|
grow_function = "moretrees.grow_"..treename
|
||||||
grow_function = "moretrees.grow_birch"
|
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({
|
biome_lib:grow_plants({
|
||||||
grow_delay = 2,
|
grow_delay = moretrees.sapling_interval,
|
||||||
grow_chance = 30,
|
grow_chance = moretrees.sapling_chance,
|
||||||
grow_plant = "moretrees:jungletree_sapling_ongen",
|
grow_plant = "moretrees:"..treename.."_sapling",
|
||||||
grow_nodes = moretrees.jungletree_biome.surface,
|
grow_nodes = surfaces,
|
||||||
grow_function = "moretrees.grow_jungletree"
|
grow_function = grow_function,
|
||||||
})
|
})
|
||||||
|
|
||||||
biome_lib:grow_plants({
|
biome_lib:grow_plants({
|
||||||
grow_delay = 2,
|
grow_delay = 2,
|
||||||
grow_chance = 30,
|
grow_chance = 1,
|
||||||
grow_plant = "moretrees:fir_sapling_ongen",
|
grow_plant = "moretrees:"..treename.."_sapling_ongen",
|
||||||
grow_nodes = moretrees.fir_biome.surface,
|
grow_nodes = surfaces,
|
||||||
grow_function = "moretrees.grow_fir"
|
grow_function = grow_function,
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
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"
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user