Calculating heading returns heading message on success.

Status request now displays previously hidden heading information.
This commit is contained in:
Harrison Deng 2021-05-03 15:33:13 -05:00
parent 4241ed4d03
commit d95cae9caf
2 changed files with 3 additions and 2 deletions

View File

@ -101,8 +101,8 @@ local function handleMessage(sender, type, data)
if type == LOG then
print("[" .. sender .. "]: " .. data["log"] .. ": " .. (data["content"]["n"] >= 1 and tostring(data["content"][1]) or ""))
if data["log"] == STATUS then
print("Relative position: " .. textutils.serializeJSON(data["content"][1]["relative_position"]["coordinates"]))
print("Position: " .. (data["content"][1]["position"]["coordinates"] and textutils.serialiseJSON(data["content"][1]["position"]["coordinates"]) or "not positioned."))
print("Relative position: " .. textutils.serializeJSON(data["content"][1]["relative_position"]))
print("Position: " .. (data["content"][1]["position"]["coordinates"] and textutils.serialiseJSON(data["content"][1]["position"]) or "not positioned."))
print("fuel: " .. tostring(data["content"][1]["fuel"]))
print("current task: " .. data["content"][1]["task"])
end

View File

@ -274,6 +274,7 @@ local function determineHeading()
end
heading = fDelta
rightAxis = position - oldPos
sendLog(HEADING, "Heading obtained. \nForward: " .. heading .. "\nRight direction: " .. rightAxis)
end
local function moveBy(delta, forward, right)