Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
RadarUnder

Need help making robots harvest

Question

Hi, I've very new to opencomputers, I've recently started playing a modpack with includes this mod and I want to try to use the robots in this mod to harvest oreberry bushes from tinkers construct and put them in a barrel if possible. I have no idea how to do any of this, I'm willing to try to learn if someone can help me. I've read various posts, tutorial, and even the lua website but I'm having no luck understanding what to do. I know how to do basic commands with the robot like have it move and harvest the berries (use) but I'm not sure how to put this together so it can move around my oreberry farm harvest them all and deposit in a barrel. Hope someone can help.

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

This is very generic, not knowing how much you know and want to learn on your own. If not enough, ask more specific questions and I'll answer as best I can. I tried to write this to translate well into functions and basic commands.

 

start a file: gatherBerries.oc.lua make sure it starts with

local computer = require("computer")
local robot = require("robot")

to have access to needed commands.

 

Some notes on what it was intended for, who wrote it and when, are nice to have.

--[[

Tinker's Construct OreBerry Gatherer v0.3

for OpenComputers v1.47

Written by Me on 2015Feb14

Requires: Square room with barrels and (blah blah blah)

Robot/Drone Requires: (more blah blah)

so on and so forth

]]--

 

Since you didn't say how you have your berries set up, I'll generalize some more and guess a little. You have a square room filled with a layer of bushes, sorted or not, with enough head room for you to walk around. Some of it is probably empty or walkways. Little or no torchlight, so mobs might be an issue. Your doorway is in a corner with a Charger, five barrels, and a water block to the left of the door, same height as the bushes. Place the robot on top of the Charger and turn it towards the door.

 

+  --------------------

|   CBBBBBWbb    (Crude ascii mockup of corner)

|   bbbbbbbbbb

 

Break down to smaller steps: Pause and Recharge - Collection - Dropping Off - Repeat

 

   Pause and Recharge

 

while (computer.energy() < (computer.maxEnergy() *0.95))
do
  os.sleep(1)  -- do nothing for one second
end

 

or just wait however many minutes while over the Charger (Make sure it is on and glowing, give it a redstone signal and some power). Got to give the bushes time to grow.

 

   Collection

 

Move forward and turn left. This will put you at the door facing into the room. Move to the back wall and turn left.

 

Check what's below you.

If the block below you is liquid (our water next to the barrels), stop what you are doing here and move on to Dropping Off.

Otherwise try a grab a berry.

Move forward.

When you can't move forward and the block in front of you is solid (the wall), turn left or right as needed. Move forward, turn again and start over. If an entity, wait a few seconds and try again.

 

   Dropping Off

 

For each slot, keep trying to dropDown a nugget into successive barrels until one returns true, then dump the rest of that stack. Start over with the next stack and first barrel until empty.

 

   Repeat

 

Do it all over again.

 

 

Notes:

  • Using half-slabs as walkways will help with mob spawning.
  • There are mod items that help with stopping mob spawning as well.
  • For the robot to end up over the water, the walls should be an even (16x16), not odd number. Do some testing to find out why.

 

Good luck! Be sure to put your finished code up on pastebin and give us a post about your experience.

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.