You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
664 B

local drone = component.proxy(component.list("drone")())
local function fly(dx, dy, dz)
drone.move(dx, dy, dz)
drone.setStatusText(math.floor(dx) .. "," .. math.floor(dy) .. "," .. math.floor(dz))
while drone.getOffset() > 0.5 do
computer.pullSignal(0.1)
end
end
while true do
local signal = table.pack(computer.pullSignal())
if signal[1] == "motion" then
if signal[6] == "Zombie" then
fly(signal[3], signal[4]+2, signal[5])
if drone.getOffset() < 1 then
drone.setStatusText('' .. drone.getOffset())
drone.swing(3) -- forward
end
end
end
end