repository for Mineraltrees
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<XmlLuaProjectDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Documents>
|
||||
<DocumentRef FileName=".\Script1.lua" />
|
||||
</Documents>
|
||||
</XmlLuaProjectDocument>
|
|
@ -0,0 +1,34 @@
|
|||
=====================Mineral Trees mod for Minetest 0.4.12!=========================
|
||||
Mineral Trees is a mod designed to make all ores in default Minetest renewable, by making them literally grow on trees!
|
||||
Around the world you will find rare clusters of mineral trees, trees that grow by absorbing one of the six minerals in Minetest into their trunks,
|
||||
strengthening them and allowing them to grow to huge proportions. These minerals, found mostly in the bark, can be smelted out of the
|
||||
tree leaving blooms, 9 of which can be crafted together to make the lump or crystal of the specific mineral. This applies to all trees
|
||||
except the coal tree, the bark of which can instead be used as an effective fuel.
|
||||
|
||||
This mod depends on both the Default mod included with Minetest, and the plants_lib library by VanessaE. Both these mods must be installed in
|
||||
order for this mod to not crash on startup.
|
||||
|
||||
I hope this mod helps!
|
||||
-GravelPunch
|
||||
|
||||
Copyright (C) 2010-2013 GravelPunch <gravelpunch@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
License for Textures, Models and Sounds
|
||||
---------------------------------------
|
||||
|
||||
CC-BY-SA 3.0 UNPORTED. Created by GravelPunch, with contributions by SandSlap
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
--config options
|
||||
mineraltrees.tree_angle = 45 --how 'bent' the limbs and branches of all mineraltrees are. Warning: changes may be unpredictable
|
||||
mineraltrees.dist_apart = 20--how far apart two mineraltrees can be, at a minimum.
|
||||
mineraltrees.seed_dif = 675 --The difference between the world's seed and the mineraltree's seed. Good for maintaining compatibility IMPORTANT: changes as trees are registered
|
||||
mineraltrees.base_rarity = 95--How rare, out of 100, a mineraltree is. Calculated using this < math.random(1, 100)
|
||||
mineraltrees.rel_rarity = 1 --Deprecated
|
||||
mineraltrees.biome_max_count = 1 --How many mineraltrees can be in one area
|
||||
|
||||
--tree-specific rareness options
|
||||
--These options decide how many times out of the total a given tree will spawn. For example, if they were 3:3:3:2:2:1, a coal tree would spawn 3 of 14 times.
|
||||
mineraltrees.coal_rarity = 3
|
||||
mineraltrees.iron_rarity = 3
|
||||
mineraltrees.copper_rarity = 3
|
||||
mineraltrees.gold_rarity = 2
|
||||
mineraltrees.mese_rarity = 2
|
||||
mineraltrees.diamond_rarity = 1
|
||||
|
||||
--tree-specific enabling
|
||||
mineraltrees.enable_coal_tree = true
|
||||
mineraltrees.enable_iron_tree = true
|
||||
mineraltrees.enable_copper_tree = true
|
||||
mineraltrees.enable_gold_tree = true
|
||||
mineraltrees.enable_mese_tree = true
|
||||
mineraltrees.enable_diamond_tree = true
|
||||
|
||||
--biome config options. Dictate in how many circumstances a mineraltree can spawn. More specific values make for rarer trees.
|
||||
mineraltrees.min_elevation = 20
|
||||
mineraltrees.max_elevation = 40
|
||||
mineraltrees.temp_min = 1
|
||||
mineraltrees.tem_max = .25
|
|
@ -0,0 +1,51 @@
|
|||
--All mod recipes
|
||||
minetest.register_craft({
|
||||
output = "default:copper_lump",
|
||||
recipe = {
|
||||
{"mineraltrees:copper_bloom", "mineraltrees:copper_bloom", "mineraltrees:copper_bloom"},
|
||||
{"mineraltrees:copper_bloom", "mineraltrees:copper_bloom", "mineraltrees:copper_bloom"},
|
||||
{"mineraltrees:copper_bloom", "mineraltrees:copper_bloom", "mineraltrees:copper_bloom"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:iron_lump",
|
||||
recipe = {
|
||||
{"mineraltrees:iron_bloom", "mineraltrees:iron_bloom", "mineraltrees:iron_bloom"},
|
||||
{"mineraltrees:iron_bloom", "mineraltrees:iron_bloom", "mineraltrees:iron_bloom"},
|
||||
{"mineraltrees:iron_bloom", "mineraltrees:iron_bloom", "mineraltrees:iron_bloom"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:mese_crystal",
|
||||
recipe = {
|
||||
{"mineraltrees:mese_bloom", "mineraltrees:mese_bloom", "mineraltrees:mese_bloom"},
|
||||
{"mineraltrees:mese_bloom", "mineraltrees:mese_bloom", "mineraltrees:mese_bloom"},
|
||||
{"mineraltrees:mese_bloom", "mineraltrees:mese_bloom", "mineraltrees:mese_bloom"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:diamond",
|
||||
recipe = {
|
||||
{"mineraltrees:diamond_bloom", "mineraltrees:diamond_bloom", "mineraltrees:diamond_bloom"},
|
||||
{"mineraltrees:diamond_bloom", "mineraltrees:diamond_bloom", "mineraltrees:diamond_bloom"},
|
||||
{"mineraltrees:diamond_bloom", "mineraltrees:diamond_bloom", "mineraltrees:diamond_bloom"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:gold_lump",
|
||||
recipe = {
|
||||
{"mineraltrees:gold_bloom", "mineraltrees:gold_bloom", "mineraltrees:gold_bloom"},
|
||||
{"mineraltrees:gold_bloom", "mineraltrees:gold_bloom", "mineraltrees:gold_bloom"},
|
||||
{"mineraltrees:gold_bloom", "mineraltrees:gold_bloom", "mineraltrees:gold_bloom"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mineraltrees:splitter",
|
||||
type = "shapeless",
|
||||
recipe = {"default:axe_steel"}
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
plants_lib
|
|
@ -0,0 +1,125 @@
|
|||
--============Mineral Trees Mod for Minetest 0.4.12!=============--
|
||||
--Notice: All material shown here is property of Gravelpunch <gravelpunch@gmail.com>, (C) 2015, licensed under GLPGL and the art under CC-BY-SA 3.0 unported. See readme.txt for more details.
|
||||
|
||||
mineraltrees = {}
|
||||
|
||||
function table.contains(table, element)
|
||||
for key, value in pairs(table) do
|
||||
if value == element then
|
||||
return key
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
--sets up tables for mineral trees--
|
||||
mineraltrees.bloom_array = {}
|
||||
mineraltrees.bark_array = {}
|
||||
mineraltrees.tree_array = {}
|
||||
|
||||
modpath = minetest.get_modpath("mineraltrees")
|
||||
--loads config options
|
||||
dofile(modpath.."/config.txt")
|
||||
--loads mineraltrees.register_mineral_tree
|
||||
dofile(modpath.."/tree.lua")
|
||||
|
||||
mineraltrees.mineraltree_defs = {
|
||||
coaltree = {
|
||||
name = "coal",
|
||||
has_bloom = false,
|
||||
rarity = mineraltrees.coal_rarity,
|
||||
enabled = mineraltrees.enable_coal_tree
|
||||
},
|
||||
irontree = {
|
||||
name = "iron",
|
||||
has_bloom = true,
|
||||
rarity = mineraltrees.iron_rarity,
|
||||
enabled = mineraltrees.enable_iron_tree
|
||||
},
|
||||
coppertree = {
|
||||
name = "copper",
|
||||
has_bloom = true,
|
||||
rarity = mineraltrees.copper_rarity,
|
||||
enabled = mineraltrees.enable_copper_tree
|
||||
},
|
||||
goldtree = {
|
||||
name = "gold",
|
||||
has_bloom = true,
|
||||
rarity = mineraltrees.gold_rarity,
|
||||
enabled = mineraltrees.enable_gold_tree
|
||||
},
|
||||
mesetree = {
|
||||
name = "mese",
|
||||
has_bloom = true,
|
||||
rarity = mineraltrees.mese_rarity,
|
||||
enabled = mineraltrees.enable_mese_tree
|
||||
},
|
||||
diamondtree = {
|
||||
name = "diamond",
|
||||
has_bloom = true,
|
||||
rarity = mineraltrees.diamond_rarity,
|
||||
enabled = mineraltrees.enable_diamond_tree
|
||||
}
|
||||
}
|
||||
|
||||
mineraltrees.sapling_rarity_array = {}
|
||||
|
||||
--registers all mineraltrees
|
||||
for _, mineraltree_def in pairs(mineraltrees.mineraltree_defs) do
|
||||
mineraltrees.register_mineral_tree(mineraltree_def.name, mineraltree_def.has_bloom, mineraltree_def.rarity, mineraltree_def.enabled)
|
||||
end
|
||||
|
||||
mineraltrees.biome_def = {
|
||||
surface = "default:dirt_with_grass",
|
||||
avoid_nodes = mineraltrees.tree_array,
|
||||
avoid_radius = mineraltrees.dist_apart,
|
||||
seed_dif = mineraltrees.seed_dif,
|
||||
rarity = mineraltrees.base_rarity,
|
||||
max_count = mineraltrees.biome_max_count,
|
||||
min_elevation = mineraltrees.min_elevation,
|
||||
max_elevation = mineraltrees.max_elevation,
|
||||
temp_min = mineraltrees.temp_min,
|
||||
temp_max = mineraltrees.temp_max
|
||||
}
|
||||
|
||||
--registers tree spawning with plants_lib
|
||||
plantslib:register_generate_plant(mineraltrees.biome_def, mineraltrees.sapling_rarity_array)
|
||||
|
||||
--Bark Splitter definition--
|
||||
minetest.register_craftitem("mineraltrees:splitter", {
|
||||
description = "Bark Splitter",
|
||||
inventory_image = "mineraltrees_splitter.png",
|
||||
weild_image = "mineraltrees_splitter.png",
|
||||
weild_scale = 1.7,
|
||||
stack_max = 1,
|
||||
liquids_pointable = false,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
pointed_pos = pointed_thing.under
|
||||
pointed_node = minetest.get_node(pointed_pos)
|
||||
print(pointed_node.name)
|
||||
|
||||
node_index = table.contains(mineraltrees.tree_array, pointed_node.name)
|
||||
|
||||
if (mineraltrees.tree_array[node_index] ~= nil) and (mineraltrees.bark_array[node_index] ~= nil) then
|
||||
user:get_inventory():add_item("main", mineraltrees.bark_array[node_index])
|
||||
minetest.set_node(pointed_pos, {name="mineraltrees:barelog"})
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
--Bare Log definition
|
||||
minetest.register_node("mineraltrees:barelog", {
|
||||
description = "Bare Log",
|
||||
tiles = {"mineraltrees_barelog.png", "mineraltrees_barelog.png", "mineraltrees_barelogside.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
--loads crafting. All the way down here so all the ingredients are loaded already.
|
||||
dofile(modpath.."/crafting.lua")
|
After Width: | Height: | Size: 732 B |
After Width: | Height: | Size: 557 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 713 B |
After Width: | Height: | Size: 278 B |
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 739 B |
After Width: | Height: | Size: 429 B |
After Width: | Height: | Size: 392 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 842 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 721 B |
After Width: | Height: | Size: 735 B |
After Width: | Height: | Size: 380 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 714 B |
After Width: | Height: | Size: 474 B |
After Width: | Height: | Size: 407 B |
After Width: | Height: | Size: 316 B |
After Width: | Height: | Size: 808 B |
After Width: | Height: | Size: 345 B |
After Width: | Height: | Size: 931 B |
|
@ -0,0 +1,138 @@
|
|||
--function for registering mineral trees--
|
||||
function mineraltrees.register_mineral_tree(mineral, has_bloom, tree_rarity, enabled)
|
||||
if not enabled then
|
||||
return
|
||||
end
|
||||
|
||||
--registers the log of the respective tree--
|
||||
minetest.register_node("mineraltrees:"..mineral.."tree", {
|
||||
description = mineral.."wood Tree",
|
||||
tiles = {"default_tree_top.png", "default_tree_top.png", "mineraltrees_"..mineral.."tree.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
on_place = minetest.rotate_node,
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|
||||
--registers the leaves of the respective tree--
|
||||
minetest.register_node("mineraltrees:"..mineral.."leaves", {
|
||||
description = mineral.."wood Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles ={"mineraltrees_"..mineral.."leaves.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, leafdecay=7, flammable=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
-- player will get sapling with 1/200 chance
|
||||
items = {"mineraltrees:"..mineral.."sapling"},
|
||||
rarity = 200,
|
||||
},
|
||||
{
|
||||
-- player will get leaves only if he get no saplings,
|
||||
-- this is because max_items is 1
|
||||
items = {"mineraltrees:"..mineral.."leaves"},
|
||||
}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
--registers the sapling of the respective tree
|
||||
minetest.register_node("mineraltrees:"..mineral.."sapling", {
|
||||
description = mineral.."wood Sapling",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
tiles ={"mineraltrees_"..mineral.."sapling.png"},
|
||||
inventory_image = "mineraltrees_"..mineral.."sapling.png",
|
||||
wield_image = "mineraltrees_"..mineral.."sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1}
|
||||
})
|
||||
|
||||
local tree_def = {
|
||||
axiom ="FFFFFFFAFFFFF/A",
|
||||
rules_a = "[&&[F^TFDFFDFFDFF][--F^TFDFFDFFDFF][----F^TFDFFDFFDFF][++F^TFDFFDFFDFF]]",
|
||||
rules_b = "",
|
||||
rules_c = "F",
|
||||
rules_d = "&",
|
||||
trunk="mineraltrees:"..mineral.."tree",
|
||||
leaves="mineraltrees:"..mineral.."leaves",
|
||||
angle=mineraltrees.tree_angle,
|
||||
iterations=2,
|
||||
random_level=0,
|
||||
trunk_type="crossed",
|
||||
thin_branches=true,
|
||||
fruit_chance=0,
|
||||
fruit="default:apple"
|
||||
}
|
||||
|
||||
local function grow_tree(pos)
|
||||
minetest.remove_node(pos)
|
||||
minetest.spawn_tree(pos, tree_def)
|
||||
end
|
||||
|
||||
--registers plant growing with plants_lib
|
||||
plantslib:grow_plants({
|
||||
grow_delay = 10,
|
||||
grow_chance = 1,
|
||||
grow_plant = "mineraltrees:"..mineral.."sapling",
|
||||
grow_nodes = "default:dirt_with_grass",
|
||||
grow_function = tree_def
|
||||
})
|
||||
|
||||
--registers bark
|
||||
minetest.register_craftitem("mineraltrees:"..mineral.."bark", {
|
||||
description = mineral.."wood Bark",
|
||||
inventory_image = "mineraltrees_"..mineral.."tree.png",
|
||||
weild_image = "mineraltrees_"..mineral.."tree.png",
|
||||
weild_scale = 1,
|
||||
stack_max = 99,
|
||||
liquids_pointable = false
|
||||
})
|
||||
|
||||
--registers bloom if applicable
|
||||
if (has_bloom)then
|
||||
minetest.register_craftitem("mineraltrees:"..mineral.."_bloom", {
|
||||
description = mineral.." Bloom",
|
||||
inventory_image = "mineraltrees_"..mineral.."_bloom.png",
|
||||
weild_image = "mineraltrees_"..mineral.."bloom.png",
|
||||
weild_scale = 1,
|
||||
stack_max = 99,
|
||||
liguids_pointable = false
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mineraltrees:"..mineral.."_bloom",
|
||||
recipe = "mineraltrees:"..mineral.."bark"
|
||||
})
|
||||
else
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mineraltrees:"..mineral.."bark",
|
||||
burntime = 5
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(mineraltrees.bark_array, "mineraltrees:"..mineral.."bark 4")
|
||||
table.insert(mineraltrees.bloom_array, "mineraltrees:"..mineral.."_bloom")
|
||||
table.insert(mineraltrees.tree_array, "mineraltrees:"..mineral.."tree")
|
||||
mineraltrees.seed_dif = mineraltrees.seed_dif+1
|
||||
|
||||
--adds sapling to sapling array according to rarity
|
||||
for i = 0, tree_rarity do
|
||||
table.insert(mineraltrees.sapling_rarity_array, "mineraltrees:"..mineral.."sapling")
|
||||
end
|
||||
end
|