get Energy
This commit is contained in:
@ -7,13 +7,14 @@ local function getPeripheralType(direction)
|
|||||||
return peripheralType
|
return peripheralType
|
||||||
end
|
end
|
||||||
|
|
||||||
local function findPeripheral(typeOfPeripheral)
|
local function findPeripheralInfo(typeOfPeripheral)
|
||||||
local peripheral = peripheral.find(typeOfPeripheral)
|
local findingPeripheralInfo = peripheral.find(typeOfPeripheral)
|
||||||
if not peripheral then
|
if not findingPeripheralInfo then
|
||||||
print("No peripheral found in that direction.")
|
print("No peripheral found of type: " .. typeOfPeripheral)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
return peripheral
|
print("Found peripheral of type: " .. typeOfPeripheral)
|
||||||
|
return findingPeripheralInfo
|
||||||
end
|
end
|
||||||
|
|
||||||
local function uraniniteReactorStorageEnergy(peripheral)
|
local function uraniniteReactorStorageEnergy(peripheral)
|
||||||
@ -33,27 +34,35 @@ local function checkDirectionIsValid(direction)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
print("Enter the direction of the peripheral (left, right, top, bottom, front, back):")
|
PeripheralInfo = {}
|
||||||
local direction = io.read()
|
|
||||||
if not checkDirectionIsValid(direction) then
|
local function main()
|
||||||
return
|
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
|
end
|
||||||
|
|
||||||
local typeOfPeripheral = getPeripheralType(direction)
|
main()
|
||||||
if not typeOfPeripheral then
|
|
||||||
print("No peripheral found in that direction.")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local peripheral = findPeripheral(typeOfPeripheral)
|
|
||||||
if not peripheral then
|
|
||||||
print("No peripheral found of type: " .. typeOfPeripheral)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if peripheral == "uraninite_reactor" then
|
|
||||||
local energy = uraniniteReactorStorageEnergy(peripheral)
|
|
||||||
print("Stored energy in uranium reactor: " .. energy)
|
|
||||||
else
|
|
||||||
print("Peripheral type is not a uranium reactor, cannot get stored energy.")
|
|
||||||
end
|
|
||||||
|
|||||||
Reference in New Issue
Block a user