Skip to content

Instantly share code, notes, and snippets.

View drucifer-sc's full-sized avatar

Drew drucifer-sc

View GitHub Profile
-- SPDX-FileCopyrightText: 2017 Daniel Ratcliffe
--
-- SPDX-License-Identifier: LicenseRef-CCPL
--
-- Patched to add Classic Peripherals' Radio Towers by Drucifer (Discord) 10/2025
-- Find modems and radio towers
local tModems, tTowers, bAntFound = {}, {}, false
for _, sModem in ipairs(peripheral.getNames()) do
if peripheral.getType(sModem) == "modem" then
@drucifer-sc
drucifer-sc / exampleTunerPASC.lua
Last active August 19, 2025 10:49
A minimal code example to tune a PASC channel and begin playback, no buffering mechanism, reliant on uniformly timed packets
--Example PASC tuner, minimal code to start listening; usage: exampleTunerPASC [channel_number] (eg: exampleTunerPASC 1337)
local modem=peripheral.find("modem",function(n,v)return v.isWireless()end)
local speaker_left=peripheral.wrap("left")
local speaker_right=peripheral.wrap("right")
if not modem then error("No wireless modem found.",3) end
local args={...} --Capture arguments
local chan=args[1] and tonumber(args[1]) or nil
if type(chan)=="number" then
modem.open(chan) --Open channel
while true do --Playback loop
@drucifer-sc
drucifer-sc / exampleDiscoveryPASC.lua
Created August 14, 2025 10:28
An example script showing basic how to send/receive discovery messages.
--PASC Discovery tool
--Drucifer
local find,pullEvent,serialize=_G.peripheral.find,_G.os.pullEvent,_G.textutils.serialize
local modem=find("modem",function(n,v)return v.isWireless()end)
repeat
modem.open(759)
until modem.isOpen(759)