Adde Basic farming
@ -683,6 +683,12 @@ minetest.register_craft({
|
||||
{"default:clay_brick","default:clay_brick"},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:stone",
|
||||
recipe = "default:stone_macadam",
|
||||
cooktime = 8,
|
||||
})
|
||||
|
||||
--
|
||||
-- Global callbacks
|
||||
|
2
mods/farming/depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
default
|
||||
trees
|
374
mods/farming/init.lua
Normal file
@ -0,0 +1,374 @@
|
||||
--
|
||||
--Flax Registry
|
||||
--
|
||||
|
||||
for i=1,4 do
|
||||
local drop = {
|
||||
items = {
|
||||
{items = {'farming:string'},rarity=9-i},
|
||||
{items = {'farming:string'},rarity=18-i*2},
|
||||
{items = {'farming:string'},rarity=27-i*3},
|
||||
{items = {'farming:seed_flax'},rarity=9-i},
|
||||
{items = {'farming:seed_flax'},rarity=18-i*2},
|
||||
{items = {'farming:seed_flax'},rarity=27-i*3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:flax_"..i, {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_flax_"..i..".png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = drop,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
groups = {snappy=3,flammable=2,plant=1,flax=i,not_in_creative_inventory=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("farming:seed_flax", {
|
||||
drawtype = "raillike",
|
||||
description = "Flax Seeds",
|
||||
tiles = {"farming_seed_placed.png"},
|
||||
inventory_image = "farming_flax_seed.png",
|
||||
groups = {snappy=3},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.500000,-0.500000,-0.500000,0.500000,-0.3,0.500000},
|
||||
},
|
||||
},
|
||||
drop = "",
|
||||
})
|
||||
|
||||
--
|
||||
--Spelt registry
|
||||
--
|
||||
for i=1,4 do
|
||||
local drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'},rarity=9-i},
|
||||
{items = {'farming:wheat'},rarity=18-i*2},
|
||||
{items = {'farming:wheat'},rarity=27-i*3},
|
||||
{items = {'farming:seed_spelt'},rarity=9-i},
|
||||
{items = {'farming:seed_spelt'},rarity=18-i*2},
|
||||
{items = {'farming:seed_spelt'},rarity=27-i*3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:spelt_"..i, {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_spelt_"..i..".png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = drop,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
groups = {snappy=3,flammable=2,plant=1,flax=i,not_in_creative_inventory=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("farming:seed_spelt", {
|
||||
drawtype = "raillike",
|
||||
description = "Spelt (Wheat) Seeds",
|
||||
tiles = {"farming_seed_placed.png"},
|
||||
inventory_image = "farming_spelt_seed.png",
|
||||
groups = {snappy=3},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.500000,-0.500000,-0.500000,0.500000,-0.3,0.500000},
|
||||
},
|
||||
},
|
||||
drop = "",
|
||||
})
|
||||
|
||||
--
|
||||
--Seed Growing ABMs
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:seed_flax"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == "farming:soil" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="farming:flax_1"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:seed_spelt"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == "farming:soil" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="farming:spelt_1"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--
|
||||
--Plant Growing ABMs
|
||||
--
|
||||
|
||||
--Flax
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:flax_1"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == "farming:soil" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="farming:flax_2"})
|
||||
end
|
||||
end
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:flax_2"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == "farming:soil" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="farming:flax_3"})
|
||||
end
|
||||
end
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:flax_3"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == "farming:soil" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="farming:flax_4"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--Spelt
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:spelt_1"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == "farming:soil" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="farming:spelt_2"})
|
||||
end
|
||||
end
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:spelt_2"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == "farming:soil" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="farming:spelt_3"})
|
||||
end
|
||||
end
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:spelt_3"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == "farming:soil" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="farming:spelt_4"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--
|
||||
--Farming Soil registry
|
||||
--
|
||||
|
||||
minetest.register_node("farming:soil", {
|
||||
description = "Farming Soil",
|
||||
tiles = {"farming_soil.png",
|
||||
"default_dirt.png"},
|
||||
groups = {crumbly=3},
|
||||
paramtype = "light",
|
||||
drop = "default:dirt",
|
||||
})
|
||||
|
||||
--
|
||||
--Craftitem Registry
|
||||
--
|
||||
minetest.register_craftitem("farming:string", {
|
||||
description = "String",
|
||||
inventory_image = "farming_string.png",
|
||||
wield_image = "farming_string.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:wheat", {
|
||||
description = "Spelt",
|
||||
inventory_image = "farming_wheat.png",
|
||||
wield_image = "farming_wheat.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:flour", {
|
||||
description = "Pile of Flour",
|
||||
inventory_image = "farming_flour.png",
|
||||
wield_image = "farming_flour.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:bread", {
|
||||
description = "Loaf of Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
wield_image = "farming_bread.png",
|
||||
on_use=minetest.item_eat(8)
|
||||
})
|
||||
|
||||
--
|
||||
--Crafting
|
||||
--
|
||||
minetest.register_craft({
|
||||
output = "farming:flour",
|
||||
recipe = {
|
||||
{"farming:wheat","farming:wheat"},
|
||||
{"farming:wheat","farming:wheat"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "farming:bread",
|
||||
recipe = "farming:flour",
|
||||
cooktime = 30,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_head 4",
|
||||
recipe = {
|
||||
{"","default:cobble","default:cobble"},
|
||||
{"default:cobble","",""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe",
|
||||
recipe = {
|
||||
{"farming:hoe_head"},
|
||||
{"group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
--
|
||||
--The hoe (only stone for now)
|
||||
--
|
||||
minetest.register_craftitem("farming:hoe_head", {
|
||||
description = "Hoe Head",
|
||||
inventory_image = "farming_hoe_head.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:hoe", {
|
||||
description = "Hoe",
|
||||
inventory_image = "farming_hoe.png",
|
||||
})
|
||||
|
||||
--
|
||||
--Farming soil-dirt abm
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:soil"},
|
||||
interval = 30,
|
||||
chance = 3,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name == "air" then
|
||||
minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z}, {name="default:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--
|
||||
--Hoe functions
|
||||
--
|
||||
|
||||
minetest.register_node(":default:dirt", {
|
||||
description = "Dirt",
|
||||
tiles = {"default_dirt.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3,soil=1},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.25},
|
||||
}),
|
||||
on_punch = function(pos, node, puncher)
|
||||
if puncher:get_wielded_item():get_name() == "farming:hoe" then
|
||||
minetest.env:set_node(pos, {name="farming:soil"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node(":default:dirt_with_grass", {
|
||||
description = "Grass",
|
||||
tiles = {"default_dirt_grass.png",
|
||||
"default_dirt.png",
|
||||
"default_dirt_grass.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3,soil=1},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.25},
|
||||
}),
|
||||
on_punch = function(pos, node, puncher)
|
||||
if puncher:get_wielded_item():get_name() == "farming:hoe" then
|
||||
minetest.env:set_node(pos, {name="farming:soil"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
--Bird Nest
|
||||
--
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "farming:nest",
|
||||
wherein = "group:leaves",
|
||||
clust_scarcity = 10*10*10,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
height_min = -10,
|
||||
height_max = 200,
|
||||
})
|
||||
|
||||
minetest.register_node("farming:nest", {
|
||||
drawtype = "nodebox",
|
||||
description = "Bird's Nest",
|
||||
tiles = {"farming_birdnest.png"},
|
||||
groups = {snappy=3},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-3/16,-8/16,-3/16,3/16,-6/16,3/16},
|
||||
{-5/16,-6/16,-5/16,5/16,-4/16,5/16},
|
||||
{-6/16,-4/16,-6/16,6/16,-0/16,6/16},
|
||||
},
|
||||
},
|
||||
drop = {
|
||||
max_items = 2,
|
||||
items = {
|
||||
{
|
||||
items = {"farming:seed_flax"},
|
||||
rarity = 3,
|
||||
},
|
||||
{
|
||||
items = {"farming:seed_spelt"},
|
||||
rarity = 3,
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
BIN
mods/farming/textures/farming_birdnest.png
Normal file
After Width: | Height: | Size: 902 B |
BIN
mods/farming/textures/farming_bread.png
Normal file
After Width: | Height: | Size: 552 B |
BIN
mods/farming/textures/farming_flax_1.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
mods/farming/textures/farming_flax_2.png
Normal file
After Width: | Height: | Size: 206 B |
BIN
mods/farming/textures/farming_flax_3.png
Normal file
After Width: | Height: | Size: 309 B |
BIN
mods/farming/textures/farming_flax_4.png
Normal file
After Width: | Height: | Size: 394 B |
BIN
mods/farming/textures/farming_flax_seed.png
Normal file
After Width: | Height: | Size: 348 B |
BIN
mods/farming/textures/farming_flour.png
Normal file
After Width: | Height: | Size: 378 B |
BIN
mods/farming/textures/farming_hoe.png
Normal file
After Width: | Height: | Size: 396 B |
BIN
mods/farming/textures/farming_hoe_head.png
Normal file
After Width: | Height: | Size: 403 B |
BIN
mods/farming/textures/farming_seed_placed.png
Normal file
After Width: | Height: | Size: 176 B |
BIN
mods/farming/textures/farming_soil.png
Normal file
After Width: | Height: | Size: 407 B |
BIN
mods/farming/textures/farming_spelt_1.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
mods/farming/textures/farming_spelt_2.png
Normal file
After Width: | Height: | Size: 516 B |
BIN
mods/farming/textures/farming_spelt_3.png
Normal file
After Width: | Height: | Size: 458 B |
BIN
mods/farming/textures/farming_spelt_4.png
Normal file
After Width: | Height: | Size: 448 B |
BIN
mods/farming/textures/farming_spelt_seed.png
Normal file
After Width: | Height: | Size: 372 B |
BIN
mods/farming/textures/farming_string.png
Normal file
After Width: | Height: | Size: 341 B |
BIN
mods/farming/textures/farming_wheat.png
Normal file
After Width: | Height: | Size: 566 B |
@ -326,6 +326,7 @@ for i, mineral in ipairs(minerals.list) do
|
||||
type = "cooking",
|
||||
output = "metals:"..minerals.metals_list[i].."_unshaped",
|
||||
recipe = "metals:ceramic_mold_"..mineral,
|
||||
cooktime = 5,
|
||||
})
|
||||
end
|
||||
|
||||
|