Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Select(peripheralType)
- local peripherals = peripheral.getNames();
- local selectedPeripherals = {};
- for _, device in pairs(peripherals) do
- if peripheral.getType(device) == peripheralType then
- selectedPeripherals[device] = peripheral.wrap(device);
- end
- end
- return selectedPeripherals;
- end
- function SelectTanksByContents(contentType)
- local filteredTanks = {};
- for k, v in pairs(Select("thermalexpansion_tank")) do
- if GetTankInfo(v).Contents.Name == contentType then
- table.insert(filteredTanks, v);
- end
- end
- return filteredTanks;
- end
- function GetAllTankContentTypes()
- local contentTypes = {};
- local tanks = Select("thermalexpansion_tank");
- for k,v in pairs(tanks) do
- local contentType = GetTankInfo(v).Contents.Name
- if contentTypes[contentType] == nil then
- contentTypes[contentType] = contentType;
- end
- end
- return contentTypes;
- end
- function PrintMethods(deviceName, wrappedDevice)
- local methods = peripheral.getMethods(deviceName);
- for k, v in pairs(methods) do
- textutils.pagedPrint(k);
- end
- if wrappedDevice ~= nil then
- textutils.pagedPrint(wrappedDevice.listMethods());
- end
- end
- function GetTankInfo(tank)
- local tankInfo = tank.getTankInfo()[1];
- local properTankInfo = {};
- properTankInfo.Capacity = tankInfo.capacity;
- properTankInfo.Contents = {
- Name = tankInfo.contents.rawName,
- Amount = tankInfo.contents.amount
- };
- return properTankInfo;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement