-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
enhancementSomething which can be improved or added. So everything?Something which can be improved or added. So everything?
Description
This would be better in a discussion, but they aren't enabled here.
If I wanted to go about adding networking, would I go along the lines of something like:
-- artist/items/network.lua
--- Provides a module to support multiple turtles on a network.
--
local modem = peripheral.find("modem")
-- This probably isn't the best way to find, or exit if there is no modem.
if not modem then return end
modem.open(1) -- Or whatever channel, doesn't really matter
return function(context)
local disabled = false -- Do not create an infinite loop :)
context.mediator:add_thread(function()
while true do
local _,_,_._,items = os.pullEvent("modem_message")
disabled = true
self.mediator:publish("items.change",items) -- This seems right? I'm not sure.
end
end)
context.mediator:subscribe("items.change",function(items)
if disabled then return end
-- Now just broadcast the new items? I have no clue how this particular event works.
modem.transmit(1,1,items)
end)
endThis is some very rough code, but it should provide an idea of what I'm thinking needs to happen in order to make this work?
Metadata
Metadata
Assignees
Labels
enhancementSomething which can be improved or added. So everything?Something which can be improved or added. So everything?