local function getPeripheralType(direction) local peripheralType = peripheral.getType(direction) if not peripheralType then print("No peripheral found in that direction.") return nil end return peripheralType end local function findPeripheralInfo(typeOfPeripheral) local findingPeripheralInfo = peripheral.find(typeOfPeripheral) if not findingPeripheralInfo then print("No peripheral found of type: " .. typeOfPeripheral) return nil end print("Found peripheral of type: " .. typeOfPeripheral) return findingPeripheralInfo end local function uraniniteReactorStorageEnergy(peripheral) if peripheral.getStoredEnergy then return peripheral.getStoredEnergy() else print("The peripheral does not support getting stored energy.") return nil end end local function checkDirectionIsValid(direction) if not direction or direction == "quit" or direction == "exit" then print("No direction specified, exiting.") return false end return true end PeripheralInfo = {} local function main() print("Enter the direction of the peripheral (left, right, top, bottom, front, back):") local direction = io.read() if not checkDirectionIsValid(direction) then return end local typeOfPeripheral = getPeripheralType(direction) if not typeOfPeripheral then return end if typeOfPeripheral == "uraninite_reactor" then -- alors on est dans le cas d'un reacteur de Powah PeripheralInfo = findPeripheralInfo(typeOfPeripheral) if PeripheralInfo then local storedEnergy = uraniniteReactorStorageEnergy(PeripheralInfo) if storedEnergy then print("Stored energy in the reactor: " .. storedEnergy .. " RF") else print("Could not retrieve stored energy from the reactor.") end else print("No uraninite reactor found in that direction.") end return end end main()