people/presets/TreeFarmer.lua

46 lines
1.3 KiB
Lua

if event.type == "program" then
mem.cur = 1
mem.actions = {
{"go", name="path_Jeiffel Tree Farm"},
{"wait", time=10},
{"go", pos={x=-173,y=9.5,z=-244}},
{"gather", nodes={"default:tree", "default:leaves", "default:apple"},
items={"default:apple", "default:sapling"},
plant="default:sapling"}
{"go", pos={x=-173,y=9.5,z=-250}},
{"go", pos={x=-169,y=9.5,z=-250}},
{"go", pos={x=-169,y=9.5,z=-244}},
{"wait", time=120},
-- Leave the item gathering on for the rest of the time - might as
-- well clean up any that are lying around near the paths.
{"gather", items={"default:apple", "default:sapling"}},
-- Chuck all harvested stuff in the recycle bin. It will end up
-- at the factory.
{"go", name="path_Jeiffel Tower"},
{"wait", time=5},
{"go", pos={x=-221,y=1.5,z=-187}},
{"stash", dest="default:chest",
items={"default:tree",
"default:leaves",
"default:apple",
"default:sapling"}}
}
elseif event.type == "act" then
action = mem.actions[mem.cur]
mem.cur = mem.cur + 1
if mem.cur > #mem.actions then
mem.cur = 1
end
end