78 lines
2.0 KiB
Lua
Raw Normal View History

2020-11-21 20:09:50 +00:00
-- CC0/Unlicense Emilia 2020
local seeds = {
"mcl_farming:wheat_seeds",
"mcl_farming:beetroot_seeds",
"mcl_farming:carrot_item",
"mcl_farming:potato_item"
2020-11-21 20:09:50 +00:00
}
local nodeseeds = {
"mcl_farming:melon_seeds",
"mcl_farming:pumpkin_seeds"
}
local tillable = {
"mcl_core:dirt",
"mcl_core:dirt_with_grass",
"mcl_farming:soil"
}
local hoes = {
"mcl_farming:hoe_wood",
"mcl_farming:hoe_stone",
"mcl_farming:hoe_iron",
"mcl_farming:hoe_gold",
"mcl_farming:hoe_diamond"
}
local water = {
"mcl_core:water_source",
"mcl_buckets:bucket_water",
"mcl_buckets:bucket_river_water"
}
scaffold.register_template_scaffold("AutoFarm", "scaffold_farm", function(below)
local lp = vector.round(minetest.localplayer:get_pos())
-- farmland
2020-11-22 01:29:28 +00:00
if below.x % 5 ~= 0 or below.z % 5 ~= 0 then
2020-11-21 20:09:50 +00:00
if scaffold.place_if_needed(tillable, below) then
if scaffold.can_place_at(lp) then
if scaffold.find_any_swap(hoes) then
minetest.interact("place", below)
scaffold.place_if_needed(seeds, lp)
end
end
end
-- water
else
scaffold.place_if_needed(water, below)
end
end)
scaffold.register_template_scaffold("AutoMelon", "scaffold_melon", function(below)
local lp = vector.round(minetest.localplayer:get_pos())
local x = below.x % 5
local z = below.z % 5
-- water
if x == 0 and z == 0 then
scaffold.place_if_needed(water, below)
-- dirt
elseif z == 2 or z == 4 or ((x == 2 or x == 4) and z == 0) then
scaffold.place_if_needed(tillable, below)
-- farmland
elseif (x == 1 or z == 1) or (x == 3 or z == 3) then
if scaffold.place_if_needed(tillable, below) then
if scaffold.can_place_at(lp) then
if scaffold.find_any_swap(hoes) then
minetest.interact("place", below)
scaffold.place_if_needed(nodeseeds, lp)
end
end
end
end
end)