version 0.21
46
mods/farming/README.txt
Normal 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.
|
89
mods/farming/carrots.lua
Normal file
|
@ -0,0 +1,89 @@
|
|||
minetest.register_node("farming:carrot_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "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("farming:carrot_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "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("farming:carrot_3", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "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("farming:carrot", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_4.png"},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'farming:carrot_item 2'} },
|
||||
{ items = {'farming:carrot_item 3'}, rarity = 2 },
|
||||
{ items = {'farming:carrot_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("farming:carrot_item", {
|
||||
description = "Carrot",
|
||||
inventory_image = "farming_carrot.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:carrot_item_gold", {
|
||||
description = "Golden Carrot",
|
||||
inventory_image = "farming_carrot_gold.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:carrot_item_gold",
|
||||
recipe = {
|
||||
{'default:gold_lump'},
|
||||
{'farming:carrot_item'},
|
||||
}
|
||||
})
|
||||
|
||||
farming:add_plant("farming:carrot", {"farming:carrot_1", "farming:carrot_2", "farming:carrot_3"}, 50, 20)
|
3
mods/farming/depends.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
default
|
||||
bucket
|
||||
wool
|
133
mods/farming/hoes.lua
Normal file
|
@ -0,0 +1,133 @@
|
|||
local function create_soil(pos, inv, p)
|
||||
if pos == nil then
|
||||
return false
|
||||
end
|
||||
local node = minetest.env:get_node(pos)
|
||||
local name = node.name
|
||||
local above = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
if name == "default:dirt" or name == "default:dirt_with_grass" then
|
||||
if above.name == "air" then
|
||||
node.name = "farming:soil"
|
||||
minetest.env:set_node(pos, node)
|
||||
if inv and p and name == "default:dirt_with_grass" then
|
||||
for name,rarity in pairs(farming.seeds) do
|
||||
if math.random(1, rarity-p) == 1 then
|
||||
inv:add_item("main", ItemStack(name))
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_tool("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(), 0) then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/30)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_wood",
|
||||
recipe = {
|
||||
{"default:wood", "default:wood"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("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(), 5) then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/50)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_stone",
|
||||
recipe = {
|
||||
{"default:cobble", "default:cobble"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("farming:hoe_steel", {
|
||||
description = "Steel Hoe",
|
||||
inventory_image = "farming_tool_steelhoe.png",
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if create_soil(pointed_thing.under, user:get_inventory(), 10) then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/80)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_steel",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("farming:hoe_gold", {
|
||||
description = "Gold Hoe",
|
||||
inventory_image = "farming_tool_goldhoe.png",
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if create_soil(pointed_thing.under, user:get_inventory(), 7) then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/60)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_gold",
|
||||
recipe = {
|
||||
{"default:gold_ingot", "default:gold_ingot"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("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(), 15) then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/120)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:hoe_diamond",
|
||||
recipe = {
|
||||
{"default:diamond", "default:diamond"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"}
|
||||
}
|
||||
})
|
114
mods/farming/init.lua
Normal file
|
@ -0,0 +1,114 @@
|
|||
farming = {}
|
||||
|
||||
function 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.env:get_node(pos).name ~= "farming:soil_wet" and math.random(0, 9) > 0 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if not minetest.env:get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if minetest.env: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.env:set_node(pos, new_node)
|
||||
end
|
||||
} )
|
||||
end
|
||||
|
||||
|
||||
function 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.env:get_node(pos)
|
||||
pos= {x=pt.above.x, y=pt.above.y, z=pt.above.z}
|
||||
local place_s = minetest.env:get_node(pos)
|
||||
|
||||
|
||||
if string.find(farmland.name, "farming:soil") and string.find(place_s.name, "air") then
|
||||
minetest.env:add_node(pos, {name=plantname})
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:dig_by_water"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
for xp=-1,1 do
|
||||
for zp=-1,1 do
|
||||
p = {x=pos.x+xp, y=pos.y, z=pos.z+zp}
|
||||
n = minetest.env:get_node(p)
|
||||
-- On verifie si il y a de l'eau
|
||||
if (n.name=="default:water_flowing") then
|
||||
drop_attached_node(pos)
|
||||
minetest.env:dig_node(pos)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
-- ========= SOIL =========
|
||||
dofile(minetest.get_modpath("farming").."/soil.lua")
|
||||
|
||||
-- ========= HOES =========
|
||||
dofile(minetest.get_modpath("farming").."/hoes.lua")
|
||||
|
||||
-- ========= WHEAT =========
|
||||
dofile(minetest.get_modpath("farming").."/wheat.lua")
|
||||
|
||||
-- ========= PUMPKIN =========
|
||||
dofile(minetest.get_modpath("farming").."/pumpkin.lua")
|
||||
|
||||
-- ========= MELON =========
|
||||
dofile(minetest.get_modpath("farming").."/melon.lua")
|
||||
|
||||
-- ========= CARROT =========
|
||||
dofile(minetest.get_modpath("farming").."/carrots.lua")
|
||||
|
||||
-- ========= POTATOES =========
|
||||
dofile(minetest.get_modpath("farming").."/potatoes.lua")
|
||||
|
||||
-- ========= MUSHROOMS =========
|
||||
dofile(minetest.get_modpath("farming").."/mushrooms.lua")
|
||||
|
||||
|
296
mods/farming/melon.lua
Normal file
|
@ -0,0 +1,296 @@
|
|||
minetest.register_node("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},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'farming:melon_item 3'} },
|
||||
{ items = {'farming:melon_item 4'}, rarity = 2 },
|
||||
{ items = {'farming:melon_item 5'}, rarity = 5 },
|
||||
{ items = {'farming:melon_item 6'}, rarity = 10 },
|
||||
{ items = {'farming:melon_item 7'}, rarity = 14 }
|
||||
}
|
||||
},
|
||||
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.env:get_node(p)
|
||||
if string.find(n.name, "melontige_linked_") and have_change == 0 then
|
||||
have_change = 1
|
||||
minetest.env:add_node(p, {name="farming:melontige_unconnect"})
|
||||
end
|
||||
end
|
||||
if have_change == 0 then
|
||||
for z=-1,1 do
|
||||
p = {x=pos.x, y=pos.y, z=pos.z+z}
|
||||
local n = minetest.env:get_node(p)
|
||||
if string.find(n.name, "melontige_linked_") and have_change == 0 then
|
||||
have_change = 1
|
||||
minetest.env:add_node(p, {name="farming:melontige_unconnect"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("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("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("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("farming:melontige_linked_r", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
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("farming:melontige_linked_l", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
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("farming:melontige_linked_t", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
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("farming:melontige_linked_b", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
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("farming:melon_seed", {
|
||||
description = "Melon seed",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_melon_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming:melontige_1")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:melon_item", {
|
||||
description = "Melon",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_melon.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:melon_item_speckled", {
|
||||
description = "Melon Speckled",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_melon_speckled.png",
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"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.env:get_node(p)
|
||||
local nod = minetest.env: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, "farming:soil") and nod.name=="air" and have_change == 0 then
|
||||
have_change = 1
|
||||
minetest.env:add_node(newpos, {name="farming:melon"})
|
||||
if x == 1 then
|
||||
minetest.env:add_node(pos, {name="farming:melontige_linked_r" })
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:melontige_linked_l"})
|
||||
end
|
||||
end
|
||||
end
|
||||
if have_change == 0 then
|
||||
for z=-1,1 do
|
||||
p = {x=pos.x, y=pos.y-1, z=pos.z+z}
|
||||
newpos = {x=pos.x, y=pos.y, z=pos.z+z}
|
||||
n = minetest.env:get_node(p)
|
||||
local nod2 = minetest.env: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, "farming:soil") and nod2.name=="air" and have_change == 0 then
|
||||
have_change = 1
|
||||
minetest.env:add_node(newpos, {name="farming:melon"})
|
||||
if z == 1 then
|
||||
minetest.env:add_node(pos, {name="farming:melontige_linked_t" })
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:melontige_linked_b" })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
farming:add_plant("farming:melontige_unconnect", {"farming:melontige_1", "farming:melontige_2"}, 50, 20)
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:melon_seed",
|
||||
recipe = {"farming:melon_item"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'farming:melon',
|
||||
recipe = {
|
||||
{'farming:melon_item', 'farming:melon_item', 'farming:melon_item'},
|
||||
{'farming:melon_item', 'farming:melon_item', 'farming:melon_item'},
|
||||
{'farming:melon_item', 'farming:melon_item', 'farming:melon_item'},
|
||||
}
|
||||
})
|
46
mods/farming/mushrooms.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
minetest.register_node("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 = {snappy=3,flammable=2,mushroom=1,attached_node=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_node("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 = {snappy=3,flammable=2,mushroom=1,attached_node=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("farming:mushroom_stew", {
|
||||
description = "Mushroom Stew",
|
||||
inventory_image = "farming_mushroom_stew.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:mushroom_stew",
|
||||
recipe = {'default:bowl', 'farming:mushroom_brown', 'farming:mushroom_red'}
|
||||
})
|
80
mods/farming/potatoes.lua
Normal file
|
@ -0,0 +1,80 @@
|
|||
minetest.register_node("farming:potato_1", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "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("farming:potato_2", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "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("farming:potato", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_potato_3.png"},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{ items = {'farming:potato_item 2'} },
|
||||
{ items = {'farming:potato_item 3'}, rarity = 2 },
|
||||
{ items = {'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("farming:potato_item", {
|
||||
description = "Potato",
|
||||
inventory_image = "farming_potato.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
stack_max = 64,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:potato_item_baked", {
|
||||
description = "Baked Potato",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_potato_baked.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:potato_item_poison", {
|
||||
description = "Poisonous Potato",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_potato_poison.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "farming:potato_item_baked",
|
||||
recipe = "farming:potato_item",
|
||||
})
|
||||
|
||||
farming:add_plant("farming:potato", {"farming:potato_1", "farming:potato_2"}, 50, 20)
|
300
mods/farming/pumpkin.lua
Normal file
|
@ -0,0 +1,300 @@
|
|||
LIGHT_MAX = 15
|
||||
|
||||
minetest.register_craftitem("farming:pumpkin_seed", {
|
||||
description = "Pumpkin Seed",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_pumpkin_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = minetest.env:get_node(pointed_thing.above)
|
||||
if above.name == "air" then
|
||||
above.name = "farming:pumpkin_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("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("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("farming:pumpkin_face", {
|
||||
description = "Pumpkin Face",
|
||||
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},
|
||||
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.env:get_node(p)
|
||||
if string.find(n.name, "pumpkintige_linked_") and have_change == 0 then
|
||||
have_change = 1
|
||||
minetest.env:add_node(p, {name="farming:pumpkintige_unconnect"})
|
||||
end
|
||||
end
|
||||
if have_change == 0 then
|
||||
for z=-1,1 do
|
||||
p = {x=pos.x, y=pos.y, z=pos.z+z}
|
||||
local n = minetest.env:get_node(p)
|
||||
if string.find(n.name, "pumpkintige_linked_") and have_change == 0 then
|
||||
have_change = 1
|
||||
minetest.env:add_node(p, {name="farming:pumpkintige_unconnect"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("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("farming:pumpkintige_linked_r", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
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("farming:pumpkintige_linked_l", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
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("farming:pumpkintige_linked_t", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
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("farming:pumpkintige_linked_b", {
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
drop = "",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
legacy_wallmounted = true,
|
||||
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(),
|
||||
})
|
||||
|
||||
farming:add_plant("farming:pumpkintige_unconnect", {"farming:pumpkin_1", "farming:pumpkin_2"}, 80, 20)
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"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.env:get_node(p)
|
||||
local nod = minetest.env: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, "farming:soil") and nod.name=="air" and have_change == 0 then
|
||||
have_change = 1
|
||||
minetest.env:add_node(newpos, {name="farming:pumpkin_face"})
|
||||
if x == 1 then
|
||||
minetest.env:add_node(pos, {name="farming:pumpkintige_linked_r" })
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:pumpkintige_linked_l"})
|
||||
end
|
||||
end
|
||||
end
|
||||
if have_change == 0 then
|
||||
for z=-1,1 do
|
||||
p = {x=pos.x, y=pos.y-1, z=pos.z+z}
|
||||
newpos = {x=pos.x, y=pos.y, z=pos.z+z}
|
||||
n = minetest.env:get_node(p)
|
||||
local nod2 = minetest.env: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, "farming:soil") and nod2.name=="air" and have_change == 0 then
|
||||
have_change = 1
|
||||
minetest.env:add_node(newpos, {name="farming:pumpkin_face"})
|
||||
if z == 1 then
|
||||
minetest.env:add_node(pos, {name="farming:pumpkintige_linked_t" })
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:pumpkintige_linked_b" })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("farming:pumpkin_face_light", {
|
||||
description = "Jack O' Lantern",
|
||||
stack_max = 64,
|
||||
paramtype2 = "facedir",
|
||||
light_source = LIGHT_MAX,
|
||||
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},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:pumpkin_face_light",
|
||||
recipe = {"farming:pumpkin_face", "default:torch"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:pumpkin_seed 4",
|
||||
recipe = {"farming:pumpkin_face"}
|
||||
})
|
||||
|
||||
|
||||
-- ========= FUEL =========
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin_seed",
|
||||
burntime = 1
|
||||
})
|
125
mods/farming/pumpkin.old
Normal file
|
@ -0,0 +1,125 @@
|
|||
LIGHT_MAX = 15
|
||||
|
||||
minetest.register_craftitem("farming:pumpkin_seed", {
|
||||
description = "Pumpkin Seed",
|
||||
stack_max = 64,
|
||||
inventory_image = "farming_pumpkin_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local above = minetest.env:get_node(pointed_thing.above)
|
||||
if above.name == "air" then
|
||||
above.name = "farming:pumpkin_1"
|
||||
minetest.env:set_node(pointed_thing.above, above)
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming:pumpkin_1", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
drop = "",
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
||||
},
|
||||
},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_node("farming:pumpkin_2", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
drop = "",
|
||||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.35, -0.5, -0.35, 0.35, 0.2, 0.35}
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.35, -0.5, -0.35, 0.35, 0.2, 0.35}
|
||||
},
|
||||
},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_node("farming:pumpkin", {
|
||||
description = "Pumpkin",
|
||||
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_side.png"},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2},
|
||||
stack_max = 64,
|
||||
on_punch = function(pos, node, puncher)
|
||||
node.name = "farming:pumpkin_face"
|
||||
minetest.env:set_node(pos, node)
|
||||
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
|
||||
if math.random(1, 5) == 1 then
|
||||
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
farming:add_plant("farming:pumpkin", {"farming:pumpkin_1", "farming:pumpkin_2"}, 80, 20)
|
||||
|
||||
minetest.register_node("farming:pumpkin_face", {
|
||||
description = "Pumpkin Face",
|
||||
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},
|
||||
})
|
||||
|
||||
minetest.register_node("farming:pumpkin_face_light", {
|
||||
description = "Jack O' Lantern",
|
||||
stack_max = 64,
|
||||
paramtype2 = "facedir",
|
||||
light_source = LIGHT_MAX,
|
||||
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},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:pumpkin_face_light",
|
||||
recipe = {"farming:pumpkin_face", "default:torch"}
|
||||
})
|
||||
|
||||
|
||||
-- ========= FUEL =========
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin_seed",
|
||||
burntime = 1
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin",
|
||||
burntime = 5
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin_face",
|
||||
burntime = 5
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:pumpkin_face_light",
|
||||
burntime = 7
|
||||
})
|
40
mods/farming/soil.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
minetest.register_node("farming:soil", {
|
||||
tiles = {"farming_soil.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"},
|
||||
drop = "default:dirt",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.375, 0.5},
|
||||
}
|
||||
},
|
||||
groups = {crumbly=3, not_in_creative_inventory=1,soil=2},
|
||||
})
|
||||
|
||||
minetest.register_node("farming:soil_wet", {
|
||||
tiles = {"farming_soil_wet.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"},
|
||||
drop = "default:dirt",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.375, 0.5},
|
||||
}
|
||||
},
|
||||
groups = {crumbly=3, not_in_creative_inventory=1,soil=3},
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:soil"},
|
||||
interval = 15,
|
||||
chance = 3,
|
||||
action = function(pos, node)
|
||||
if minetest.env:find_node_near(pos, 3, {"default:water_source", "default:water_flowing"}) then
|
||||
node.name = "farming:soil_wet"
|
||||
minetest.env:set_node(pos, node)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
BIN
mods/farming/textures/farming_bread.png
Normal file
After Width: | Height: | Size: 342 B |
BIN
mods/farming/textures/farming_carrot.png
Normal file
After Width: | Height: | Size: 383 B |
BIN
mods/farming/textures/farming_carrot_1.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
mods/farming/textures/farming_carrot_2.png
Normal file
After Width: | Height: | Size: 237 B |
BIN
mods/farming/textures/farming_carrot_3.png
Normal file
After Width: | Height: | Size: 370 B |
BIN
mods/farming/textures/farming_carrot_4.png
Normal file
After Width: | Height: | Size: 558 B |
BIN
mods/farming/textures/farming_carrot_gold.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
mods/farming/textures/farming_cookie.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
mods/farming/textures/farming_melon.png
Normal file
After Width: | Height: | Size: 457 B |
BIN
mods/farming/textures/farming_melon_seed.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
mods/farming/textures/farming_melon_side.png
Normal file
After Width: | Height: | Size: 855 B |
BIN
mods/farming/textures/farming_melon_speckled.png
Normal file
After Width: | Height: | Size: 626 B |
BIN
mods/farming/textures/farming_melon_top.png
Normal file
After Width: | Height: | Size: 659 B |
BIN
mods/farming/textures/farming_mushroom_brown.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
mods/farming/textures/farming_mushroom_red.png
Normal file
After Width: | Height: | Size: 238 B |
BIN
mods/farming/textures/farming_mushroom_stew.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
mods/farming/textures/farming_potato.png
Normal file
After Width: | Height: | Size: 427 B |
BIN
mods/farming/textures/farming_potato_1.png
Normal file
After Width: | Height: | Size: 237 B |
BIN
mods/farming/textures/farming_potato_2.png
Normal file
After Width: | Height: | Size: 370 B |
BIN
mods/farming/textures/farming_potato_3.png
Normal file
After Width: | Height: | Size: 482 B |
BIN
mods/farming/textures/farming_potato_baked.png
Normal file
After Width: | Height: | Size: 402 B |
BIN
mods/farming/textures/farming_potato_poison.png
Normal file
After Width: | Height: | Size: 504 B |
BIN
mods/farming/textures/farming_pumpkin_face.png
Normal file
After Width: | Height: | Size: 467 B |
BIN
mods/farming/textures/farming_pumpkin_face_light.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
mods/farming/textures/farming_pumpkin_seed.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
mods/farming/textures/farming_pumpkin_side.png
Normal file
After Width: | Height: | Size: 422 B |
BIN
mods/farming/textures/farming_pumpkin_top.png
Normal file
After Width: | Height: | Size: 563 B |
BIN
mods/farming/textures/farming_soil.png
Normal file
After Width: | Height: | Size: 552 B |
BIN
mods/farming/textures/farming_soil_wet.png
Normal file
After Width: | Height: | Size: 552 B |
BIN
mods/farming/textures/farming_tige_1.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
mods/farming/textures/farming_tige_2.png
Normal file
After Width: | Height: | Size: 424 B |
BIN
mods/farming/textures/farming_tige_connnect.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
mods/farming/textures/farming_tige_end.png
Normal file
After Width: | Height: | Size: 544 B |
BIN
mods/farming/textures/farming_tool_diamondhoe.png
Normal file
After Width: | Height: | Size: 318 B |
BIN
mods/farming/textures/farming_tool_goldhoe.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
mods/farming/textures/farming_tool_steelhoe.png
Normal file
After Width: | Height: | Size: 308 B |
BIN
mods/farming/textures/farming_tool_stonehoe.png
Normal file
After Width: | Height: | Size: 310 B |
BIN
mods/farming/textures/farming_tool_woodhoe.png
Normal file
After Width: | Height: | Size: 316 B |
BIN
mods/farming/textures/farming_wheat.png
Normal file
After Width: | Height: | Size: 854 B |
BIN
mods/farming/textures/farming_wheat_1.png
Normal file
After Width: | Height: | Size: 246 B |
BIN
mods/farming/textures/farming_wheat_2.png
Normal file
After Width: | Height: | Size: 685 B |
BIN
mods/farming/textures/farming_wheat_3.png
Normal file
After Width: | Height: | Size: 787 B |
BIN
mods/farming/textures/farming_wheat_harvested.png
Normal file
After Width: | Height: | Size: 488 B |
BIN
mods/farming/textures/farming_wheat_seed.png
Normal file
After Width: | Height: | Size: 255 B |
122
mods/farming/wheat.lua
Normal file
|
@ -0,0 +1,122 @@
|
|||
minetest.register_craftitem("farming:wheat_seed", {
|
||||
description = "Wheat Seeds",
|
||||
inventory_image = "farming_wheat_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming:place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farming:wheat_1", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "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 = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
|
||||
})
|
||||
|
||||
minetest.register_node("farming:wheat_2", {
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "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 = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
|
||||
})
|
||||
|
||||
minetest.register_node("farming:wheat_3", {
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
drop = "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 = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
|
||||
})
|
||||
|
||||
minetest.register_node("farming:wheat", {
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat.png"},
|
||||
drop = {
|
||||
max_items = 4,
|
||||
items = {
|
||||
{ items = {'farming:wheat_seed'} },
|
||||
{ items = {'farming:wheat_seed'}, rarity = 2},
|
||||
{ items = {'farming:wheat_seed'}, rarity = 5},
|
||||
{ items = {'farming:wheat_harvested'} }
|
||||
}
|
||||
},
|
||||
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
|
||||
})
|
||||
|
||||
farming:add_plant("farming:wheat", {"farming:wheat_1", "farming:wheat_2", "farming:wheat_3"}, 50, 20)
|
||||
|
||||
minetest.register_craftitem("farming:wheat_harvested", {
|
||||
description = "Harvested Wheat",
|
||||
inventory_image = "farming_wheat_harvested.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:bread",
|
||||
recipe = {
|
||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:cookie",
|
||||
recipe = {
|
||||
{'farming:wheat_harvested', 'dye:brown', 'farming:wheat_harvested'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:cookie", {
|
||||
description = "Cookie",
|
||||
inventory_image = "farming_cookie.png",
|
||||
groups = {food=2},
|
||||
on_use = minetest.item_eat(2)
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("farming:bread", {
|
||||
description = "Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
groups = {food=2},
|
||||
on_use = minetest.item_eat(5)
|
||||
})
|
||||
|
||||
-- ========= FUEL =========
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:wheat_seed",
|
||||
burntime = 1
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:wheat_harvested",
|
||||
burntime = 2
|
||||
})
|