SuperSpaceEye / Some-Peripherals

MIT License
4 stars 4 forks source link

I was able to somehow link 1 goggle to multiple goggle ports... #6

Closed 19PHOBOSS98 closed 10 months ago

19PHOBOSS98 commented 10 months ago

I know it's not suppose to be a supported feature: image https://github.com/SuperSpaceEye/Some-Peripherals/wiki/Goggle-Link-Port#goggle-link-port-is-a-block-that-allows-computer-to-interact-with-linked-goggles

But I was able to "quantum link" a goggle with two ports... It disconnects a few times tho (that's why it's flickering)...

I usually would ask the devs to fix this kind of stuff... but I like the idea of being able to read a range_goggle from multiple ports... so... could I please ask you to patch it up a bit to keep it as a feature? :)

https://github.com/SuperSpaceEye/Some-Peripherals/assets/37253663/358bb736-4283-4ee9-9d7d-e42cb76b4149

testing_goggles1&2.lua:

monitor = peripheral.find("monitor")
sp_radar = peripheral.find("sp_radar")
sp_goggles = peripheral.find("goggle_link_port")

function newLine()
    x,y = monitor.getCursorPos()
    monitor.setCursorPos(1,y+1)
end

term.clear()
term.setCursorPos(1,1)
monitor.clear()
monitor.setCursorPos(1,1)

local goggle_links = sp_goggles.getConnected()
local max_distance = 60
local euler_mode = false
local cache = false
local immediately_execute = true

while true do
    monitor.clear()
    monitor.setCursorPos(1,1)
    term.clear()
term.setCursorPos(1,1)
    local count = 0
    for k, v in pairs(sp_goggles.getConnected()) do
        local item = v.raycast(max_distance, {0, 0, 1}, euler_mode, true, cache,true)
        print("item.distance: ",item.distance)
        monitor.write("item.distance: ")
        monitor.write(item.distance)
        count = count+1
    end
    newLine()
    monitor.write("goggle count: "..count)
    print("goggle count: "..count)
    os.sleep(0)
end
SuperSpaceEye commented 10 months ago

it should be fixed now