local _redstone_site = "right"
function search(perToFind)
local printMode = false
if perToFind == "print" then
printMode=true
end
if printMode == true then
term.clear()
term.setCursorPos(1,1)
end
local sides = { "top", "bottom", "left", "right", "front", "back" }
for i = 1, #sides do
if peripheral.isPresent(sides[i]) then
if peripheral.getType(sides[i]) == "modem" then
local modem = peripheral.wrap(sides[i])
local methods = peripheral.getMethods(sides[i])
local wired = false
for j = 1, #methods do
if methods[j] == "getNamesRemote" then
wired=true
end
end
if wired == true then
if printMode == true then
print("There is " ..peripheral.getType(sides[i]).." on the "..sides[i] )
else
if perToFind==peripheral.getType(sides[i]) then
return sides[i]
end
----------------------------------------------------------------
end
local net = modem.getNamesRemote()
for j = 1, #net do
if printMode == true then
print(" ".. peripheral.getType(net[j]))
else
if perToFind==peripheral.getType(net[j]) then
return net[j]
end
---------------------------------
end
end
else
if printMode == true then
print("There is wireless modem on the "..sides[i] )
else
if perToFind==peripheral.getType(sides[i]) then
return sides[i]
end
---------------------------------
end
end
else
if printMode == true then
print("There is " ..peripheral.getType(sides[i]).." on the "..sides[i] )
else
if perToFind==peripheral.getType(sides[i]) then
return sides[i]
end
-----------------------
end
end
else
if printMode == true then
print("There is nothing on the "..sides[i] )
end
end
end
end
local filling = false
rs.setOutput(_redstone_site,false)
local fill=0
while true do
os.sleep (1)
local _tank_info = peripheral.call(search("net_minecraft_src_buildcraft_factory_tiletank"),"getTankInfo","")[1]
if _tank_info.amount then
fill=(_tank_info.amount/_tank_info.capacity*100)
else
fill=0
end
print(fill)
if filling == false then
if fill <= 10 then
filling = true
rs.setOutput(_redstone_site,true)
end
else
if fill >= 90 then
filling = false
rs.setOutput(_redstone_site,false)
end
end
end
Comments
0 B
|👍
/👎