From 11c46702133916c2714afe807664e19e178cc5da Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Wed, 5 Dec 2018 21:20:50 -0500 Subject: [PATCH] milo: single wired modem only --- milo/Milo.lua | 11 ++++++++++- milo/plugins/remote.lua | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/milo/Milo.lua b/milo/Milo.lua index eb412dd..4d06bc0 100644 --- a/milo/Milo.lua +++ b/milo/Milo.lua @@ -85,7 +85,16 @@ Turtle must be connected to: error(msg) end -local modem = Peripheral.get('wired_modem') +local modem +for _,v in pairs(device) do + if v.type == 'wired_modem' then + if modem then + Syntax('Only 1 wired modem can be connected') + end + modem = v + end +end + if not modem or not modem.getNameLocal then Syntax('Wired modem missing') end diff --git a/milo/plugins/remote.lua b/milo/plugins/remote.lua index a93437b..2aaab82 100644 --- a/milo/plugins/remote.lua +++ b/milo/plugins/remote.lua @@ -105,7 +105,7 @@ local function client(socket) if node then local slot = node.adapter.getItemMeta(slotNo) if slot then - if context.storage:import(node, slotNo, slot.count, slot) then + if context.storage:import(node, slotNo, slot.count, slot) > 0 then local item = Milo:getItem(Milo:listItems(), slot) if item then socket:write({