CC: Tweaked

CC: Tweaked

42M Downloads

Ability to connect peripherals to a modem via lua (modem api?)

fatboychummy opened this issue ยท 6 comments

commented

So I was making a thing today with turtles which builds some furnaces and etc on top of modems. I, however, ran into a problem which cannot be solved via any available APIs.

I cannot connect said furnaces to the network, unless I walk my character to the location manually and do it myself.

I am requesting a simple addon to the modem API to be able to do this.

It would look something like the following:

local modem = peripheral.wrap("modem_bla")
modem.connect()
modem.disconnect()

this would connect/disconnect all peripherals attached to the modem to the network, and (potentially) return names of the newly added peripherals (much like right-clicking the modem block does). This would be useful not only for plethora, but also when using a turtle to build a computer-cluster attached to modems in 'vanilla' (just cc:tweaked).

commented

This could also be addressed by #125, having the ability to right-click a modem would help as well (and do exactly as is stated here). However, a computer would not be able to connect modems.

commented

Just adding another idea to this because random thoughts are random:

Having modem_[dis]connected events for when a modem is manually connected or disconnected would be helpful as well for a mainframe to ensure security in a wired network.

commented

@fatboychummy peripheral/peripheral_detach events should work on remote peripherals if I'm not mistaken.

commented

Do modems fire peripheral events?

commented

@fatboychummy peripheral/peripheral_detach events should work on remote peripherals if I'm not mistaken.

While yes they do exist, if we get the ability to 'enable or disable' modems via Lua commands, it would be nice to know if the modem has been enabled so we can disable it immediately if need be, rather than looping through each modem to see what modem the peripheral returned by peripheral_attach is attached to.

Alternatively, reenabling modems that got accidentally right-clicked or something.