diff --git a/digger_ship.lua b/digger_ship.lua index cfd77ee..8a0c385 100644 --- a/digger_ship.lua +++ b/digger_ship.lua @@ -72,6 +72,11 @@ local function drawui() name="btnyinc", label="y+", Y=1.6, X=0.8, H=0.8, W=1.2, + },{ + command="addbutton", + name="btnup", + label="^", + Y=1.6, X=0, H=0.8, W=0.6, },{ command="addbutton", name="btnzinc", @@ -151,17 +156,15 @@ updatepositionui() end local function sendmessage(msg) - if not mem.orderId then return end - local str = "q" .. tostring(mem.orderId) - digiline_send(str, msg) - -- digiline_send("q2", msg) - -- digiline_send("q3", msg) - -- digiline_send("q4", msg) - -- digiline_send("q5", msg) - -- digiline_send("q6", msg) - -- digiline_send("q7", msg) - -- digiline_send("q8", msg) - -- digiline_send("q9", msg) + digiline_send("q1", msg) + digiline_send("q2", msg) + digiline_send("q3", msg) + digiline_send("q4", msg) + digiline_send("q5", msg) + digiline_send("q6", msg) + digiline_send("q7", msg) + digiline_send("q8", msg) + digiline_send("q9", msg) end local function displayQuarryStatus(mon, msg, name) @@ -186,6 +189,7 @@ end if event.type == "program" then mem.position = {x = 0, y = 0, z=0} mem.target = {x = 0, y = 0, z=0} + mem.radius = 8 mem.step = 17 mem.sim = false mem.msg = "" @@ -224,7 +228,8 @@ elseif event.type == "digiline" and event.channel == "jumpdrive" then elseif event.type == "interrupt" then digiline_send("pmhv", "get") digiline_send("nuclear", "get") - sendmessage("GET") + local str = "q" .. tostring(mem.orderId) + digiline_send(str, "get") mem.orderId = mem.orderId + 1 if mem.orderId > 9 then mem.orderId = 1 end interrupt(5) @@ -238,6 +243,9 @@ elseif event.type == "digiline" and event.channel == "touch" then if mem.step < 1 then mem.step = 1 end + elseif event.msg.btnup then + local y = mem.target.y + mem.radius + digiline_send("jumpdrive", { command = "set", key = "y", value = y }) elseif event.msg.btnxinc then local x = mem.target.x + mem.step digiline_send("jumpdrive", { command = "set", key = "x", value = x })