Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require "component"
- local computer = require "computer"
- local filesystem = require "filesystem"
- local shell = require "shell"
- local MEMORY_TIER_LIST = {
- ["tier1"] = 196608,
- ["tier15"] = 262144,
- ["tier2"] = 393216,
- ["tier25"] = 524288,
- ["tier3"] = 786432,
- ["tier35"] = 1048576
- }
- local HARD_TIER_LIST = {
- ["tier1"] = 1048576,
- ["tier2"] = 2097152,
- ["tier3"] = 4194304
- }
- local GPU_TIER_LIST = {
- ["tier1"] = 1,
- ["tier2"] = 4,
- ["tier3"] = 8
- }
- local function getAllHDD()
- local args, options = shell.parse(threedot)
- local candidates = {}
- for address in component.list("filesystem", true) do
- local dev = component.proxy(address)
- if not dev.isReadOnly() and dev.address ~= computer.tmpAddress() then
- table.insert(candidates, dev)
- end
- end
- return candidates
- end
- --Check system requirements
- local function checkMemory(require_memory)
- if ( computer.totalMemory() >= require_memory) then
- return true
- end
- return false
- end
- local function checkHDD(require_hdd_size)
- local hdds = getAllHDD()
- local totalHDDSize = 0
- for i = 1, #hdds do
- totalHDDSize = totalHDDSize + hdds[i].spaceTotal()
- end
- if ( totalHDDSize >= require_hdd_size ) then
- return true
- end
- return false
- end
- local function checkGPU(tier, count)
- local graphicCards = component.list("gpu")
- local len = 0
- --Get graphicCards len
- --#graphicCards not worked
- for i in graphicCards do
- len = len + 1
- end
- if ( len >= count ) then
- for address in graphicCards do
- if ( component.proxy(address).maxDepth() >= tier ) then
- return true
- end
- end
- end
- return false
- end
- local function checkSystemRequirements()
- local memory = checkMemory(MEMORY_TIER_LIST.tier25)
- local hddSize = checkHDD(HARD_TIER_LIST.tier3)
- local gpuTier = checkGPU(GPU_TIER_LIST.tier3, 1)
- print(memory, " : ", hddSize, " : ", gpuTier)
- if ( memory and hddSize and gpuTier ) then
- return true
- end
- return false
- end
- print( checkSystemRequirements() )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement