summaryrefslogtreecommitdiff
path: root/cactus.lua
blob: 901a0da9b5cb37da2d30d95cf2a739e5801b7a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
local function ensure_equipped(ptype, item)
	local cur = peripheral.getType"left"
	print(cur)
	if cur == ptype then return true end
	for i = 1,16 do
		local det = turtle.getItemDetail(i)
		if det and det.name == item then
			turtle.select(i)
			return turtle.equipLeft()
		end
	end
	return false, "couldn't find "..item
end

local function ensure_modem() return ensure_equipped("modem","computercraft:wireless_modem_normal") end
local function ensure_scanner() return error("aaa") end

local x,d = ensure_modem()
print(x,d)

local loc = vector.new(gps.locate)
print(loc)