Rename farming mod to mcl_farming

This commit is contained in:
Wuzzy 2017-01-31 12:35:59 +01:00
parent 89b30ae108
commit 1314e31abc
64 changed files with 193 additions and 187 deletions

View file

@ -0,0 +1,46 @@
===FARMING MOD for MINETEST-C55===
by PilzAdam
Introduction:
This mod adds farming to Minetest.
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod:
Craft a wood/stone/steel hoe:
material material
stick
stick
Dig dirt with it and turn it to soil. Water the soil and plant the seeds
you get by digging dirt with the hoe. Wait until the seeds are seasoned
and harvest them. When harvesting you will get the product and new seeds.
For further information or help see:
http://minetest.net/forum/viewtopic.php?id=2787
License:
Sourcecode: WTFPL (see below)
Graphics: WTFPL (see below)
See also:
http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View file

@ -0,0 +1,93 @@
minetest.register_node("mcl_farming:carrot_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "mcl_farming:carrot_item",
tiles = {"farming_carrot_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:carrot_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "mcl_farming:carrot_item",
tiles = {"farming_carrot_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:carrot_3", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "mcl_farming:carrot_item",
tiles = {"farming_carrot_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:carrot", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_carrot_4.png"},
drop = {
max_items = 1,
items = {
{ items = {'mcl_farming:carrot_item 4'}, rarity = 5 },
{ items = {'mcl_farming:carrot_item 3'}, rarity = 2 },
{ items = {'mcl_farming:carrot_item 2'}, rarity = 2 },
{ items = {'mcl_farming:carrot_item 1'} },
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("mcl_farming:carrot_item", {
description = "Carrot",
inventory_image = "farming_carrot.png",
on_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3 },
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:carrot_1")
end
})
minetest.register_craftitem("mcl_farming:carrot_item_gold", {
description = "Golden Carrot",
inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(3),
groups = { brewitem = 1, food = 2, eatable = 3 },
})
minetest.register_craft({
output = "mcl_farming:carrot_item_gold",
recipe = {
{'default:gold_nugget', 'default:gold_nugget', 'default:gold_nugget'},
{'default:gold_nugget', 'mcl_farming:carrot_item', 'default:gold_nugget'},
{'default:gold_nugget', 'default:gold_nugget', 'default:gold_nugget'},
}
})
mcl_farming:add_plant("mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3"}, 50, 20)

View file

@ -0,0 +1,3 @@
default
bucket
mcl_wool

219
mods/mcl_farming/hoes.lua Normal file
View file

@ -0,0 +1,219 @@
local function create_soil(pos, inv)
if pos == nil then
return false
end
local node = minetest.get_node(pos)
local name = node.name
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
if minetest.get_item_group(name, "cultivatable") == 2 then
if above.name == "air" then
node.name = "mcl_farming:soil"
minetest.set_node(pos, node)
return true
end
elseif minetest.get_item_group(name, "cultivatable") == 1 then
if above.name == "air" then
node.name = "default:dirt"
minetest.set_node(pos, node)
return true
end
end
return false
end
minetest.register_tool("mcl_farming:hoe_wood", {
description = "Wood Hoe",
inventory_image = "farming_tool_woodhoe.png",
on_place = function(itemstack, user, pointed_thing)
if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/60)
end
return itemstack
end
end,
groups = { tool=1 },
tool_capabilities = {
full_punch_interval = 1,
damage_groups = { fleshy = 1, }
},
})
minetest.register_craft({
output = "mcl_farming:hoe_wood",
recipe = {
{"group:wood", "group:wood"},
{"", "default:stick"},
{"", "default:stick"}
}
})
minetest.register_craft({
output = "mcl_farming:hoe_wood",
recipe = {
{"group:wood", "group:wood"},
{"default:stick", ""},
{"default:stick", ""}
}
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_farming:hoe_wood",
burntime = 10,
})
minetest.register_tool("mcl_farming:hoe_stone", {
description = "Stone Hoe",
inventory_image = "farming_tool_stonehoe.png",
on_place = function(itemstack, user, pointed_thing)
if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/132)
end
return itemstack
end
end,
groups = { tool=1 },
tool_capabilities = {
full_punch_interval = 0.5,
damage_groups = { fleshy = 1, }
},
})
minetest.register_craft({
output = "mcl_farming:hoe_stone",
recipe = {
{"default:cobble", "default:cobble"},
{"", "default:stick"},
{"", "default:stick"}
}
})
minetest.register_craft({
output = "mcl_farming:hoe_stone",
recipe = {
{"default:cobble", "default:cobble"},
{"default:stick", ""},
{"default:stick", ""}
}
})
minetest.register_tool("mcl_farming:hoe_steel", {
description = "Iron Hoe",
inventory_image = "farming_tool_steelhoe.png",
on_place = function(itemstack, user, pointed_thing)
if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/251)
end
return itemstack
end
end,
groups = { tool=1 },
tool_capabilities = {
-- 1/3
full_punch_interval = 0.33333333,
damage_groups = { fleshy = 1, }
},
})
minetest.register_craft({
output = "mcl_farming:hoe_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"", "default:stick"},
{"", "default:stick"}
}
})
minetest.register_craft({
output = "mcl_farming:hoe_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:stick", ""},
{"default:stick", ""}
}
})
minetest.register_craft({
type = "cooking",
output = "default:iron_nugget",
recipe = "mcl_farming:hoe_steel",
cooktime = 10,
})
minetest.register_tool("mcl_farming:hoe_gold", {
description = "Golden Hoe",
inventory_image = "farming_tool_goldhoe.png",
on_place = function(itemstack, user, pointed_thing)
if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/33)
end
return itemstack
end
end,
groups = { tool=1 },
tool_capabilities = {
full_punch_interval = 1,
damage_groups = { fleshy = 1, }
},
})
minetest.register_craft({
output = "mcl_farming:hoe_gold",
recipe = {
{"default:gold_ingot", "default:gold_ingot"},
{"", "default:stick"},
{"", "default:stick"}
}
})
minetest.register_craft({
output = "mcl_farming:hoe_gold",
recipe = {
{"default:gold_ingot", "default:gold_ingot"},
{"default:stick", ""},
{"default:stick", ""}
}
})
minetest.register_craft({
type = "cooking",
output = "default:gold_nugget",
recipe = "mcl_farming:hoe_gold",
cooktime = 10,
})
minetest.register_tool("mcl_farming:hoe_diamond", {
description = "Diamond Hoe",
inventory_image = "farming_tool_diamondhoe.png",
on_place = function(itemstack, user, pointed_thing)
if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/1562)
end
return itemstack
end
end,
groups = { tool=1 },
tool_capabilities = {
full_punch_interval = 0.25,
damage_groups = { fleshy = 1, }
},
})
minetest.register_craft({
output = "mcl_farming:hoe_diamond",
recipe = {
{"default:diamond", "default:diamond"},
{"", "default:stick"},
{"", "default:stick"}
}
})
minetest.register_craft({
output = "mcl_farming:hoe_diamond",
recipe = {
{"default:diamond", "default:diamond"},
{"default:stick", ""},
{"default:stick", ""}
}
})

95
mods/mcl_farming/init.lua Normal file
View file

@ -0,0 +1,95 @@
local init = os.clock()
mcl_farming = {}
function mcl_farming:add_plant(full_grown, names, interval, chance)
minetest.register_abm({
nodenames = names,
interval = interval,
chance = chance,
action = function(pos, node)
pos.y = pos.y-1
if minetest.get_node(pos).name ~= "mcl_farming:soil_wet" and math.random(0, 9) > 0 then
return
end
pos.y = pos.y+1
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) < 10 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
} )
end
function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
if not pt then
return
end
if pt.type ~= "node" then
return
end
local pos = {x=pt.above.x, y=pt.above.y-1, z=pt.above.z}
local farmland = minetest.get_node(pos)
pos= {x=pt.above.x, y=pt.above.y, z=pt.above.z}
local place_s = minetest.get_node(pos)
if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then
minetest.add_node(pos, {name=plantname})
else
return
end
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
-- ========= SOIL =========
dofile(minetest.get_modpath("mcl_farming").."/soil.lua")
-- ========= HOES =========
dofile(minetest.get_modpath("mcl_farming").."/hoes.lua")
-- ========= WHEAT =========
dofile(minetest.get_modpath("mcl_farming").."/wheat.lua")
-- ========= PUMPKIN =========
dofile(minetest.get_modpath("mcl_farming").."/pumpkin.lua")
-- ========= MELON =========
dofile(minetest.get_modpath("mcl_farming").."/melon.lua")
-- ========= CARROT =========
dofile(minetest.get_modpath("mcl_farming").."/carrots.lua")
-- ========= POTATOES =========
dofile(minetest.get_modpath("mcl_farming").."/potatoes.lua")
-- ========= MUSHROOMS =========
dofile(minetest.get_modpath("mcl_farming").."/mushrooms.lua")
local time_to_load= os.clock() - init
print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load))

290
mods/mcl_farming/melon.lua Normal file
View file

@ -0,0 +1,290 @@
minetest.register_node("mcl_farming:melon", {
description = "Melon",
paramtype2 = "facedir",
stack_max = 64,
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png", "farming_melon_side.png", "farming_melon_side.png", "farming_melon_side.png"},
groups = {choppy=2, oddly_breakable_by_hand=2, building_block=1},
drop = {
max_items = 1,
items = {
{ items = {'mcl_farming:melon_item 7'}, rarity = 14 },
{ items = {'mcl_farming:melon_item 6'}, rarity = 10 },
{ items = {'mcl_farming:melon_item 5'}, rarity = 5 },
{ items = {'mcl_farming:melon_item 4'}, rarity = 2 },
{ items = {'mcl_farming:melon_item 3'} },
}
},
after_dig_node = function(pos, oldnode, oldmetadata, user)
local have_change = 0
for x=-1,1 do
local p = {x=pos.x+x, y=pos.y, z=pos.z}
local n = minetest.get_node(p)
if string.find(n.name, "melontige_linked_") and have_change == 0 then
have_change = 1
minetest.add_node(p, {name="mcl_farming:melontige_unconnect"})
end
end
if have_change == 0 then
for z=-1,1 do
local p = {x=pos.x, y=pos.y, z=pos.z+z}
local n = minetest.get_node(p)
if string.find(n.name, "melontige_linked_") and have_change == 0 then
have_change = 1
minetest.add_node(p, {name="mcl_farming:melontige_unconnect"})
end
end
end
end
})
minetest.register_node("mcl_farming:melontige_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
sunlight_propagates = true,
drop = "",
tiles = {"farming_tige_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:melontige_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
sunlight_propagates = true,
drop = "",
tiles = {"farming_tige_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:melontige_unconnect", {
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "",
drawtype = "plantlike",
tiles = {"farming_tige_end.png"},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:melontige_linked_r", {
paramtype = "light",
sunlight_propagates = true,
walkable = false,
drop = "",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0.5, 0.5, 0}, -- NodeBox1
}
},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
tiles = {
"farming_tige_connnect.png", --top
"farming_tige_connnect.png", -- bottom
"farming_tige_connnect.png", -- right
"farming_tige_connnect.png", -- left
"farming_tige_connnect.png", -- back
"farming_tige_connnect.png^[transformFX90" --front
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:melontige_linked_l", {
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0.5, 0.5, 0}, -- NodeBox1
}
},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
tiles = {
"farming_tige_connnect.png", --top
"farming_tige_connnect.png", -- bottom
"farming_tige_connnect.png", -- right
"farming_tige_connnect.png", -- left
"farming_tige_connnect.png^[transformFX90", -- back
"farming_tige_connnect.png" --front
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:melontige_linked_t", {
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
node_box = {
type = "fixed",
fixed = {
{0, -0.5, -0.5, 0, 0.5, 0.5}, -- NodeBox1
}
},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
tiles = {
"farming_tige_connnect.png", --top
"farming_tige_connnect.png", -- bottom
"farming_tige_connnect.png^[transformFX90", -- right
"farming_tige_connnect.png", -- left
"farming_tige_connnect.png", -- back
"farming_tige_connnect.png" --front
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:melontige_linked_b", {
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
node_box = {
type = "fixed",
fixed = {
{0, -0.5, -0.5, 0, 0.5, 0.5}, -- NodeBox1
}
},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
tiles = {
"farming_tige_connnect.png", --top
"farming_tige_connnect.png", -- bottom
"farming_tige_connnect.png", -- right
"farming_tige_connnect.png^[transformFX90", -- left
"farming_tige_connnect.png", -- back
"farming_tige_connnect.png" --front
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("mcl_farming:melon_seed", {
description = "Melon Seeds",
stack_max = 64,
groups = { craftitem=1 },
inventory_image = "farming_melon_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:melontige_1")
end,
})
minetest.register_craftitem("mcl_farming:melon_item", {
description = "Melon",
stack_max = 64,
inventory_image = "farming_melon.png",
on_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
})
minetest.register_abm({
nodenames = {"mcl_farming:melontige_unconnect"},
neighbors = {"air"},
interval = 25,
chance = 15,
action = function(pos)
local have_change = 0
local newpos = {x=pos.x, y=pos.y, z=pos.z}
local light = minetest.get_node_light(pos)
if light or light > 10 then
for x=-1,1 do
local p = {x=pos.x+x, y=pos.y-1, z=pos.z}
newpos = {x=pos.x+x, y=pos.y, z=pos.z}
local n = minetest.get_node(p)
local nod = minetest.get_node(newpos)
if n.name=="default:dirt_with_grass" and nod.name=="air" and have_change == 0
or n.name=="default:dirt" and nod.name=="air" and have_change == 0
or string.find(n.name, "mcl_farming:soil") and nod.name=="air" and have_change == 0 then
have_change = 1
minetest.add_node(newpos, {name="mcl_farming:melon"})
if x == 1 then
minetest.add_node(pos, {name="mcl_farming:melontige_linked_r" })
else
minetest.add_node(pos, {name="mcl_farming:melontige_linked_l"})
end
end
end
if have_change == 0 then
for z=-1,1 do
local p = {x=pos.x, y=pos.y-1, z=pos.z+z}
newpos = {x=pos.x, y=pos.y, z=pos.z+z}
local n = minetest.get_node(p)
local nod2 = minetest.get_node(newpos)
if n.name=="default:dirt_with_grass" and nod2.name=="air" and have_change == 0
or n.name=="default:dirt" and nod2.name=="air" and have_change == 0
or string.find(n.name, "mcl_farming:soil") and nod2.name=="air" and have_change == 0 then
have_change = 1
minetest.add_node(newpos, {name="mcl_farming:melon"})
if z == 1 then
minetest.add_node(pos, {name="mcl_farming:melontige_linked_t" })
else
minetest.add_node(pos, {name="mcl_farming:melontige_linked_b" })
end
end
end
end
end
end,
})
mcl_farming:add_plant("mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2"}, 50, 20)
minetest.register_craft({
type = "shapeless",
output = "mcl_farming:melon_seed",
recipe = {"mcl_farming:melon_item"}
})
minetest.register_craft({
output = 'mcl_farming:melon',
recipe = {
{'mcl_farming:melon_item', 'mcl_farming:melon_item', 'mcl_farming:melon_item'},
{'mcl_farming:melon_item', 'mcl_farming:melon_item', 'mcl_farming:melon_item'},
{'mcl_farming:melon_item', 'mcl_farming:melon_item', 'mcl_farming:melon_item'},
}
})

View file

@ -0,0 +1 @@
name = mcl_farming

View file

@ -0,0 +1,48 @@
minetest.register_node("mcl_farming:mushroom_brown", {
description = "Brown Mushroom",
drawtype = "plantlike",
tiles = { "farming_mushroom_brown.png" },
inventory_image = "farming_mushroom_brown.png",
wield_image = "farming_mushroom_brown.png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,flammable=2,mushroom=1,attached_node=1,dig_by_water=1,deco_block=1},
sounds = default.node_sound_leaves_defaults(),
light_source = 1,
selection_box = {
type = "fixed",
fixed = { -0.15, -0.5, -0.15, 0.15, 0.015, 0.15 },
},
})
minetest.register_node("mcl_farming:mushroom_red", {
description = "Red Mushroom",
drawtype = "plantlike",
tiles = { "farming_mushroom_red.png" },
inventory_image = "farming_mushroom_red.png",
wield_image = "farming_mushroom_red.png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,flammable=2,mushroom=1,attached_node=1,dig_by_water=1,deco_block=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = { -0.15, -0.5, -0.15, 0.15, 0.015, 0.15 },
},
})
minetest.register_craftitem("mcl_farming:mushroom_stew", {
description = "Mushroom Stew",
inventory_image = "farming_mushroom_stew.png",
on_use = minetest.item_eat(6, "default:bowl"),
groups = { food = 2, eatable = 6 },
stack_max = 1,
})
minetest.register_craft({
type = "shapeless",
output = "mcl_farming:mushroom_stew",
recipe = {'default:bowl', 'mcl_farming:mushroom_brown', 'mcl_farming:mushroom_red'}
})

View file

@ -0,0 +1,83 @@
minetest.register_node("mcl_farming:potato_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "mcl_farming:potato_item",
tiles = {"farming_potato_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:potato_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "mcl_farming:potato_item",
tiles = {"farming_potato_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:potato", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_potato_3.png"},
drop = {
max_items = 1,
items = {
{ items = {'mcl_farming:potato_item 2'} },
{ items = {'mcl_farming:potato_item 3'}, rarity = 2 },
{ items = {'mcl_farming:potato_item 4'}, rarity = 5 }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("mcl_farming:potato_item", {
description = "Potato",
inventory_image = "farming_potato.png",
on_use = minetest.item_eat(1),
groups = { food = 2, eatable = 1 },
stack_max = 64,
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:potato_1")
end,
})
minetest.register_craftitem("mcl_farming:potato_item_baked", {
description = "Baked Potato",
stack_max = 64,
inventory_image = "farming_potato_baked.png",
on_use = minetest.item_eat(6),
groups = { food = 2, eatable = 6 },
})
minetest.register_craftitem("mcl_farming:potato_item_poison", {
description = "Poisonous Potato",
stack_max = 64,
inventory_image = "farming_potato_poison.png",
on_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
})
minetest.register_craft({
type = "cooking",
output = "mcl_farming:potato_item_baked",
recipe = "mcl_farming:potato_item",
})
mcl_farming:add_plant("mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2"}, 50, 20)

View file

@ -0,0 +1,290 @@
minetest.register_craftitem("mcl_farming:pumpkin_seed", {
description = "Pumpkin Seed",
stack_max = 64,
inventory_image = "farming_pumpkin_seed.png",
groups = { craftitem=1 },
on_place = function(itemstack, placer, pointed_thing)
local above = minetest.get_node(pointed_thing.above)
if above.name == "air" then
above.name = "mcl_farming:pumpkin_1"
minetest.set_node(pointed_thing.above, above)
itemstack:take_item(1)
return itemstack
end
end
})
minetest.register_node("mcl_farming:pumpkin_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
sunlight_propagates = true,
drop = "",
tiles = {"farming_tige_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:pumpkin_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
sunlight_propagates = true,
drop = "",
tiles = {"farming_tige_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:pumpkin_face", {
description = "Pumpkin",
stack_max = 64,
paramtype2 = "facedir",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, building_block=1},
after_dig_node = function(pos, oldnode, oldmetadata, user)
local have_change = 0
for x=-1,1 do
local p = {x=pos.x+x, y=pos.y, z=pos.z}
local n = minetest.get_node(p)
if string.find(n.name, "pumpkintige_linked_") and have_change == 0 then
have_change = 1
minetest.add_node(p, {name="mcl_farming:pumpkintige_unconnect"})
end
end
if have_change == 0 then
for z=-1,1 do
local p = {x=pos.x, y=pos.y, z=pos.z+z}
local n = minetest.get_node(p)
if string.find(n.name, "pumpkintige_linked_") and have_change == 0 then
have_change = 1
minetest.add_node(p, {name="mcl_farming:pumpkintige_unconnect"})
end
end
end
end,
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("mcl_farming:pumpkintige_unconnect", {
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "",
drawtype = "plantlike",
tiles = {"farming_tige_end.png"},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:pumpkintige_linked_r", {
paramtype = "light",
sunlight_propagates = true,
walkable = false,
drop = "",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0.5, 0.5, 0}, -- NodeBox1
}
},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
tiles = {
"farming_tige_connnect.png", --top
"farming_tige_connnect.png", -- bottom
"farming_tige_connnect.png", -- right
"farming_tige_connnect.png", -- left
"farming_tige_connnect.png", -- back
"farming_tige_connnect.png^[transformFX90" --front
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:pumpkintige_linked_l", {
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0.5, 0.5, 0}, -- NodeBox1
}
},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
tiles = {
"farming_tige_connnect.png", --top
"farming_tige_connnect.png", -- bottom
"farming_tige_connnect.png", -- right
"farming_tige_connnect.png", -- left
"farming_tige_connnect.png^[transformFX90", -- back
"farming_tige_connnect.png" --front
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:pumpkintige_linked_t", {
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
node_box = {
type = "fixed",
fixed = {
{0, -0.5, -0.5, 0, 0.5, 0.5}, -- NodeBox1
}
},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
tiles = {
"farming_tige_connnect.png", --top
"farming_tige_connnect.png", -- bottom
"farming_tige_connnect.png^[transformFX90", -- right
"farming_tige_connnect.png", -- left
"farming_tige_connnect.png", -- back
"farming_tige_connnect.png" --front
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("mcl_farming:pumpkintige_linked_b", {
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
node_box = {
type = "fixed",
fixed = {
{0, -0.5, -0.5, 0, 0.5, 0.5}, -- NodeBox1
}
},
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
tiles = {
"farming_tige_connnect.png", --top
"farming_tige_connnect.png", -- bottom
"farming_tige_connnect.png", -- right
"farming_tige_connnect.png^[transformFX90", -- left
"farming_tige_connnect.png", -- back
"farming_tige_connnect.png" --front
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1 ,dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
})
mcl_farming:add_plant("mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2"}, 80, 20)
minetest.register_abm({
nodenames = {"mcl_farming:pumpkintige_unconnect"},
neighbors = {"air"},
interval = 30,
chance = 15,
action = function(pos)
local have_change = 0
local newpos = {x=pos.x, y=pos.y, z=pos.z}
local light = minetest.get_node_light(pos)
if light or light > 10 then
for x=-1,1 do
local p = {x=pos.x+x, y=pos.y-1, z=pos.z}
newpos = {x=pos.x+x, y=pos.y, z=pos.z}
local n = minetest.get_node(p)
local nod = minetest.get_node(newpos)
if n.name=="default:dirt_with_grass" and nod.name=="air" and have_change == 0
or n.name=="default:dirt" and nod.name=="air" and have_change == 0
or string.find(n.name, "mcl_farming:soil") and nod.name=="air" and have_change == 0 then
have_change = 1
minetest.add_node(newpos, {name="mcl_farming:pumpkin_face"})
if x == 1 then
minetest.add_node(pos, {name="mcl_farming:pumpkintige_linked_r" })
else
minetest.add_node(pos, {name="mcl_farming:pumpkintige_linked_l"})
end
end
end
if have_change == 0 then
for z=-1,1 do
local p = {x=pos.x, y=pos.y-1, z=pos.z+z}
newpos = {x=pos.x, y=pos.y, z=pos.z+z}
local n = minetest.get_node(p)
local nod2 = minetest.get_node(newpos)
if n.name=="default:dirt_with_grass" and nod2.name=="air" and have_change == 0
or n.name=="default:dirt" and nod2.name=="air" and have_change == 0
or string.find(n.name, "mcl_farming:soil") and nod2.name=="air" and have_change == 0 then
have_change = 1
minetest.add_node(newpos, {name="mcl_farming:pumpkin_face"})
if z == 1 then
minetest.add_node(pos, {name="mcl_farming:pumpkintige_linked_t" })
else
minetest.add_node(pos, {name="mcl_farming:pumpkintige_linked_b" })
end
end
end
end
end
end,
})
minetest.register_node("mcl_farming:pumpkin_face_light", {
description = "Jack o'Lantern",
stack_max = 64,
paramtype2 = "facedir",
light_source = 14,
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_light.png"},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, building_block=1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
output = "mcl_farming:pumpkin_face_light",
recipe = {{"mcl_farming:pumpkin_face"},
{"default:torch"}}
})
minetest.register_craft({
type = "shapeless",
output = "mcl_farming:pumpkin_seed 4",
recipe = {"mcl_farming:pumpkin_face"}
})

45
mods/mcl_farming/soil.lua Normal file
View file

@ -0,0 +1,45 @@
minetest.register_node("mcl_farming:soil", {
tiles = {"farming_soil.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"},
description = "Farmland",
drop = "default:dirt",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
-- 15/16 of the normal height
{-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
}
},
groups = { crumbly=3, not_in_creative_inventory=1, soil=2, soil_sapling=1 },
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("mcl_farming:soil_wet", {
tiles = {"farming_soil_wet.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"},
description = "Hydrated Farmland",
drop = "default:dirt",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
}
},
groups = { crumbly=3, not_in_creative_inventory=1, soil=3, soil_sapling=1 },
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_abm({
nodenames = {"mcl_farming:soil"},
interval = 15,
chance = 3,
action = function(pos, node)
if minetest.find_node_near(pos, 3, {"default:water_source", "default:water_flowing"}) then
node.name = "mcl_farming:soil_wet"
minetest.set_node(pos, node)
end
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

162
mods/mcl_farming/wheat.lua Normal file
View file

@ -0,0 +1,162 @@
minetest.register_craftitem("mcl_farming:wheat_seed", {
description = "Wheat Seeds",
groups = { craftitem=1 },
inventory_image = "farming_wheat_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:wheat_1")
end
})
minetest.register_node("mcl_farming:wheat_1", {
paramtype = "light",
sunlight_propagates = true,
walkable = false,
drawtype = "nodebox",
paramtype = "light",
drop = "mcl_farming:wheat_seed",
tiles = {"farming_wheat_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3
{-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4
}
},
})
minetest.register_node("mcl_farming:wheat_2", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
drawtype = "nodebox",
paramtype = "light",
drop = "mcl_farming:wheat_seed",
tiles = {"farming_wheat_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3
{-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4
}
},
})
minetest.register_node("mcl_farming:wheat_3", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
drawtype = "nodebox",
paramtype = "light",
drop = "mcl_farming:wheat_seed",
tiles = {"farming_wheat_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3
{-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4
}
},
})
minetest.register_node("mcl_farming:wheat", {
sunlight_propagates = true,
paramtype = "light",
walkable = false,
drawtype = "nodebox",
paramtype = "light",
tiles = {"farming_wheat.png"},
drop = {
max_items = 4,
items = {
{ items = {'mcl_farming:wheat_seed'} },
{ items = {'mcl_farming:wheat_seed'}, rarity = 2},
{ items = {'mcl_farming:wheat_seed'}, rarity = 5},
{ items = {'mcl_farming:wheat_harvested'} }
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.35, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1, dig_by_water=1},
sounds = default.node_sound_leaves_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3
{-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4
}
},
})
mcl_farming:add_plant("mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3"}, 50, 20)
minetest.register_craftitem("mcl_farming:wheat_harvested", {
description = "Wheat",
inventory_image = "farming_wheat_harvested.png",
groups = { craftitem = 1 },
})
minetest.register_craft({
output = "mcl_farming:bread",
recipe = {
{'mcl_farming:wheat_harvested', 'mcl_farming:wheat_harvested', 'mcl_farming:wheat_harvested'},
}
})
minetest.register_craft({
output = "mcl_farming:cookie 8",
recipe = {
{'mcl_farming:wheat_harvested', 'mcl_dye:brown', 'mcl_farming:wheat_harvested'},
}
})
minetest.register_craftitem("mcl_farming:cookie", {
description = "Cookie",
inventory_image = "farming_cookie.png",
groups = {food=2, eatable=2},
on_use = minetest.item_eat(2)
})
minetest.register_craftitem("mcl_farming:bread", {
description = "Bread",
inventory_image = "farming_bread.png",
groups = {food=2, eatable=5},
on_use = minetest.item_eat(5)
})