Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Base Station Script for Kino Drone (Holographic Rendering)
- local component = require("component")
- local event = require("event")
- local term = require("term")
- local modem = component.modem
- local hologram = component.hologram
- hologram.clear()
- local scan_data = {} -- Holds x, y, z, density values
- -- Configuration
- local kino_address = "a1a5a0ee-4ccf-45e7-961b-96ce5afc068c" -- Address of the Kino drone
- modem.open(123) -- Open communication port
- local function debug(msg)
- print("[DEBUG] " .. msg)
- end
- -- ✅ Increase hologram scale (Fixes tiny display issue)
- hologram.setScale(3)
- -- Main loop
- print("Base Station active. Waiting for Kino data...")
- while true do
- local _, _, sender, _, _, command, data = event.pull("modem_message")
- if command == "debug" then
- print("[Kino] " .. data)
- elseif command == "scan_data" then
- lastUpdateTime = os.time() -- ✅ Reset timeout when receiving new data
- -- ✅ Convert received string back into a table
- for x, y, z, d in string.gmatch(data, "([^,]+),([^,]+),([^,]+),([^,]+)") do
- local tx = tonumber(x) + 5
- local ty = tonumber(y) + 7
- local tz = tonumber(z) + 5
- local density = tonumber(d)
- if density and density > 0 then
- -- ✅ Store data for future use
- local key = string.format("%d,%d,%d", tx, ty, tz)
- scan_data[key] = {tx, ty, tz, density}
- hologram.set(tx, ty, tz, 1)
- debug("✅ Placed block at: HX=" .. tx .. " HY=" .. ty .. " HZ=" .. tz)
- else
- debug("⚠️ Invalid data format: " .. x .. "," .. y .. "," .. z .. "," .. d)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement