Adding Mod content
This code adds; > Potatos > Carrots > leeks > Tomatos > Sweet Cornmaster
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
farming
|
|
@ -0,0 +1,39 @@
|
|||
print("Loading Beer_Test")
|
||||
print("###########################################################")
|
||||
print("")
|
||||
print("farm Test")
|
||||
|
||||
print("Checking For Beer Test")
|
||||
if minetest.get_modpath("beer_test") then
|
||||
print("Farm_test: Loading 'Beer_test_suport.lua'")
|
||||
dofile(minetest.get_modpath("farm_test").."/mod_files/Beer_test_suport.lua")
|
||||
print("Done")
|
||||
else
|
||||
print("Beer Test Not Found")
|
||||
end
|
||||
|
||||
|
||||
print("Farm_test: Loading 'crafts.lua'")
|
||||
dofile(minetest.get_modpath("farm_test").."/mod_files/crafts.lua")
|
||||
|
||||
print("Farm_test: Loading 'farming.lua'")
|
||||
dofile(minetest.get_modpath("farm_test").."/mod_files/farming.lua")
|
||||
|
||||
print("Types of plants: Loading")
|
||||
|
||||
print("Farm_test: Loading 'tomatos.lua'")
|
||||
dofile(minetest.get_modpath("farm_test").."/mod_files/tomatos.lua")
|
||||
|
||||
print("Farm_test: Loading 'sweet_corn.lua'")
|
||||
dofile(minetest.get_modpath("farm_test").."/mod_files/sweet_corn.lua")
|
||||
|
||||
print("Farm_test: Loading 'root-plant.lua'")
|
||||
dofile(minetest.get_modpath("farm_test").."/mod_files/root-plant.lua")
|
||||
|
||||
print("")
|
||||
print("###########################################################")
|
||||
print("Beer_Test has loaded successfully ")
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
--======================--
|
||||
-- beer_test --
|
||||
--======================--
|
||||
|
||||
-- Beer Test is need for this to work --
|
||||
|
||||
|
||||
minetest.register_node("farm_test:test", {
|
||||
description = "Test Item Beer Test",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "Sweet Corn Seeds",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"test.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, 0.5, -0.1, 0.1, -0.5, 0.1}
|
||||
},
|
||||
},
|
||||
})
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
-------=============================================[--]--
|
||||
print("Farm_test: crafts.lua [ok]")
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
--======================--
|
||||
-- Items --
|
||||
--======================--
|
||||
|
||||
|
||||
minetest.register_craftitem("farm_test:red_tomato", {
|
||||
description = "Red Tomato",
|
||||
inventory_image = "farm_test_tomato_red.png",
|
||||
})
|
||||
--======================--
|
||||
-- Blocks --
|
||||
--======================--
|
||||
|
||||
--======================--
|
||||
-- Plants --
|
||||
--======================--
|
||||
|
||||
-----------------------
|
||||
-- Tomatoes growing --
|
||||
-----------------------
|
||||
-- tomato --
|
||||
|
||||
minetest.register_node("farm_test:tomato_9", {
|
||||
description = "tomatos_9",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "farm_test:tomatos",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_tomato_9.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("farm_test:tomato_9a", {
|
||||
description = "tomatos_9a",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "farm_test:red_tomatos",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_tomato_9a.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
on_punch = function(pos, node, puncher)
|
||||
local tool = puncher:get_wielded_item():get_name()
|
||||
if tool and tool == "" then
|
||||
node.name = "farm_test:tomato_9"
|
||||
minetest.env:set_node(pos, node)
|
||||
puncher:get_inventory():add_item("main", ItemStack("farm_test:red_tomato"))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Growing --
|
||||
minetest.register_craftitem("farm_test:tomato", {
|
||||
description = "Red Tomato",
|
||||
inventory_image = "farm_test_tomato_red.png",
|
||||
})
|
||||
|
||||
|
||||
|
||||
farming.register_plant("farm_test:tomato", {
|
||||
description = "Tomato Seed",
|
||||
inventory_image = "farm_test_tomato_green.png",
|
||||
drop = "farm_test:seed_tomato",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = LIGHT_MAX,
|
||||
fertility = {"grassland"}
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:tomato_8", "farm_test:tomato_9"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_8"})
|
||||
end
|
||||
-- check if there is air nearby
|
||||
if minetest.find_node_near(pos, 5, {"air"}) then
|
||||
if node.name == "farm_test:tomato_8" then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:tomato_9", "farm_test:tomato_9a"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_8"})
|
||||
end
|
||||
-- check if there is air nearby
|
||||
if minetest.find_node_near(pos, 5, {"air"}) then
|
||||
if node.name == "farm_test:tomato_9" then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9a"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- grow up up and away!--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:tomato_9a"},
|
||||
neighbors = {"farming:soil_wet"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "farming:soil_wet" or name == "default:dirt_with_grass" or name == "farming:soil" or name == "default:dirt" then
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "farm_test:tomato_9a" and height < 4 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9a"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--[[
|
||||
for i=1,8 do
|
||||
local drop = {
|
||||
items = {
|
||||
{items = {'farm_test:tomato'},rarity=9-i},
|
||||
{items = {'farm_test:tomato'},rarity=18-i*2},
|
||||
{items = {'farm_test:tomato'},rarity=27-i*3},
|
||||
{items = {'farm_test:seed_tomato'},rarity=9-i},
|
||||
{items = {'farm_test:seed_tomato'},rarity=18-i*2},
|
||||
{items = {'farm_test:seed_tomato'},rarity=27-i*3},
|
||||
--{items = {'farm_test:crop'},rarity=1-i},--
|
||||
}
|
||||
}
|
||||
minetest.register_node("farm_test:tomato_"..i, {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farm_test_tomato_"..i..".png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
drop = drop,it
|
||||
groups = {snappy=3,flammable=2,plant=1,tomato=i,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:tomato"},
|
||||
neighbors = {"group:soil"},
|
||||
interval = 80,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
-- return if already full grown
|
||||
if minetest.get_item_group(node.name, "tomato") == 8 then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if on wet soil
|
||||
pos.y = pos.y-1
|
||||
local n = minetest.get_node(pos)
|
||||
if minetest.get_item_group(n.name, "soil") < 3 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
|
||||
-- check light
|
||||
if not minetest.get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- grow
|
||||
local height = minetest.get_item_group(node.name, "tomato") + 1
|
||||
minetest.set_node(pos, {name="farm_test:tomato_"..height})
|
||||
end
|
||||
})
|
||||
]]
|
||||
-------=============================================[--]--
|
||||
print("Farm_test: farming.lua [ok]")
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
--======================--
|
||||
-- Items --
|
||||
--======================--
|
||||
|
||||
--======================--
|
||||
-- Blocks --
|
||||
--======================--
|
||||
|
||||
minetest.register_node("farm_test:growing_rope", {
|
||||
description = "Growing Suspension rope",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"farm_test_rope.png", "farm_test_rope.png", "farm_test_rope_side.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.08, -0.08, -0.85, 0.08, 0.08, 0.85}, -- side f
|
||||
--{-0.1, -0.5, -0.1, 0.1, 0.7, 0.1}, -- floor
|
||||
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.15, -0.15, -0.85, 0.15, 0.15, 0.85}, -- side f
|
||||
},
|
||||
},
|
||||
on_punch = function(pos, node, puncher)
|
||||
local tool = puncher:get_wielded_item():get_name()
|
||||
if tool and tool == "farm_test:growing_rope_down" then
|
||||
node.name = "farm_test:growing_rope_1"
|
||||
minetest.env:set_node(pos, node)
|
||||
puncher:get_inventory():remove_item("main", ItemStack("farm_test:growing_rope_down"))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farm_test:growing_rope_down", {
|
||||
description = "Growing rope",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"farm_test_rope.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
--{-0.1, -0.1, -0.9, 0.1, 0.1, 0.9}, -- side f
|
||||
{-0.06, -0.5, -0.06, 0.06, 0.5, 0.06}, -- floor
|
||||
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, -0.5, -0.1, 0.1, 0.5, 0.1}, -- side f
|
||||
},
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node("farm_test:growing_rope_1", {
|
||||
description = "Growing rope",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"farm_test_rope.png","farm_test_rope.png","farm_test_rope_side.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = {
|
||||
max_items = 2,
|
||||
items = {
|
||||
{ items = {'farm_test:growing_rope_down'} },
|
||||
{items = {'farm_test:growing_rope'} },
|
||||
}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.08, -0.08, -0.5, 0.08, 0.08, 0.5}, -- side f
|
||||
{-0.06, -0.5, -0.06, 0.06, 0.06, 0.06}, -- floor
|
||||
{-0.12, -0.12, -0.12, 0.12, 0.12, 0.12}, -- floor
|
||||
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.12, -0.5, -0.12, 0.12, 0.12, 0.12}, -- side f
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
--======================--
|
||||
-- Plants --
|
||||
--======================--
|
||||
|
||||
-- Powered by PilzAdam Registerd Plants --
|
||||
|
||||
|
||||
|
||||
-------=============================================[--]--
|
||||
print("Farm_test: farm_test.lua [ok]")
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
-- oats --
|
||||
|
||||
farming.register_plant("farm_test:potato", {
|
||||
description = "Potato",
|
||||
inventory_image = "farm_test_potato_seed.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = LIGHT_MAX,
|
||||
fertility = {"grassland"}
|
||||
})
|
|
@ -0,0 +1,59 @@
|
|||
--======================--
|
||||
-- Carrots --
|
||||
--======================--
|
||||
|
||||
farming.register_plant("farm_test:carrot", {
|
||||
description = "Carrot Sprout",
|
||||
inventory_image = "farm_test_carrot_sprouted.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = LIGHT_MAX,
|
||||
fertility = {"grassland"}
|
||||
})
|
||||
|
||||
--======================--
|
||||
-- Potatos --
|
||||
--======================--
|
||||
|
||||
|
||||
farming.register_plant("farm_test:potato", {
|
||||
description = "Potato Sprout",
|
||||
inventory_image = "farm_test_potato_sprouted.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = LIGHT_MAX,
|
||||
fertility = {"grassland"}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("farm_test:soil_potato", {
|
||||
description = "Wet With Potatos",
|
||||
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_potato_side.png"},
|
||||
drop = "default:dirt",
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farming:soil_wet"},
|
||||
neighbors = {"farm_test:potato_7", "farm_test:potato_8"},
|
||||
interval = 10.0, -- Run every 10 seconds
|
||||
chance = 50, -- Select every 1 in 50 nodes
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "farm_test:soil_potato"})
|
||||
end
|
||||
})
|
||||
|
||||
--======================--
|
||||
-- leek --
|
||||
--======================--
|
||||
|
||||
farming.register_plant("farm_test:leek", {
|
||||
description = "Leek Seeds",
|
||||
inventory_image = "farm_test_leek_seed.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = LIGHT_MAX,
|
||||
fertility = {"grassland"}
|
||||
})
|
|
@ -0,0 +1,147 @@
|
|||
--======================--
|
||||
-- Plants --
|
||||
--======================--
|
||||
|
||||
------------------------
|
||||
-- sweetcorn growing --
|
||||
------------------------
|
||||
|
||||
farming.register_plant("farm_test:sweet_corn", {
|
||||
description = "Sweet Corn Seeds",
|
||||
inventory_image = "farm_test_sweet_corn_seed.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = LIGHT_MAX,
|
||||
fertility = {"grassland"}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("farm_test:sweet_corn_9", {
|
||||
description = "farm_test:sweet_corn_9",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "Sweet Corn Seeds",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_plant_sweet_corn.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, 0.5, -0.1, 0.1, -0.5, 0.1}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("farm_test:sweet_corn_9a", {
|
||||
description = "farm_test:sweet_corn_9a",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "Sweet Corn Seeds",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_plant_sweet_corn.png^farm_test_plant_sweetcorn.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, 0.5, -0.1, 0.1, -0.5, 0.1}
|
||||
},
|
||||
},
|
||||
on_punch = function(pos, node, puncher)
|
||||
local tool = puncher:get_wielded_item():get_name()
|
||||
if tool and tool == "" then
|
||||
node.name = "farm_test:sweet_corn_9"
|
||||
minetest.env:set_node(pos, node)
|
||||
puncher:get_inventory():add_item("main", ItemStack("farm_test:sweet_corn"))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farm_test:sweet_corn_tassel", {
|
||||
description = "farm_test:sweet_corn_tassel",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "Sweet Corn Seeds",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_plant_sweet_corn_tassel.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, 0.5, -0.1, 0.1, -0.5, 0.1}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- switch plant stages --
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:sweet_corn_8", "farm_test:sweet_corn_9"},
|
||||
interval = 15,
|
||||
chance = 5,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
||||
minetest.set_node(pos, {name="farm_test:sweet_corn_8"})
|
||||
end
|
||||
-- check if there is air nearby
|
||||
if minetest.find_node_near(pos, 5, {"air"}) then
|
||||
if node.name == "farm_test:sweet_corn_8" then
|
||||
minetest.set_node(pos, {name="farm_test:sweet_corn_9"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:sweet_corn_9", "farm_test:sweet_corn_9a"},
|
||||
interval = 15,
|
||||
chance = 5,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
||||
minetest.set_node(pos, {name="farm_test:sweet_corn_9"})
|
||||
end
|
||||
-- check if there is air nearby
|
||||
if minetest.find_node_near(pos, 5, {"air"}) then
|
||||
if node.name == "farm_test:sweet_corn_9" then
|
||||
minetest.set_node(pos, {name="farm_test:sweet_corn_9a"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- grow up up and away!--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:sweet_corn_9a"},
|
||||
neighbors = {"farming:soil_wet"},
|
||||
interval = 2,
|
||||
chance = 5,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "farming:soil_wet" or name == "default:dirt_with_grass" or name == "farming:soil" or name == "default:dirt" then
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "farm_test:sweet_corn_9a" and height < 1 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="farm_test:sweet_corn_tassel"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,384 @@
|
|||
--======================--
|
||||
-- Items --
|
||||
--======================--
|
||||
|
||||
|
||||
minetest.register_craftitem("farm_test:red_tomato", {
|
||||
description = "Red Tomato",
|
||||
inventory_image = "farm_test_tomato_red.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farm_test:green_tomato", {
|
||||
description = "Green Tomato",
|
||||
inventory_image = "farm_test_tomato_green.png",
|
||||
})
|
||||
|
||||
--======================--
|
||||
-- Crafts --
|
||||
--======================--
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farm_test:seed_tomato",
|
||||
recipe = {
|
||||
{"farm_test:red_tomato"},
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farm_test:seed_tomato",
|
||||
recipe = {
|
||||
{"farm_test:green_tomato"},
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
--======================--
|
||||
-- Plants --
|
||||
--======================--
|
||||
|
||||
-----------------------
|
||||
-- Tomatoes growing --
|
||||
-----------------------
|
||||
-- tomato --
|
||||
|
||||
--
|
||||
-- Place seeds
|
||||
--
|
||||
local function place_seed(itemstack, placer, pointed_thing, plantname)
|
||||
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
|
||||
|
||||
minetest.register_craftitem("farm_test:seed_tomato", {
|
||||
description = "tomato Seed",
|
||||
inventory_image = "farm_test_tomato_seed.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_seed(itemstack, placer, pointed_thing, "farm_test:tomato_1")
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
for i=1,8 do
|
||||
local drop = {
|
||||
items = {
|
||||
--{items = {'farm_test:yellow_tomato'},rarity=18-i},
|
||||
--{items = {'farm_test:yellow_tomato'},rarity=27-i*2},
|
||||
{items = {'farm_test:green_tomato'},rarity=9-i},
|
||||
{items = {'farm_test:green_tomato'},rarity=18-i*2},
|
||||
{items = {'farm_test:green_tomato'},rarity=27-i*3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farm_test:tomato_"..i, {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farm_test_tomato_"..i..".png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
drop = drop,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
groups = {snappy=3,flammable=2,plant=1,tomato=i,not_in_creative_inventory=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:tomato"},
|
||||
neighbors = {"group:soil"},
|
||||
interval = 80,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
-- return if already full grown
|
||||
if minetest.get_item_group(node.name, "tomato") == 8 then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if on wet soil
|
||||
pos.y = pos.y-1
|
||||
local n = minetest.get_node(pos)
|
||||
if minetest.get_item_group(n.name, "soil") < 3 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
|
||||
-- check light
|
||||
if not minetest.get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- grow
|
||||
local height = minetest.get_item_group(node.name, "tomato") + 1
|
||||
minetest.set_node(pos, {name="farm_test:tomato_"..height})
|
||||
end
|
||||
})
|
||||
|
||||
-- oars 9 and 9a --
|
||||
|
||||
minetest.register_node("farm_test:tomato_9", {
|
||||
description = "farm_test:tomato_9",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "farm_test:green_tomato",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_plant_tomato.png^farm_test_plant_green_tomato.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, 0.5, -0.1, 0.1, -0.5, 0.1}
|
||||
},
|
||||
},
|
||||
on_punch = function(pos, node, puncher)
|
||||
local tool = puncher:get_wielded_item():get_name()
|
||||
if tool and tool == "" then
|
||||
node.name = "farm_test:tomato_9b"
|
||||
minetest.env:set_node(pos, node)
|
||||
puncher:get_inventory():add_item("main", ItemStack("farm_test:green_tomato"))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("farm_test:tomato_9a", {
|
||||
description = "farm_test:tomato_9a",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "farm_test:tomato",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_plant_tomato.png^farm_test_plant_red_tomato.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, 0.5, -0.1, 0.1, -0.5, 0.1}
|
||||
},
|
||||
},
|
||||
on_punch = function(pos, node, puncher)
|
||||
local tool = puncher:get_wielded_item():get_name()
|
||||
if tool and tool == "" then
|
||||
node.name = "farm_test:tomato_9b"
|
||||
minetest.env:set_node(pos, node)
|
||||
puncher:get_inventory():add_item("main", ItemStack("farm_test:red_tomato"))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("farm_test:tomato_9b", {
|
||||
description = "farm_test:tomato_9b",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "farm_test:green_tomato",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_plant_tomato.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, 0.5, -0.1, 0.1, -0.5, 0.1},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("farm_test:tomato_9c", {
|
||||
description = "farm_test:tomato_9c",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
drop = "farm_test:green_tomato",
|
||||
drawtype = "plantlike",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"farm_test_plant_tomato.png^farm_test_plant_flower_tomato.png"},
|
||||
groups = {chopspy=2, oddly_breakable_by_hand=3, flammable=2, plant=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.1, 0.5, -0.1, 0.1, -0.5, 0.1},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- Grow Plant --
|
||||
|
||||
-- grow tomatos on plant --
|
||||
|
||||
-- farming:add_plant("farm_test:tomato_8", {"farm_test:tomato_9"}, 80, 20)
|
||||
|
||||
|
||||
|
||||
|
||||
-- Regrowing tomatos when picked --
|
||||
|
||||
-- old crappy code --
|
||||
|
||||
--[[ ]]--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:tomato_8", "farm_test:tomato_9"},
|
||||
interval = 15,
|
||||
chance = 5,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_8"})
|
||||
end
|
||||
-- check if there is air nearby
|
||||
if minetest.find_node_near(pos, 5, {"air"}) then
|
||||
if node.name == "farm_test:tomato_8" then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:tomato_9", "farm_test:tomato_9a"},
|
||||
interval = 30,
|
||||
chance = 50,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9"})
|
||||
end
|
||||
-- check if there is air nearby
|
||||
if minetest.find_node_near(pos, 5, {"air"}) then
|
||||
if node.name == "farm_test:tomato_9" then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9a"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:tomato_9b", "farm_test:tomato_9c"},
|
||||
interval = 15,
|
||||
chance = 5,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9b"})
|
||||
end
|
||||
-- check if there is air nearby
|
||||
if minetest.find_node_near(pos, 5, {"air"}) then
|
||||
if node.name == "farm_test:tomato_9b" then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9c"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:tomato_9c", "farm_test:tomato_9"},
|
||||
interval = 15,
|
||||
chance = 5,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y+1
|
||||
local nn = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1
|
||||
if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9c"})
|
||||
end
|
||||
-- check if there is air nearby
|
||||
if minetest.find_node_near(pos, 5, {"air"}) then
|
||||
if node.name == "farm_test:tomato_9c" then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9"})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--[[ ]]--
|
||||
|
||||
-- grow up up and away!--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"farm_test:tomato_9a"},
|
||||
neighbors = {"farming:soil_wet"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "farming:soil_wet" or name == "default:dirt_with_grass" or name == "farming:soil" or name == "default:dirt" then
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "farm_test:tomato_9a" and height < 2 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="farm_test:tomato_9"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-------=============================================[--]--
|
||||
print("Farm_test: farm_test.lua [ok]")
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<html>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
<div class="main-body">
|
||||
<h1> READ ME </h1>
|
||||
<br>
|
||||
<p>
|
||||
Thank you for Downloading Beer Test Mod. Here are some
|
||||
</p>
|
||||
<br>
|
||||
<br>
|
||||
<h1> License </h1>
|
||||
<br>
|
||||
<p> This Mod is Under the creative commons </p>
|
||||
|
||||
</div>
|
||||
</html>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-image: url(http://trps.raspberryip.com/Infinatum_Minetest/images/bgimage.png);
|
||||
}
|
||||
|
||||
.main-body {
|
||||
width: 800px;
|
||||
background-color: #E1E1E1;
|
||||
margin: 80px auto;
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 337 B |
After Width: | Height: | Size: 337 B |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 311 B |
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 173 B |
After Width: | Height: | Size: 187 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 291 B |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 361 B |
After Width: | Height: | Size: 458 B |
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 163 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 297 B |
After Width: | Height: | Size: 371 B |
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 501 B |
After Width: | Height: | Size: 533 B |
After Width: | Height: | Size: 555 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 429 B |
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 170 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 284 B |
After Width: | Height: | Size: 467 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 504 B |
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 289 B |
After Width: | Height: | Size: 385 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 456 B |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 428 B |
After Width: | Height: | Size: 437 B |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 661 B |
After Width: | Height: | Size: 3.4 KiB |