Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local r = require("robot")
- local p = require("cropPositions")
- local component = require("component")
- local ic = component.inventory_controller
- superCropper = superCropper or {}
- tools = {
- boneMeal = "Bone Meal",
- seeds = "Seeds",
- cropSticks = "Crop Sticks",
- Crop = "Wheat",
- Mattock = "Mattock"
- }
- inventory = {
- boneMeal = 1,
- cropSticks = 2,
- seeds = 3,
- Crop = 4,
- Mattock = 5,
- toolHold = 13
- }
- function superCropper.equipTool(tool, count)
- currentSlot = r.select()
- r.select(tool)
- r.transferTo(inventory.toolHold, count)
- r.select(inventory.toolHold)
- ic.equip()
- r.select(currentSlot)
- end
- function superCropper.crossBreedCrop()
- superCropper.equipTool(inventory.cropSticks, 2)
- r.useDown()
- r.Up()
- end
- function superCropper.useBoneMeal()
- r.select(inventory.boneMeal)
- local seedGrew = false
- repeat
- seedGrew = r.placeDown()
- until seedGrew == false
- end
- function superCropper.growSeeds()
- superCropper.equipTool(inventory.cropSticks, 1)
- r.useDown()
- superCropper.equipTool(inventory.seeds, 1)
- r.useDown()
- superCropper.useBoneMeal()
- print("crop ready")
- end
- function superCropper.harvestCrop()
- r.swingDown()
- end
- function superCropper.goToCenter(position)
- checkArg(1, position, "string")
- if position == p.CENTER then
- print("Already in center")
- return
- elseif position == p.HOME then
- print("from home")
- r.forward()
- elseif position == p.NOON then
- print("from noon")
- r.back()
- elseif position == p.NINE then
- print("from nine")
- r.turnRight()
- r.forward()
- r.turnLeft()
- elseif position == p.THREE then
- print("from three")
- r.turnLeft()
- r.forward()
- r.turnRight()
- end
- return p.CENTER
- end
- function superCropper.goToHome(position)
- if position == p.HOME then
- return p.HOME
- end
- superCropper.goToCenter(position)
- r.back()
- return p.HOME
- end
- function superCropper.goToNine(position)
- if position == p.NINE then
- return p.NINE
- end
- superCropper.goToCenter(position)
- r.turnLeft()
- r.forward()
- r.turnRight()
- return p.NINE
- end
- function superCropper.goToNoon(position)
- if position == p.NOON then
- return p.NOON
- end
- superCropper.goToCenter(position)
- r.forward()
- return p.NOON
- end
- function superCropper.goToThree(position)
- if position == p.THREE then
- return p.THREE
- end
- superCropper.goToCenter(position)
- r.turnRight()
- r.forward()
- r.turnLeft()
- return p.THREE
- end
- pos = p.HOME
- pos = superCropper.goToNine(pos)
- superCropper.growSeeds()
- pos = superCropper.goToNoon(pos)
- superCropper.growSeeds()
- pos = superCropper.goToThree(pos)
- superCropper.growSeeds()
- pos = superCropper.goToHome(pos)
- return superCropper
Advertisement
Add Comment
Please, Sign In to add comment