From 3f55f115c08abfb7b4781f9d79493894871c0890 Mon Sep 17 00:00:00 2001 From: D4VID Date: Wed, 25 Dec 2024 20:34:22 +0100 Subject: [PATCH] Fighting Not quite working --- drone.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drone.lua b/drone.lua index 78b5b66..a287c95 100644 --- a/drone.lua +++ b/drone.lua @@ -2,14 +2,21 @@ 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() > 1 do + while drone.getOffset() > 0.5 do computer.pullSignal(0.1) end end while true do - fly(0,2,0) - fly(10,0,0) - fly(-10,0,0) - fly(0,-2,0) + 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