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

Waypoint library for robots

Recommended Posts

And again i did something usefull (i hope).

With this lib you can send a robot to a waypoint with just one call.

local component = require("component")
local wp = require("wp")

wp.enableAutoCharge(true)  -- set this true for automatic charging

wp.goTo("test1", "north")  -- robot goes to waypoint with label "test1" and faces then to the north


Functions :

goTo(name, facing)

Move robot to the waypoint with the given name. Second parameter is only needed, if you want your robot to

turn to north, south, west or east after arriving. Is good if you want to use it for sucking or dropping from chests.

 

getScanRange()

Return the range in blocks a robot searches for waypoints. Standard is 256 blocks.

 

setScanRange(range)

Sets the range in blocks a robot searches for waypoints.

 

enableAutoCharge(value)

Set this to "true" if you have a waypoint with a charger, you want robots to use for automatic charging when running out of energy.

Autocharging is disable by default.

 

getAutoCharger()

Returns the label of the waypoint with the charger. Standard is "autocharger".

 

setAutoCharger(name)

Sets the label of the waypoint with the charger, if you don't want to label it "autocharger"

 

The robot will go up from 5 to 7 blocks of his starting position. Every direction (north, south, east, west) has another height robots will move to prevent collisions.

 

You can get the lib at pastebin with

pastebin get PhLMDtaN /usr/lib/wp.lua

Greetings

 

Stephan

 

 

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
Reply to this topic...

×   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.