Add farming plus

pull/2/head
Brandon 2014-05-23 19:31:38 -05:00
parent e791859950
commit d841fce29f
71 changed files with 1622 additions and 0 deletions

View File

@ -0,0 +1,23 @@
===FARMING_PLUS MOD for MINETEST===
by PilzAdam
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,71 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_node("farming_plus:banana_sapling", {
description = S("Banana Tree Sapling"),
drawtype = "plantlike",
tiles = {"farming_banana_sapling.png"},
inventory_image = "farming_banana_sapling.png",
wield_image = "farming_banana_sapling.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
groups = {dig_immediate=3,flammable=2},
sounds = default.node_sound_defaults(),
})
minetest.register_node("farming_plus:banana_leaves", {
drawtype = "allfaces_optional",
tiles = {"farming_banana_leaves.png"},
paramtype = "light",
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1},
drop = {
max_items = 1,
items = {
{
items = {'farming_plus:banana_sapling'},
rarity = 20,
},
}
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_abm({
nodenames = {"farming_plus:banana_sapling"},
interval = 60,
chance = 20,
action = function(pos, node)
farming:generate_tree(pos, "default:tree", "farming_plus:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming_plus:banana"]=20})
end
})
minetest.register_on_generated(function(minp, maxp, blockseed)
if math.random(1, 100) > 5 then
return
end
local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
local pos = minetest.find_node_near(tmp, maxp.x-minp.x, {"default:dirt_with_grass"})
if pos ~= nil then
farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "default:tree", "farming_plus:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming_plus:banana"]=10})
end
end)
minetest.register_node("farming_plus:banana", {
description = S("Banana"),
tiles = {"farming_banana.png"},
inventory_image = "farming_banana.png",
wield_image = "farming_banana.png",
drawtype = "torchlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
sounds = default.node_sound_defaults(),
on_use = minetest.item_eat(6),
})

View File

@ -0,0 +1,87 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_craftitem("farming_plus:carrot_seed", {
description = S("Carrot Seeds"),
inventory_image = "farming_carrot_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:carrot_1")
end
})
minetest.register_node("farming_plus:carrot_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_carrot_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:carrot_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_carrot_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:carrot_3", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_carrot_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:carrot", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_carrot_4.png"},
drop = {
max_items = 6,
items = {
{ items = {'farming_plus:carrot_seed'} },
{ items = {'farming_plus:carrot_seed'}, rarity = 2},
{ items = {'farming_plus:carrot_seed'}, rarity = 5},
{ items = {'farming_plus:carrot_item'} },
{ items = {'farming_plus:carrot_item'}, rarity = 2 },
{ items = {'farming_plus:carrot_item'}, rarity = 5 }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("farming_plus:carrot_item", {
description = S("Carrot"),
inventory_image = "farming_carrot.png",
on_use = minetest.item_eat(3),
})
farming:add_plant("farming_plus:carrot", {"farming_plus:carrot_1", "farming_plus:carrot_2", "farming_plus:carrot_3"}, 50, 20)

View File

@ -0,0 +1,81 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_node("farming_plus:cocoa_sapling", {
description = S("Cocoa Tree Sapling"),
drawtype = "plantlike",
tiles = {"farming_cocoa_sapling.png"},
inventory_image = "farming_cocoa_sapling.png",
wield_image = "farming_cocoa_sapling.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
groups = {dig_immediate=3,flammable=2},
sounds = default.node_sound_defaults(),
})
minetest.register_node("farming_plus:cocoa_leaves", {
drawtype = "allfaces_optional",
tiles = {"farming_banana_leaves.png"},
paramtype = "light",
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1},
drop = {
max_items = 1,
items = {
{
items = {'farming_plus:cocoa_sapling'},
rarity = 20,
},
}
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_abm({
nodenames = {"farming_plus:cocoa_sapling"},
interval = 60,
chance = 20,
action = function(pos, node)
farming:generate_tree(pos, "default:tree", "farming_plus:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming_plus:cocoa"]=20})
end
})
minetest.register_on_generated(function(minp, maxp, blockseed)
if math.random(1, 100) > 5 then
return
end
local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
local pos = minetest.find_node_near(tmp, maxp.x-minp.x, {"default:desert_sand"})
if pos ~= nil then
farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "default:tree", "farming_plus:cocoa_leaves", {"default:sand", "default:desert_sand"}, {["farming_plus:cocoa"]=20})
end
end)
minetest.register_node("farming_plus:cocoa", {
description = S("Cocoa"),
tiles = {"farming_cocoa.png"},
visual_scale = 0.5,
inventory_image = "farming_cocoa.png",
wield_image = "farming_cocoa.png",
drawtype = "torchlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
sounds = default.node_sound_defaults(),
})
minetest.register_craftitem("farming_plus:cocoa_bean", {
description = "Cocoa Bean",
inventory_image = "farming_cocoa_bean.png",
})
minetest.register_craft({
output = "farming_plus:cocoa_bean 10",
type = "shapeless",
recipe = {"farming_plus:cocoa"},
})

View File

@ -0,0 +1,3 @@
default
farming
intllib?

324
mods/farming_plus/init.lua Normal file
View File

@ -0,0 +1,324 @@
farming.registered_plants = {}
-- Boilerplate to support localized strings if intllib mod is installed.
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
farming.S = intllib.Getter(minetest.get_current_modname())
else
farming.S = function ( s ) return s end
end
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.get_node(pos).name ~= "farming:soil_wet" then
return
end
pos.y = pos.y+1
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) < 8 then
return
end
local step = nil
for i,name in ipairs(names) do
if name == node.name then
step = i
break
end
end
if step == nil then
return
end
local new_node = {name=names[step+1]}
if new_node.name == nil then
new_node.name = full_grown
end
minetest.set_node(pos, new_node)
end
})
table.insert(farming.registered_plants, {
full_grown = full_grown,
names = names,
interval = interval,
chance = chance,
})
end
function farming:generate_tree(pos, trunk, leaves, underground, replacements)
pos.y = pos.y-1
local nodename = minetest.get_node(pos).name
local ret = true
for _,name in ipairs(underground) do
if nodename == name then
ret = false
break
end
end
pos.y = pos.y+1
if not minetest.get_node_light(pos) then
return
end
if ret or minetest.get_node_light(pos) < 8 then
return
end
node = {name = ""}
for dy=1,4 do
pos.y = pos.y+dy
if minetest.get_node(pos).name ~= "air" then
return
end
pos.y = pos.y-dy
end
node.name = trunk
for dy=0,4 do
pos.y = pos.y+dy
minetest.set_node(pos, node)
pos.y = pos.y-dy
end
if not replacements then
replacements = {}
end
node.name = leaves
pos.y = pos.y+3
for dx=-2,2 do
for dz=-2,2 do
for dy=0,3 do
pos.x = pos.x+dx
pos.y = pos.y+dy
pos.z = pos.z+dz
if dx == 0 and dz == 0 and dy==3 then
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.set_node(pos, node)
for name,rarity in pairs(replacements) do
if math.random(1, rarity) == 1 then
minetest.set_node(pos, {name=name})
end
end
end
elseif dx == 0 and dz == 0 and dy==4 then
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.set_node(pos, node)
for name,rarity in pairs(replacements) do
if math.random(1, rarity) == 1 then
minetest.set_node(pos, {name=name})
end
end
end
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, node)
for name,rarity in pairs(replacements) do
if math.random(1, rarity) == 1 then
minetest.set_node(pos, {name=name})
end
end
end
else
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
if minetest.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.set_node(pos, node)
for name,rarity in pairs(replacements) do
if math.random(1, rarity) == 1 then
minetest.set_node(pos, {name=name})
end
end
end
end
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
end
end
end
end
farming.seeds = {
["farming:pumpkin_seed"]=60,
["farming_plus:strawberry_seed"]=30,
["farming_plus:rhubarb_seed"]=30,
["farming_plus:potatoe_seed"]=30,
["farming_plus:tomato_seed"]=30,
["farming_plus:orange_seed"]=30,
["farming_plus:carrot_seed"]=30,
}
-- ========= GENERATE PLANTS IN THE MAP =========
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y >= 2 and minp.y <= 0 then
-- Generate plants (code from flowers)
local perlin1 = minetest.get_perlin(974, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine flowers amount from perlin noise
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
-- Find random positions for flowers based on this random
local pr = PseudoRandom(seed+456)
for i=0,grass_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
if ground_y then
local p = {x=x,y=ground_y+1,z=z}
local nn = minetest.get_node(p).name
-- Check if the node can be replaced
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
if nn == "default:dirt_with_grass" then
--local plant_choice = pr:next(1, #farming.registered_plants)
local plant_choice = math.floor(perlin1:get2d({x=x,y=z})*(#farming.registered_plants))
local plant = farming.registered_plants[plant_choice]
if plant then
minetest.set_node(p, {name=plant.full_grown})
end
end
end
end
end
end
end
end
end)
function farming:place_seed(itemstack, placer, pointed_thing, plantname)
-- Call on_rightclick if the pointed node defines it
if pointed_thing.type == "node" and placer and
not placer:get_player_control().sneak then
local n = minetest.get_node(pointed_thing.under)
local nn = n.name
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].on_rightclick then
return minetest.registered_nodes[nn].on_rightclick(pointed_thing.under, n,
placer, itemstack, pointed_thing) or itemstack, false
end
end
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
return
end
-- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") <= 1 then
return
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name=plantname})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
-- ========= ALIASES FOR FARMING MOD BY SAPIER =========
-- potatoe -> potatoe
minetest.register_alias("farming:potatoe_node", "farming_plus:potatoe")
--minetest.register_alias("farming:potatoe", "farming:potatoe_item") cant do this
minetest.register_alias("farming:potatoe_straw", "farming_plus:potatoe")
minetest.register_alias("farming:seed_potatoe", "farming_plus:potatoe_seed")
for lvl = 1, 6, 1 do
minetest.register_entity(":farming:potatoe_lvl"..lvl, {
on_activate = function(self, staticdata)
minetest.set_node(self.object:getpos(), {name="farming_plus:potatoe_1"})
end
})
end
minetest.register_alias("farming:cotton", "farming:cotton_3")
minetest.register_alias("farming:wheat_harvested", "farming:wheat")
minetest.register_alias("farming:dough", "farming:flour")
minetest.register_abm({
nodenames = {"farming:wheat"},
interval = 1,
chance = 1,
action = function(pos)
minetest.set_node(pos, {name="farming:wheat_8"})
end,
})
-- ========= STRAWBERRIES =========
dofile(minetest.get_modpath("farming_plus").."/strawberries.lua")
-- ========= RHUBARB =========
dofile(minetest.get_modpath("farming_plus").."/rhubarb.lua")
-- ========= POTATOES =========
dofile(minetest.get_modpath("farming_plus").."/potatoes.lua")
-- ========= TOMATOES =========
dofile(minetest.get_modpath("farming_plus").."/tomatoes.lua")
-- ========= ORANGES =========
dofile(minetest.get_modpath("farming_plus").."/oranges.lua")
-- ========= BANANAS =========
dofile(minetest.get_modpath("farming_plus").."/bananas.lua")
-- ========= CARROTS =========
dofile(minetest.get_modpath("farming_plus").."/carrots.lua")
-- ========= COCOA =========
dofile(minetest.get_modpath("farming_plus").."/cocoa.lua")
-- ========= PUMPKIN =========
dofile(minetest.get_modpath("farming_plus").."/pumpkin.lua")
-- ========= WEED =========
dofile(minetest.get_modpath("farming_plus").."/weed.lua")

View File

@ -0,0 +1,50 @@
# Translation by Xanthin
### bananas.lua ###
Banana Tree Sapling = Bananenbaumsetzling
Banana = Banane
### carrots.lua ###
Carrot Seeds = Karottensamen
Carrot = Karotte
### cocoa.lua ###
Cocoa Tree Sapling = Kakaobaumsetzling
Cocoa = Kakao
Cocoa Bean = Kakaobohne
### oranges.lua ###
Orange Seeds = Orangensamen
Orange = Orange
### potatoes.lua ###
Potato Seeds = Kartoffelsamen
Potato = Kartoffel
### pumpkin.lua ###
Pumpkin Seed = Kuerbissamen
Pumpkin = Kuerbis
Pumpkin Face = Kuerbislaterne
Pumpkin Face With Light = Leuchtende Kuerbislaterne
Big Pumpkin = Riesen-Kuerbis
Scarecrow = Vogelscheuche
Scarecrow With Light = Leuchtende Vogelscheuche
Pumpkin Bread = Kuerbisbrot
Pumpkin Flour = Kuerbismehl
### rhubarb.lua ###
Rhubarb Seeds = Rhabarbersamen
Rhubarb = Rhabarber
### strawberries.lua ###
Strawberry Seeds = Erdbeersamen
Strawberry = Erdbeere
### tomatoes.lua ###
Tomato Seeds = Tomatensamen
Tomato = Tomate
### init.lua ###
### weed.lua ###
Weed = Unkraut

View File

@ -0,0 +1,51 @@
# Template
### bananas.lua ###
Banana Tree Sapling =
Banana =
### carrots.lua ###
Carrot Seeds =
Carrot =
### cocoa.lua ###
Cocoa Tree Sapling =
Cocoa =
Cocoa Bean =
### oranges.lua ###
Orange Seeds =
Orange =
### potatoes.lua ###
Potato Seeds =
Potato =
### pumpkin.lua ###
Pumpkin Seed =
Pumpkin =
Pumpkin Face =
Pumpkin Face With Light =
Big Pumpkin =
Scarecrow =
Scarecrow With Light =
Pumpkin Bread =
Pumpkin Flour =
### rhubarb.lua ###
Rhubarb Seeds =
Rhubarb =
### strawberries.lua ###
Strawberry Seeds =
Strawberry =
### tomatoes.lua ###
Tomato Seeds =
Tomato =
### init.lua ###
### weed.lua ###
Weed =

View File

@ -0,0 +1,87 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_craftitem("farming_plus:orange_seed", {
description = S("Orange Seeds"),
inventory_image = "farming_orange_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:orange_1")
end
})
minetest.register_node("farming_plus:orange_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_orange_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:orange_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_orange_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+8/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:orange_3", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_orange_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+14/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:orange", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_orange_4.png"},
drop = {
max_items = 6,
items = {
{ items = {'farming_plus:orange_seed'} },
{ items = {'farming_plus:orange_seed'}, rarity = 2},
{ items = {'farming_plus:orange_seed'}, rarity = 5},
{ items = {'farming_plus:orange_item'} },
{ items = {'farming_plus:orange_item'}, rarity = 2 },
{ items = {'farming_plus:orange_item'}, rarity = 5 }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("farming_plus:orange_item", {
description = S("Orange"),
inventory_image = "farming_orange.png",
on_use = minetest.item_eat(4),
})
farming:add_plant("farming_plus:orange", {"farming_plus:orange_1", "farming_plus:orange_2", "farming_plus:orange_3"}, 50, 20)

View File

@ -0,0 +1,77 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_craftitem("farming_plus:potato_seed", {
description = ("Potato Seeds"),
inventory_image = "farming_potato_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:potato_1")
end
})
minetest.register_node("farming_plus:potato_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_potato_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,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:potato_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_potato_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,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:potato", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_potato_3.png"},
drop = {
max_items = 6,
items = {
{ items = {'farming_plus:potato_seed'} },
{ items = {'farming_plus:potato_seed'}, rarity = 2},
{ items = {'farming_plus:potato_seed'}, rarity = 5},
{ items = {'farming_plus:potato_item'} },
{ items = {'farming_plus:potato_item'}, rarity = 2 },
{ items = {'farming_plus:potato_item'}, rarity = 5 }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("farming_plus:potato_item", {
description = S("Potato"),
inventory_image = "farming_potato.png",
})
farming:add_plant("farming_plus:potato", {"farming_plus:potato_1", "farming_plus:potato_2"}, 50, 20)
minetest.register_alias("farming_plus:potatoe_item", "farming_plus:potato_item")
minetest.register_alias("farming_plus:potatoe_seed", "farming_plus:potato_seed")
minetest.register_alias("farming_plus:potatoe", "farming_plus:potato")
minetest.register_alias("farming_plus:potatoe_1", "farming_plus:potato_1")
minetest.register_alias("farming_plus:potatoe_2", "farming_plus:potato_2")

View File

@ -0,0 +1,480 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_craftitem(":farming:pumpkin_seed", {
description = S("Pumpkin Seed"),
inventory_image = "farming_pumpkin_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return farming:place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
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, plant=1},
sounds = default.node_sound_wood_defaults(),
})
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, plant=1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node(":farming:pumpkin", {
description = S("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, flammable=2, plant=1},
sounds = default.node_sound_wood_defaults(),
on_punch = function(pos, node, puncher)
local tool = puncher:get_wielded_item():get_name()
if tool and string.match(tool, "sword") then
node.name = "farming:pumpkin_face"
minetest.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
end
})
farming:add_plant("farming:pumpkin", {"farming:pumpkin_1", "farming:pumpkin_2"}, 80, 20)
minetest.register_node(":farming:pumpkin_face", {
description = S("Pumpkin Face"),
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, plant=1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node(":farming:pumpkin_face_light", {
description = S("Pumpkin Face With Light"),
paramtype2 = "facedir",
light_source = LIGHT_MAX-2,
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},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
type = "shapeless",
output = "farming:pumpkin_face_light",
recipe = {"farming:pumpkin_face", "default:torch"}
})
-- ========= BIG PUMPKIN =========
minetest.register_node(":farming:big_pumpkin", {
description = S("Big Pumpkin"),
paramtype2 = "facedir",
tiles = {"farming_pumpkin_big_side.png"},
selection_box = {
type = "fixed",
fixed = {
{-1, -0.5, -1, 1, 1.5, 1}
}
},
groups = {choppy=1, oddly_breakable_by_hand=1, flammable=2},
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
for dx=-1,1 do
for dy=0,1 do
for dz=-1,1 do
pos.x = pos.x+dx
pos.y = pos.y+dy
pos.z = pos.z+dz
if dx ~= 0 or dy ~= 0 or dz ~= 0 then
if minetest.get_node(pos).name ~= "air" then
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
minetest.remove_node(pos)
minetest.after(0.1, function(placer)
local inv = placer:get_inventory()
local index = placer:get_wield_index()
inv:set_stack("main", index, ItemStack("farming:big_pumpkin"))
end, placer)
return
end
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
end
end
end
for dy=0,1 do
pos.y = pos.y+dy
pos.z = pos.z+1
minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=2})
pos.x = pos.x-1
minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=2})
pos.x = pos.x+1
pos.z = pos.z-2
minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=4})
pos.x = pos.x+1
minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=4})
pos.z = pos.z+1
minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=3})
pos.z = pos.z+1
minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=3})
pos.z = pos.z-1
pos.x = pos.x-2
minetest.set_node(pos, {name="farming:big_pumpkin_side", param2=1})
pos.z = pos.z-1
minetest.set_node(pos, {name="farming:big_pumpkin_corner", param2=1})
pos.z = pos.z+1
pos.x = pos.x+1
pos.y = pos.y-dy
end
pos.y = pos.y+1
minetest.set_node(pos, {name="farming:big_pumpkin_top"})
end,
after_destruct = function(pos, oldnode)
for dx=-1,1 do
for dy=0,1 do
for dz=-1,1 do
pos.x = pos.x+dx
pos.y = pos.y+dy
pos.z = pos.z+dz
local name = minetest.get_node(pos).name
if string.find(name, "farming:big_pumpkin") then
minetest.remove_node(pos)
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
end
end
end
end
})
minetest.register_node(":farming:big_pumpkin_side", {
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"farming_pumpkin_big_top_side.png", "farming_pumpkin_big_side.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0.5, 0.5, 0.5}
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
groups = {not_in_creative_inventory=1},
})
minetest.register_node(":farming:big_pumpkin_corner", {
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"farming_pumpkin_big_top_corner.png", "farming_pumpkin_big_side.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0, 0.5, 0.5}
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
groups = {not_in_creative_inventory=1},
})
minetest.register_node(":farming:big_pumpkin_top", {
paramtype = "light",
sunlight_propagates = true,
tiles = {"farming_pumpkin_big_top.png"},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
groups = {not_in_creative_inventory=1},
})
minetest.register_craft({
type = "shapeless",
output = "farming:big_pumpkin",
recipe = {"bucket:bucket_water", "farming:pumpkin"},
replacements = {
{"bucket:bucket_water", "bucket:bucket_empty"}
}
})
-- ========= SCARECROW =========
local box1 = {
{-1, -8, -1, 1, 8, 1},
}
local box2 = {
{-1, -8, -1, 1, 8, 1},
{-12, -8, -1, 12, -7, 1},
{-5, -2, -5, 5, 8, 5}
}
for j,list in ipairs(box1) do
for i,int in ipairs(list) do
list[i] = int/16
end
box1[j] = list
end
for j,list in ipairs(box2) do
for i,int in ipairs(list) do
list[i] = int/16
end
box2[j] = list
end
minetest.register_node(":farming:scarecrow", {
description = S("Scarecrow"),
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = box2
},
selection_box = {
type = "fixed",
fixed = {
{-12/16, -1.5, -0.5, 12/16, 0.5, 0.5}
}
},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
after_place_node = function(pos, placer)
local node = minetest.get_node(pos)
local param2 = node.param2
pos.y = pos.y+1
if minetest.get_node(pos).name ~= "air" then
pos.y = pos.y-1
minetest.remove_node(pos)
minetest.after(0.1, function(placer)
local inv = placer:get_inventory()
local index = placer:get_wield_index()
inv:set_stack("main", index, ItemStack("farming:scarecrow"))
end, placer)
return
end
minetest.set_node(pos, node)
pos.y = pos.y-1
node.name = "farming:scarecrow_bottom"
minetest.set_node(pos, node)
end,
after_destruct = function(pos, oldnode)
pos.y = pos.y-1
if minetest.get_node(pos).name == "farming:scarecrow_bottom" then
minetest.remove_node(pos)
end
end
})
minetest.register_node(":farming:scarecrow_bottom", {
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"default_wood.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = box1
},
groups = {not_in_creative_inventory=1},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
}
})
minetest.register_craft({
output = "farming:scarecrow",
recipe = {
{"", "farming:pumpkin_face", "",},
{"default:stick", "default:stick", "default:stick",},
{"", "default:stick", "",}
}
})
minetest.register_node(":farming:scarecrow_light", {
description = S("Scarecrow With light"),
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
light_source = LIGHT_MAX-2,
tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front_light.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = box2
},
selection_box = {
type = "fixed",
fixed = {
{-12/16, -1.5, -0.5, 12/16, 0.5, 0.5}
}
},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
after_place_node = function(pos, placer)
local node = minetest.get_node(pos)
local param2 = node.param2
pos.y = pos.y+1
if minetest.get_node(pos).name ~= "air" then
pos.y = pos.y-1
minetest.remove_node(pos)
minetest.after(0.1, function(placer)
local inv = placer:get_inventory()
local index = placer:get_wield_index()
inv:set_stack("main", index, ItemStack("farming:scarecrow_light"))
end, placer)
return
end
minetest.set_node(pos, node)
pos.y = pos.y-1
node.name = "farming:scarecrow_bottom"
minetest.set_node(pos, node)
end,
after_destruct = function(pos, oldnode)
pos.y = pos.y-1
if minetest.get_node(pos).name == "farming:scarecrow_bottom" then
minetest.remove_node(pos)
end
end
})
minetest.register_craft({
output = "farming:scarecrow_light",
recipe = {
{"", "farming:pumpkin_face_light", "",},
{"default:stick", "default:stick", "default:stick",},
{"", "default:stick", "",}
}
})
--===============
minetest.register_craftitem(":farming:pumpkin_bread", {
description = S("Pumpkin Bread"),
inventory_image = "farming_bread_pumpkin.png",
stack_max = 1,
on_use = minetest.item_eat(8)
})
minetest.register_craftitem(":farming:pumpkin_flour", {
description = "Pumpkin Flour",
inventory_image = "farming_cake_mix_pumpkin.png",
})
minetest.register_alias("farming:pumpkin_cake_mix", "farming:pumpkin_flour")
minetest.register_craft({
output = "farming:pumpkin_flour",
type = "shapeless",
recipe = {"farming:flour", "farming:pumpkin"}
})
minetest.register_craft({
type = "cooking",
output = "farming:pumpkin_bread",
recipe = "farming:pumpkin_flour",
cooktime = 10
})
-- ========= 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
})
minetest.register_craft({
type = "fuel",
recipe = "farming:big_pumpkin",
burntime = 10
})
minetest.register_craft({
type = "fuel",
recipe = "farming:scarecrow",
burntime = 5
})
minetest.register_craft({
type = "fuel",
recipe = "farming:scarecrow_light",
burntime = 5
})

View File

@ -0,0 +1,70 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_craftitem("farming_plus:rhubarb_seed", {
description = S("Rhubarb Seeds"),
inventory_image = "farming_rhubarb_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:rhubarb_1")
end
})
minetest.register_node("farming_plus:rhubarb_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_rhubarb_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:rhubarb_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_rhubarb_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+11/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:rhubarb", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_rhubarb_3.png"},
drop = {
max_items = 6,
items = {
{ items = {'farming_plus:rhubarb_seed'} },
{ items = {'farming_plus:rhubarb_seed'}, rarity = 2},
{ items = {'farming_plus:rhubarb_seed'}, rarity = 5},
{ items = {'farming_plus:rhubarb_item'} },
{ items = {'farming_plus:rhubarb_item'}, rarity = 2 },
{ items = {'farming_plus:rhubarb_item'}, rarity = 5 }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("farming_plus:rhubarb_item", {
description = S("Rhubarb"),
inventory_image = "farming_rhubarb.png",
})
farming:add_plant("farming_plus:rhubarb", {"farming_plus:rhubarb_1", "farming_plus:rhubarb_2"}, 50, 20)

View File

@ -0,0 +1,87 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_craftitem("farming_plus:strawberry_seed", {
description = S("Strawberry Seeds"),
inventory_image = "farming_strawberry_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:strawberry_1")
end
})
minetest.register_node("farming_plus:strawberry_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_strawberry_1.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,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:strawberry_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_strawberry_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:strawberry_3", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_strawberry_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+14/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:strawberry", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_strawberry_4.png"},
drop = {
max_items = 6,
items = {
{ items = {'farming_plus:strawberry_seed'} },
{ items = {'farming_plus:strawberry_seed'}, rarity = 2},
{ items = {'farming_plus:strawberry_seed'}, rarity = 5},
{ items = {'farming_plus:strawberry_item'} },
{ items = {'farming_plus:strawberry_item'}, rarity = 2 },
{ items = {'farming_plus:strawberry_item'}, rarity = 5 }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("farming_plus:strawberry_item", {
description = S("Strawberry"),
inventory_image = "farming_strawberry.png",
on_use = minetest.item_eat(2),
})
farming:add_plant("farming_plus:strawberry", {"farming_plus:strawberry_1", "farming_plus:strawberry_2", "farming_plus:strawberry_3"}, 50, 20)

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

View File

@ -0,0 +1,87 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_craftitem("farming_plus:tomato_seed", {
description = S("Tomato Seeds"),
inventory_image = "farming_tomato_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return farming:place_seed(itemstack, placer, pointed_thing, "farming_plus:tomato_1")
end
})
minetest.register_node("farming_plus:tomato_1", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_tomato_1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:tomato_2", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_tomato_2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+8/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:tomato_3", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drop = "",
tiles = {"farming_tomato_3.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+13/16, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming_plus:tomato", {
paramtype = "light",
walkable = false,
drawtype = "plantlike",
tiles = {"farming_tomato_4.png"},
drop = {
max_items = 6,
items = {
{ items = {'farming_plus:tomato_seed'} },
{ items = {'farming_plus:tomato_seed'}, rarity = 2},
{ items = {'farming_plus:tomato_seed'}, rarity = 5},
{ items = {'farming_plus:tomato_item'} },
{ items = {'farming_plus:tomato_item'}, rarity = 2 },
{ items = {'farming_plus:tomato_item'}, rarity = 5 }
}
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,plant=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craftitem("farming_plus:tomato_item", {
description = S("Tomato"),
inventory_image = "farming_tomato.png",
on_use = minetest.item_eat(4),
})
farming:add_plant("farming_plus:tomato", {"farming_plus:tomato_1", "farming_plus:tomato_2", "farming_plus:tomato_3"}, 50, 20)

View File

@ -0,0 +1,44 @@
-- main `S` code in init.lua
local S
S = farming.S
minetest.register_node(":farming:weed", {
description = S("Weed"),
paramtype = "light",
sunlight_propagates = true,
walkable = false,
drawtype = "plantlike",
tiles = {"farming_weed.png"},
inventory_image = "farming_weed.png",
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+4/16, 0.5}
},
},
groups = {snappy=3, flammable=2,plant=1},
sounds = default.node_sound_leaves_defaults()
})
minetest.register_abm({
nodenames = {"farming:soil_wet", "farming:soil"},
interval = 50,
chance = 10,
action = function(pos, node)
if minetest.find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then
return
end
pos.y = pos.y+1
if minetest.get_node(pos).name == "air" then
node.name = "farming:weed"
minetest.set_node(pos, node)
end
end
})
-- ========= FUEL =========
minetest.register_craft({
type = "fuel",
recipe = "farming:weed",
burntime = 1
})