Skip to content

[fix] Resolve CC computers attached to socket always being null - #134

Open
SamuelMereau wants to merge 1 commit into
CodinGlitch:1.21.1from
SamuelMereau:1.21.1
Open

[fix] Resolve CC computers attached to socket always being null#134
SamuelMereau wants to merge 1 commit into
CodinGlitch:1.21.1from
SamuelMereau:1.21.1

Conversation

@SamuelMereau

@SamuelMereau SamuelMereau commented Jun 25, 2026

Copy link
Copy Markdown

CommonCCCompat keeps a record of every block entity that has a socket peripheral. Each time a new SocketPeripheral is constructed, this can overwrite an earlier existing block entity. Since each peripheral keeps track of their own attached computers, if it is overwritten, it loses this record and will not fire the receive_signal event to attached computers.

This fix makes it so socket peripherals are only stored if no entry exists for the block entity, allowing the receive_signal event to be fired.

Testing with 2 CC computers with the identical receiver script running:

while true do
    local event, data, power = os.pullEvent("receive_signal")
    local socket = peripheral.find("simpleradio:speaker")
    socket.route(data, 1)
end

Previously, both computers would have never received any signal event.

Demo after applying fix:

socket-fix-demo.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant