This commit is contained in:
Bruno Rybársky 2022-04-17 13:19:06 +02:00
commit 1d665640c8
104 changed files with 1245 additions and 0 deletions

7
LICENSE.md Normal file

@ -0,0 +1,7 @@
Copyright 2019 TwigGlenn4
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

69
README.md Normal file

@ -0,0 +1,69 @@
# Resource Crops
Resource Crops is a mod made by TwigGlenn4 that adds crops that grow resources to [Minetest](https://www.minetest.net/),
a free and open source infinite world block sandbox game. This mod was inspired by the Mystical Agricutlure mod for Minecraft.
## Suggestions
You should install a crafting guide mod, such as [Unified Inventory](https://forum.minetest.net/viewtopic.php?t=3933)
Growing crops takes time, and getting higher teir crops is a very slow process.
If you do not want to wait as long, you can change the settings:
```
resourcecrops_growth_interval (growth interval) = 30
resourcecrops_growth_chance (growth chance) = 2
```
## Items & Nodes
### Essence Ore
Essence Ore is found between depths of -5 and -5000.
### Essence Harvester
The Essence Harvester will harvest a resource crop of any type, dropping the items under it on the crop. It must be placed above the crop it will harvest.
### Seeds
Seeds are placed on farmland, only grow when it is wet, and can be crafted into it's respective essence.
### Essences
Essences are usually crafted into their results by filling the crafting grid.
### Elements
Mostly used as another way to get misc items. Fire essence can be crafted with an item to smelt it,
but this only works with ores for the metals that have crops and all smelting recipies from *minetest_game*
### Inferno Stone
The Inferno Stone can be crafted with an item to get the twice the result of smelting that item, and you get the Inferno Stone back.
This only works on the same items as fire essence.
### Crops
Crops require a light level of at least 8, so they can grow in torchlight. You can punch a crop to harvest it,
which drops it's items and resets the crop to it's first growth level.
## Config
The options have short descriptions found in the client interface settings or [`settingtypes.txt`](settingtypes.txt)
To change the config options of this mod, you have two options:
### Client Interface
1. With Minetest running, click the menu tab called "Settings".
2. Click the "Advanced Setting".
3. Open the "Mods" section.
4. Open the "resource_crops" subsection.
5. Change values as you wish!
### Text Editor & Server
1. Find "resourcecrops" in your "mods" folder.
2. Open "settingtypes.txt", copy options you want to change, but not the lines starting with "#".
3. Find "minetest.conf" in minetest's main folder, it might be beside the "mods" folder.
4. Paste the options you copied into minetest.conf, change them to your liking.
## Compat
### Mods
This mod alters the growth of crops from the *farming* mod in *minetest_game*. Cotton and wheat now have a 4-step growth cycle like the other added crops.
If [More Ores](https://forum.minetest.net/viewtopic.php?t=549)
or [Technic](https://forum.minetest.net/viewtopic.php?t=2538)
are installed, their respective crops can be grown. if not, the crops are automatically disabled.
### Minetest
This mod works on minetest 0.4.16 and is compatible with the 5.0.0 update.
It might work on older versions if the required dependencies are installed, but I cannot guarantee it.
## License
- Resource Crops is licensed with the MIT license, see
[`LICENSE.md`](LICENSE.md) for details.

66
base.lua Normal file

@ -0,0 +1,66 @@
--Essence ore
if resourcecrops.settings.essence_ore then
minetest.register_node("resource_crops:essence_ore", {
description = "Essence Ore",
tiles = {"default_stone.png^resource_crops_essence_ore.png"},
groups = {cracky = 2},
drop = "resource_crops:essence_dust",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "scatter",
ore = "resource_crops:essence_ore",
wherein = "default:stone",
clust_scarcity = 10*10*10,
clust_num_ores = 4,
clust_size = 4,
y_min = -5000,
y_max = -5,
})
end
--Essence harvester
if resourcecrops.settings.essence_harvester then
minetest.register_node("resource_crops:essence_harvester", {
description = "Essence Harvester",
tiles = {"resource_crops_essence_harvester.png", "resource_crops_essence_harvester_bottom.png",
"resource_crops_essence_harvester.png", "resource_crops_essence_harvester.png",
"resource_crops_essence_harvester.png", "resource_crops_essence_harvester.png"},
light_source = 10,
groups = {cracky = 2},
})
minetest.register_craft({
output = "resource_crops:essence_harvester",
recipe = {
{"default:diamond", "default:steel_ingot", "default:diamond"},
{"default:steel_ingot", "resource_crops:essence_block", "default:steel_ingot"},
{"default:diamond", "default:steel_ingot", "default:diamond"}
}
})
minetest.register_abm({
nodenames = {"resource_crops:essence_harvester"},
neighbors = {"group:resourceplant"},
interval = 5,
chance = 1,
action = function(pos)
pos.y = pos.y - 1
local plant = minetest.get_node(pos)
local plant_pos = pos
if resourcecrops.check_crop_node(pos) then
resourcecrops.harvest_crop(pos)
end
end,
})
end
--Punch crop to harvest it.
if resourcecrops.settings.punch_harvest then
minetest.register_on_punchnode(function(pos)
if resourcecrops.check_crop_node(pos) then
resourcecrops.harvest_crop(pos)
end
end)
end
minetest.register_alias_force("resourcecrops:essence_harvester", "resource_crops:essence_harvester")

6
depends.txt Normal file

@ -0,0 +1,6 @@
farming
bucket
moreores?
technic_worldgen?
technic?
terumet?

10
description.txt Normal file

@ -0,0 +1,10 @@
Resource Crops adds crops to to grow many materials, mainly focused on ores.
This mod also adds elements for crafting miscellaneous items and nodes.
Made by TwigGlenn4
Completely inspired by Mark719's Magical Crops mod.
Some of the code is edited from PilzAdam's "FarmingPlus" mod.
Textures are completely made by me, TwigGlenn4.
v1.2.2 fixes crafting obsidian from fire, earth, and water essences.

245
elements.lua Normal file

@ -0,0 +1,245 @@
--EARTH--
resourcecrops.add_crop("Earth", "earth", "extreme", "group:stone", nil)
--NATURE--
minetest.register_craftitem("resource_crops:grass_seed", {
description = ("Grass Seed"),
inventory_image = "resource_crops_grass_seed.png",
})
resourcecrops.add_crop("Nature", "nature", "extreme", "group:leaves", "resource_crops:grass_seed")
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
if node.name == "default:dirt" then
local puncher_name = puncher:get_player_name()
local item = puncher:get_wielded_item()
if item:get_name() == "resource_crops:grass_seed" then
minetest.set_node(pos, {name="default:dirt_with_grass"})
if not (creative and creative.is_enabled_for and creative.is_enabled_for(puncher:get_player_name())) then
item:take_item()
puncher:set_wielded_item(item)
end
end
end
end)
--WATER--
resourcecrops.add_crop("Water", "water", "extreme", nil, "default:snow 9")
minetest.register_craft({
output = "resource_crops:water_seed",
recipe = {{"bucket:bucket_water", "resource_crops:essence_extreme", "bucket:bucket_water"},
{"resource_crops:essence_extreme", "resource_crops:essence_seed", "resource_crops:essence_extreme"},
{"bucket:bucket_water", "resource_crops:essence_extreme", "bucket:bucket_water"}},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}, {"bucket:bucket_water", "bucket:bucket_empty"}, {"bucket:bucket_water", "bucket:bucket_empty"}, {"bucket:bucket_water", "bucket:bucket_empty"}}
})
minetest.register_craft({
output = "resource_crops:water_seed",
recipe = {{"bucket:bucket_river_water", "resource_crops:essence_extreme", "bucket:bucket_river_water"},
{"resource_crops:essence_extreme", "resource_crops:essence_seed", "resource_crops:essence_extreme"},
{"bucket:bucket_river_water", "resource_crops:essence_extreme", "bucket:bucket_river_water"}},
replacements = {{"bucket:bucket_river_water", "bucket:bucket_empty"}, {"bucket:bucket_river_water", "bucket:bucket_empty"}, {"bucket:bucket_river_water", "bucket:bucket_empty"}, {"bucket:bucket_river_water", "bucket:bucket_empty"}}
})
--FIRE--
resourcecrops.add_crop("Fire", "fire", "extreme", nil, "fire:permanent_flame")
minetest.register_craft({
output = "resource_crops:fire_seed",
recipe = {{"bucket:bucket_lava", "resource_crops:essence_extreme", "bucket:bucket_lava"},
{"resource_crops:essence_extreme", "resource_crops:essence_seed", "resource_crops:essence_extreme"},
{"bucket:bucket_lava", "resource_crops:essence_extreme", "bucket:bucket_lava"}},
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}, {"bucket:bucket_lava", "bucket:bucket_empty"}, {"bucket:bucket_lava", "bucket:bucket_empty"}, {"bucket:bucket_lava", "bucket:bucket_empty"}}
})
local function fire_essence_smelt(input, result)
minetest.register_craft({
output = result,
recipe = {{"resource_crops:fire_essence", input}}
})
minetest.register_craft({
output = result.." 2",
recipe = {{"resource_crops:inferno_stone", input}},
replacements = {{"resource_crops:inferno_stone", "resource_crops:inferno_stone"}}
})
end
--CRAFTING--
--NATURE--
minetest.register_craft({
type = "shapeless",
output = "default:dirt_with_grass",
recipe = {"resource_crops:grass_seed", "resource_crops:grass_seed"}
})
minetest.register_craft({
type = "shapeless",
output = "farming:wheat 9",
recipe = {"resource_crops:nature_essence", "resource_crops:nature_essence"}
})
minetest.register_craft({
type = "shapeless",
output = "farming:cotton 9",
recipe = {"resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence"}
})
minetest.register_craft({
type = "shapeless",
output = "default:sapling 9",
recipe = {"resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence"}
})
minetest.register_craft({
type = "shapeless",
output = "default:papyrus 9",
recipe = {"resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence"}
})
minetest.register_craft({
type = "shapeless",
output = "default:leaves 18",
recipe = {"resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence"}
})
minetest.register_craft({
type = "shapeless",
output = "default:tree 9",
recipe = {"resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence", "resource_crops:nature_essence"}
})
--EARTH--
minetest.register_craft({
output = "default:dirt 36",
recipe = {{"resource_crops:earth_essence", "resource_crops:earth_essence"},
{"resource_crops:earth_essence", "resource_crops:earth_essence"}}
})
minetest.register_craft({
output = "default:gravel 36",
recipe = {{"", "resource_crops:earth_essence", ""},
{"resource_crops:earth_essence", "", "resource_crops:earth_essence"},
{"", "resource_crops:earth_essence", ""}}
})
minetest.register_craft({
output = "default:sandstone 18",
recipe = {{"", "resource_crops:earth_essence", "resource_crops:earth_essence"},
{"resource_crops:earth_essence", "resource_crops:earth_essence", "resource_crops:earth_essence"}}
})
minetest.register_craft({
output = "default:desert_sandstone 18",
recipe = {{"resource_crops:earth_essence", "", "resource_crops:earth_essence"},
{"resource_crops:earth_essence", "resource_crops:earth_essence", "resource_crops:earth_essence"}}
})
minetest.register_craft({
output = "default:silver_sandstone 18",
recipe = {{"resource_crops:earth_essence", "resource_crops:earth_essence", ""},
{"resource_crops:earth_essence", "resource_crops:earth_essence", "resource_crops:earth_essence"}}
})
minetest.register_craft({
output = "default:stone 18",
recipe = {{"", "resource_crops:earth_essence", "resource_crops:earth_essence"},
{"resource_crops:earth_essence", "resource_crops:earth_essence", "resource_crops:earth_essence"},
{"resource_crops:earth_essence", "resource_crops:earth_essence", "resource_crops:earth_essence"}}
})
minetest.register_craft({
output = "default:desert_stone 18",
recipe = {{"resource_crops:earth_essence", "resource_crops:earth_essence", ""},
{"resource_crops:earth_essence", "resource_crops:earth_essence", "resource_crops:earth_essence"},
{"resource_crops:earth_essence", "resource_crops:earth_essence", "resource_crops:earth_essence"}}
})
--WATER--
minetest.register_craft({
output = "bucket:bucket_water",
recipe = {{"resource_crops:water_essence", "resource_crops:water_essence", "resource_crops:water_essence"},
{"resource_crops:water_essence", "resource_crops:water_essence", "resource_crops:water_essence"},
{"resource_crops:water_essence", "bucket:bucket_empty", ""}}
})
minetest.register_craft({
output = "bucket:bucket_river_water",
recipe = {{"resource_crops:water_essence", "resource_crops:water_essence", "resource_crops:water_essence"},
{"resource_crops:water_essence", "resource_crops:water_essence", "resource_crops:water_essence"},
{"", "bucket:bucket_empty", "resource_crops:water_essence"}}
})
--FIRE--
minetest.register_craftitem("resource_crops:inferno_stone", {
description = ("Inferno Stone"),
inventory_image = "resource_crops_inferno_stone.png",
stack_max = 1,
})
minetest.register_craft({
output = "bucket:bucket_lava",
recipe = {{"resource_crops:fire_essence", "resource_crops:fire_essence", "resource_crops:fire_essence"},
{"resource_crops:fire_essence", "resource_crops:fire_essence", "resource_crops:fire_essence"},
{"resource_crops:fire_essence", "bucket:bucket_empty", "resource_crops:fire_essence"}}
})
minetest.register_craft({
output = "default:torch 18",
recipe = {{"resource_crops:fire_essence"},
{"default:stick"}}
})
minetest.register_craft({
output = "resource_crops:inferno_stone",
recipe = {{"resource_crops:fire_essence", "resource_crops:essence_block", "resource_crops:fire_essence"},
{"bucket:bucket_lava", "default:stone", "bucket:bucket_lava"},
{"resource_crops:fire_essence", "resource_crops:essence_block", "resource_crops:fire_essence"}},
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}, {"bucket:bucket_lava", "bucket:bucket_empty"}}
})
--MIX--
minetest.register_craft({
output = "default:obsidian 9",
recipe = {{"resource_crops:fire_essence", "resource_crops:fire_essence", "resource_crops:fire_essence"},
{"resource_crops:earth_essence", "resource_crops:earth_essence", "resource_crops:earth_essence"},
{"resource_crops:water_essence", "resource_crops:water_essence", "resource_crops:water_essence"}}
})
minetest.register_craft({
output = "default:clay 36",
recipe = {{"resource_crops:earth_essence", "resource_crops:water_essence"},
{"resource_crops:water_essence", "resource_crops:earth_essence"}}
})
minetest.register_craft({
output = "default:clay 36",
recipe = {{"resource_crops:water_essence", "resource_crops:earth_essence"},
{"resource_crops:earth_essence", "resource_crops:water_essence"}}
})
minetest.register_craft({
output = "default:sand 36",
recipe = {{"resource_crops:fire_essence", "resource_crops:earth_essence"},
{"resource_crops:earth_essence", "resource_crops:fire_essence"}}
})
minetest.register_craft({
output = "default:sand 36",
recipe = {{"resource_crops:earth_essence", "resource_crops:fire_essence"},
{"resource_crops:fire_essence", "resource_crops:earth_essence"}}
})
minetest.register_craft({
type = "fuel",
recipe = "resource_crops:fire_essence",
burntime = 60,
})
--FIRE ESSENCE SMELTING--
fire_essence_smelt("default:clay_lump", "default:clay_brick")
fire_essence_smelt("default:copper_lump", "default:copper_ingot")
fire_essence_smelt("default:tin_lump", "default:tin_ingot")
fire_essence_smelt("default:iron_lump", "default:iron_ingot")
fire_essence_smelt("default:gold_lump", "default:gold_ingot")
fire_essence_smelt("default:cobble", "default:stone")
fire_essence_smelt("default:mossy_cobble", "default:stone")
fire_essence_smelt("default:desert_cobble", "default:desert_stone")
fire_essence_smelt("group:sand", "default:glass")
fire_essence_smelt("default:obsidian_shard", "default:obsidian_glass")
fire_essence_smelt("default:key", "default:gold_ingot")
fire_essence_smelt("default:skeleton_key", "default:gold_ingot")
if resourcecrops.has_moreores then
fire_essence_smelt("moreores:silver_lump", "moreores:silver_ingot")
fire_essence_smelt("moreores:mithril_lump", "moreores:mithril_ingot")
end
if resourcecrops.has_technic_ores then
fire_essence_smelt("technic:uranium_lump", "technic:uranium_ingot")
fire_essence_smelt("technic:chromium_lump", "technic:chromium_ingot")
fire_essence_smelt("technic:zinc_lump", "technic:zinc_ingot")
fire_essence_smelt("technic:lead_lump", "technic:lead_ingot")
fire_essence_smelt("default:iron_ingot", "technic:cast_iron_ingot")
fire_essence_smelt("technic:cast_iron_ingot", "default:iron_ingot")
fire_essence_smelt("technic:carbon_steel_ingot", "default:iron_ingot")
end

209
essence.lua Normal file

@ -0,0 +1,209 @@
--reused resourcecrops.add_crop code because of drop changes.
--Seed
minetest.register_craftitem("resource_crops:essence_seed", {
description = ("Essence Seeds"),
inventory_image = "resource_crops_essence_seed.png",
groups = {essence_seed = 1},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "resource_crops:essencecrop_1")
end
})
--Crop Step 1
minetest.register_node("resource_crops:essencecrop_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"resource_crops_crop_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+1/4, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
--Crop Step 2
minetest.register_node("resource_crops:essencecrop_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"resource_crops_crop_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+1/4, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
--Crop Step 4
minetest.register_node("resource_crops:essencecrop_3", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"resource_crops_crop_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+1/4, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
--Crop Full Grown
minetest.register_node("resource_crops:essencecrop", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"resource_crops_essence_crop.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+1/4, 0.5}
},
},
drop = {
max_items = 4,
items = {
{ items = {"resource_crops:essence_seed"} },
{ items = {"resource_crops:essence_seed"}, rarity = 30},
{ items = {"resource_crops:essence_dust"} },
{ items = {"resource_crops:essence_dust"}, rarity = 30}
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1, resourceplant=1,},
sounds = default.node_sound_leaves_defaults(),
})
--Register Items
minetest.register_craftitem("resource_crops:essence_dust", {
description = ("Essence Dust"),
groups = {magic_essence = 1},
inventory_image = "resource_crops_essence_dust.png"
})
--Add Plant
farming.add_plant("resource_crops:essencecrop", {"resource_crops:essencecrop_1", "resource_crops:essencecrop_2", "resource_crops:essencecrop_3"})
--Register essences
minetest.register_craftitem("resource_crops:essence_weak", {
description = ("Weak Essence"),
groups = {magic_essence = 1, essence = 1},
inventory_image = "resource_crops_essence_weak.png"
})
minetest.register_craftitem("resource_crops:essence_regular", {
description = ("Regular Essence"),
groups = {magic_essence = 1, essence = 1},
inventory_image = "resource_crops_essence_regular.png"
})
minetest.register_craftitem("resource_crops:essence_strong", {
description = ("Strong Essence"),
groups = {magic_essence = 1, essence = 1},
inventory_image = "resource_crops_essence_strong.png"
})
minetest.register_craftitem("resource_crops:essence_extreme", {
description = ("Extreme Essence"),
groups = {magic_essence = 1, essence = 1},
inventory_image = "resource_crops_essence_extreme.png"
})
minetest.register_node("resource_crops:essence_block", {
description = "Essence Block",
tiles = {"resource_crops_essence_block.png"},
groups = {snappy=1,oddly_breakable_by_hand=2},
})
--Register Recipies
minetest.register_craft({
output = "resource_crops:essence_weak",
recipe = {
{"", "resource_crops:essence_dust", ""},
{"resource_crops:essence_dust", "resource_crops:upgrade_stone_weak", "resource_crops:essence_dust"},
{"", "resource_crops:essence_dust", ""}
},
replacements = {{"resource_crops:upgrade_stone_weak", "resource_crops:upgrade_stone_weak"}},
})
minetest.register_craft({
output = "resource_crops:essence_regular",
recipe = {
{"", "resource_crops:essence_weak", ""},
{"resource_crops:essence_weak", "resource_crops:upgrade_stone_regular", "resource_crops:essence_weak"},
{"", "resource_crops:essence_weak", ""}
},
replacements = {{"resource_crops:upgrade_stone_regular", "resource_crops:upgrade_stone_regular"}},
})
minetest.register_craft({
output = "resource_crops:essence_strong",
recipe = {
{"", "resource_crops:essence_regular", ""},
{"resource_crops:essence_regular", "resource_crops:upgrade_stone_strong", "resource_crops:essence_regular"},
{"", "resource_crops:essence_regular", ""}
},
replacements = {{"resource_crops:upgrade_stone_strong", "resource_crops:upgrade_stone_strong"}},
})
minetest.register_craft({
output = "resource_crops:essence_extreme",
recipe = {
{"", "resource_crops:essence_strong", ""},
{"resource_crops:essence_strong", "resource_crops:upgrade_stone_extreme", "resource_crops:essence_strong"},
{"", "resource_crops:essence_strong", ""}
},
replacements = {{"resource_crops:upgrade_stone_extreme", "resource_crops:upgrade_stone_extreme"}},
})
minetest.register_craft({
output = "resource_crops:essence_block",
recipe = {
{"resource_crops:essence_regular", "resource_crops:essence_extreme", "resource_crops:essence_regular"},
{"resource_crops:essence_extreme", "resource_crops:upgrade_stone_extreme", "resource_crops:essence_extreme"},
{"resource_crops:essence_regular", "resource_crops:essence_extreme", "resource_crops:essence_regular"}
},
replacements = {{"resource_crops:upgrade_stone_extreme", "resource_crops:upgrade_stone_extreme"}},
})
--Essence Downgrades
minetest.register_craft({
output = 'resource_crops:essence_regular 89',
recipe = {{'resource_crops:essence_block'}}
})
minetest.register_craft({
output = "resource_crops:essence_strong 9",
recipe = {{"resource_crops:essence_extreme"}}
})
minetest.register_craft({
output = "resource_crops:essence_regular 9",
recipe = {{"resource_crops:essence_strong"}}
})
minetest.register_craft({
output = "resource_crops:essence_weak 9",
recipe = {{"resource_crops:essence_regular"}}
})
minetest.register_craft({
output = "resource_crops:essence_dust 9",
recipe = {{"resource_crops:essence_weak"}}
})
minetest.register_craft({
output = "resource_crops:essence_dust",
recipe = {{"resource_crops:essence_seed"}}
})
print("essence seed")
minetest.register_craft({
output = "resource_crops:essence_seed",
recipe = {
{"resource_crops:essence_dust", "resource_crops:essence_weak", "resource_crops:essence_dust"},
{"resource_crops:essence_weak", "group:seed" , "resource_crops:essence_weak"},
{"resource_crops:essence_dust", "resource_crops:essence_weak", "resource_crops:essence_dust"}
}
})

35
farming.lua Normal file

@ -0,0 +1,35 @@
-- Re-register wheat and cotton from the farming mod included in minetest-game so they grow.
--Cotton
farming.add_plant("farming:cotton_8", {"farming:cotton_2", "farming:cotton_4", "farming:cotton_6"})
minetest.override_item("farming:seed_cotton", {
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_2")
end
})
--Wheat
farming.add_plant("farming:wheat_8", {"farming:wheat_2", "farming:wheat_4", "farming:wheat_6"})
minetest.override_item("farming:seed_wheat", {
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_2")
end
})
minetest.register_abm({
nodenames = {"farming:seed_cotton"},
interval = 1,
chance = 1,
action = function(pos)
minetest.set_node(pos, {name="farming:cotton_2"})
end
})
minetest.register_abm({
nodenames = {"farming:seed_wheat"},
interval = 1,
chance = 1,
action = function(pos)
minetest.set_node(pos, {name="farming:wheat_2"})
end
})

65
init.lua Normal file

@ -0,0 +1,65 @@
resourcecrops = {}
local modname = minetest.get_current_modname()
resourcecrops.path = minetest.get_modpath(modname)
local function runfile(file)
dofile(resourcecrops.path .. "/" .. file .. ".lua")
end
runfile("lib")
runfile("settings")
--FIX FARMING MOD CROPS
runfile("farming")
--ESSENCE--
runfile("essence")
--UPGRADE STONES--
runfile("upgrade_stones")
--BASE--
runfile("base")
if resourcecrops.settings.elements then
runfile("elements")
end
if resourcecrops.settings.crop_coal then
resourcecrops.add_crop("Coal", "coal", "weak", "default:coal_lump", "default:coal_lump 2")
end if resourcecrops.settings.crop_tin then
resourcecrops.add_crop("Tin", "tin", "weak", "default:tin_ingot", "default:tin_lump 2")
end if resourcecrops.settings.crop_copper then
resourcecrops.add_crop("Copper", "copper", "regular", "default:copper_ingot", "default:copper_lump 2")
end if resourcecrops.settings.crop_iron then
resourcecrops.add_crop("Iron", "iron", "regular", "default:iron_ingot", "default:iron_lump 2")
end if resourcecrops.settings.crop_gold then
resourcecrops.add_crop("Gold", "gold", "strong", "default:gold_ingot", "default:gold_lump 2")
end if resourcecrops.settings.crop_diamond then
resourcecrops.add_crop("Diamond", "diamond", "extreme", "default:diamond", "default:diamond")
end if resourcecrops.settings.crop_mese then
resourcecrops.add_crop("Mese", "mese", "strong", "default:mese_crystal", "default:mese_crystal")
end
if resourcecrops.settings.crop_silver then
resourcecrops.add_crop("Silver", "silver", "regular", "moreores:silver_ingot", "moreores:silver_lump 2")
end if resourcecrops.settings.crop_mithril then
resourcecrops.add_crop("Mithril", "mithril", "strong", "moreores:mithril_ingot", "moreores:mithril_lump 2")
end
if resourcecrops.settings.crop_brass then
resourcecrops.add_crop("Brass", "brass", "regular", "technic:brass_ingot", "technic:brass_ingot 2")
end if resourcecrops.settings.crop_cast_iron then
resourcecrops.add_crop("Cast Iron", "cast_iron", "regular", "technic:cast_iron_ingot", "technic:cast_iron_ingot 2")
end if resourcecrops.settings.crop_carbon_steel then
resourcecrops.add_crop("Carbon Steel", "carbon_steel", "strong", "technic:carbon_steel_ingot", "technic:carbon_steel_ingot")
end if resourcecrops.settings.crop_chromium then
resourcecrops.add_crop("Chromium", "chromium", "regular", "technic:chromium_ingot", "technic:chromium_lump 2")
end if resourcecrops.settings.crop_lead then
resourcecrops.add_crop("Lead", "lead", "regular", "technic:lead_ingot", "technic:lead_lump 2")
end if resourcecrops.settings.crop_sulfur then
resourcecrops.add_crop("Suflur", "sulfur", "weak", "technic:sulfur_lump", "technic:sulfur_lump 2")
end if resourcecrops.settings.crop_uranium then
resourcecrops.add_crop("Uranium", "uranium", "extreme", "technic:uranium_ingot", "technic:uranium_lump 2")
end if resourcecrops.settings.crop_zinc then
resourcecrops.add_crop("Zinc", "zinc", "regular", "technic:zinc_ingot", "technic:zinc_lump 2")
end if resourcecrops.settings.crop_rubber then
resourcecrops.add_crop("Rubber", "rubber", "regular", "technic:rubber", "technic:rubber 3")
end if resourcecrops.settings.crop_terumet then
resourcecrops.add_crop("Terumetal", "terumetal", "strong", "terumet:lump_raw", "terumet:lump_raw 2")
end
print("Resource Crops loaded!")

301
lib.lua Normal file

@ -0,0 +1,301 @@
--Register an alias for steel ingot and undo technic's name change.
minetest.register_alias("default:iron_ingot", "default:steel_ingot")
if resourcecrops.has_technic then
minetest.override_item("default:iron_ingot", { description = "Steel Ingot" })
end
--Harvest and replant a crop, drop it's items.
function resourcecrops.harvest_crop(pos)
local plant = minetest.get_node(pos)
local plant_type = plant.name:gsub("resource_crops:", ""):gsub("crop", "")
local crop_essence
if plant_type == "essence" then
crop_essence = "resource_crops:essence_dust"
end
if plant_type ~= "essence" then
crop_essence = "resource_crops:"..plant_type.."_essence"
end
minetest.set_node(pos, {name=plant.name.."_1"})
local itemstacks = minetest.get_node_drops(plant.name)
for _, itemname in ipairs(itemstacks) do
minetest.add_item(pos, itemname)
end
end
--Check if the node is a crop. true/false.
function resourcecrops.check_crop_node(pos)
local node = minetest.get_node(pos)
local node_names = {}
for str in string.gmatch(node.name, "([^:]+)") do
table.insert(node_names, str)
end
local node_mod = node_names[1]
local node_name = node_names[2]
if node_mod == "resource_crops" then
if string.sub(node_name, -4) == "crop" then
return true
else
return false
end
else
return false
end
end
--Rewrite the farming mod's add plant function.
function farming.add_plant(full_grown, names)
local interval = resourcecrops.settings.growth_interval
local chance = resourcecrops.settings.growth_chance
local all_names = names
table.insert(all_names, full_grown)
minetest.register_abm({
nodenames = all_names,
interval = 1,
chance = 1,
action = function(pos)
local plant = minetest.get_node(pos)
pos.y = pos.y - 1
local under = minetest.get_node(pos)
pos.y = pos.y + 1
if under.name == "air" then
local plant_type = plant.name:gsub("resource_crops:", ""):gsub("crop", "")
if string.sub(string.sub(plant_type, -2), 0, 1) ~= "_" then
resourcecropsharvest_crop()
end
minetest.remove_node(pos)
end
end,
})
minetest.register_abm({
nodenames = names,
interval = interval,
chance = chance,
action = function(pos, node)
pos.y = pos.y-1
if minetest.get_node(pos).name ~= "farming:soil_wet" then
return
end
pos.y = pos.y+1
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) < 8 then
return
end
local step = nil
for i,name in ipairs(names) do
if name == node.name then
step = i
break
end
end
if step == nil then
return
end
local new_node = {name=names[step+1]}
if new_node.name == nil then
new_node.name = full_grown
end
minetest.set_node(pos, new_node)
end
})
table.insert(farming.registered_plants, {
full_grown = full_grown,
names = names,
interval = interval,
chance = chance,
})
end
--Start a plant when seed is placed.
function farming.place_seed(itemstack, placer, pointed_thing, plantname)
-- Call on_rightclick if the pointed node defines it
if pointed_thing.type == "node" and placer and
not placer:get_player_control().sneak then
local n = minetest.get_node(pointed_thing.under)
local nn = n.name
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].on_rightclick then
return minetest.registered_nodes[nn].on_rightclick(pointed_thing.under, n,
placer, itemstack, pointed_thing) or itemstack, false
end
end
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
return
end
-- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") < 2 then
return
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name=plantname, param2 = 1})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
--Add a resource crop.
function resourcecrops.add_crop(visible_name, resource_name, essence_type, recipe_input, recipe_output)
--Seed
minetest.register_craftitem("resource_crops:"..resource_name.."_seed", {
description = (visible_name.." Seeds"),
inventory_image = "resource_crops_"..resource_name.."_seed.png",
groups = {essence_seed = 1},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "resource_crops:"..resource_name.."crop_1")
end
})
--Crop Step 1
minetest.register_node("resource_crops:"..resource_name.."crop_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"resource_crops_crop_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+1/4, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
--Crop Step 2
minetest.register_node("resource_crops:"..resource_name.."crop_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"resource_crops_crop_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+1/4, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
--Crop Step 3
minetest.register_node("resource_crops:"..resource_name.."crop_3", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"resource_crops_crop_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+1/4, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
--Crop Full Grown
minetest.register_node("resource_crops:"..resource_name.."crop", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"resource_crops_"..resource_name.."_crop.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+1/4, 0.5}
},
},
drop = {
max_items = 4,
items = {
{ items = {"resource_crops:"..resource_name.."_seed"} },
{ items = {"resource_crops:"..resource_name.."_seed"}, rarity = 30},
{ items = {"resource_crops:"..resource_name.."_essence"} },
{ items = {"resource_crops:"..resource_name.."_essence"}, rarity = 30}
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1, resourceplant=1,},
sounds = default.node_sound_leaves_defaults(),
})
local essence_groups = {}
essence_groups["essence"] = 1
essence_groups["essence_"..essence_type] = 1
--Register Essence
minetest.register_craftitem("resource_crops:"..resource_name.."_essence", {
description = (visible_name.." Essence"),
inventory_image = "resource_crops_"..resource_name.."_essence.png",
groups = essence_groups
})
--Register Recipies
if recipe_output then
minetest.register_craft({
output = recipe_output,
recipe = {{"resource_crops:"..resource_name.."_essence", "resource_crops:"..resource_name.."_essence", "resource_crops:"..resource_name.."_essence"},
{"resource_crops:"..resource_name.."_essence", "resource_crops:"..resource_name.."_essence", "resource_crops:"..resource_name.."_essence"},
{"resource_crops:"..resource_name.."_essence", "resource_crops:"..resource_name.."_essence", "resource_crops:"..resource_name.."_essence"}}
})
end
if recipe_input then
minetest.register_craft({
output = "resource_crops:"..resource_name.."_seed",
recipe = {{recipe_input, "resource_crops:essence_"..essence_type, recipe_input},
{"resource_crops:essence_"..essence_type, "resource_crops:essence_seed", "resource_crops:essence_"..essence_type},
{recipe_input, "resource_crops:essence_"..essence_type, recipe_input}}
})
end
minetest.register_craft({
output = "resource_crops:"..resource_name.."_essence",
recipe = {
{"resource_crops:"..resource_name.."_seed"}
}
})
--Add Plant
farming.add_plant("resource_crops:"..resource_name.."crop", {"resource_crops:"..resource_name.."crop_1", "resource_crops:"..resource_name.."crop_2", "resource_crops:"..resource_name.."crop_3"})
minetest.register_alias_force("resourcecrops:"..resource_name.."_seed", "resource_crops:"..resource_name.."_seed")
minetest.register_alias_force("resourcecrops:"..resource_name.."crop_1", "resource_crops:"..resource_name.."crop_1")
minetest.register_alias_force("resourcecrops:"..resource_name.."crop_2", "resource_crops:"..resource_name.."crop_2")
minetest.register_alias_force("resourcecrops:"..resource_name.."crop_3", "resource_crops:"..resource_name.."crop_3")
minetest.register_alias_force("resourcecrops:"..resource_name.."crop", "resource_crops:"..resource_name.."crop")
minetest.register_alias_force("resourcecrops:"..resource_name.."_essence", "resource_crops:"..resource_name.."_essence")
end

6
mod.conf Normal file

@ -0,0 +1,6 @@
name = resource_crops
description = Adds crops to to grow many materials, mainly focused on ores. This mod also adds elements for crafting miscellaneous items and nodes. Created by TwigGlenn4.
depends = farming, bucket
optional_depends = moreores, technic_worldgen, technic
author = TwigGlenn4
title = Resource Crops

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

BIN
resource_crops_crop_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
resource_crops_crop_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

BIN
resource_crops_crop_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

BIN
resource_crops_tin_crop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

BIN
resource_crops_tin_seed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Some files were not shown because too many files have changed in this diff Show More