1
0
mirror of https://github.com/XeonSquared/OC-Copper.git synced 2024-11-15 06:18:05 +11:00
OC-Copper/oc/ecomponents/app-rsctrl
20kdc b26a48165d Added a system for building 'light nodes' with minified OC-specific source.
The light node system should only be used where necessary, as light
 nodes contribute absolutely nothing to network messaging.

Maybe a minified full port of culib could be made for a "medium node",
 which would be (protocol behavior-wise) exactly like normal nodes,
 but minified and with interfaces cut down internally.
2017-03-23 01:17:57 +00:00

41 lines
758 B
Plaintext

-- I, 20kdc, release this into the public domain.
-- No warranty is provided, implied or otherwise.
%-- EXAMPLE IoT Redstone Top Controller --
UR=C.proxy(C.list("redstone")())
function UT(p)
US=p
if#p>0then
UR.setOutput(1,15)
else
UR.setOutput(1,0)
end
end
UT("")
function UG(t)
RS(t,4,"\xC0\x42active.\x81setName")
end
N={
[0]=UG,
[1]=function(f)RS(f,4,"\xC1"..US)end,
[0x41]=function(_,p)UT(p)end,
[0x82]=function(_,p)if#p>0then TH=p end end,
}
function UI(f,t,p,d)
local m=t==TH
if p==1 and(t=="*"or m)then
UG(f)
end
if p==4 and m then
if N[d:byte(1)]then
N[d:byte(1)](f,d:sub(2))
end
end
end
while true do local x={computer.pullSignal(1)}RF()
if"modem_message"==x[1]and 4957==x[4]and TC==x[6]then
RC(UI,TR(x[7]))
end
end