From af99f09fa3d4852ec302cb2dd5be2f42ef1072ed Mon Sep 17 00:00:00 2001 From: LemADEC Date: Fri, 12 May 2017 20:46:33 +0200 Subject: [PATCH] Fixed prerequisite detection with OC scripts --- .../warpdriveForceFieldProjector/disable.lua | 7 ++++++- .../warpdriveForceFieldProjector/enable.lua | 7 ++++++- .../lua.OpenComputers/warpdriveLaserTreefarm/farm.lua | 6 +++++- .../lua.OpenComputers/warpdriveLaserTreefarm/stop.lua | 6 +++++- .../lua.OpenComputers/warpdriveMiningLaser/mine.lua | 6 +++++- .../lua.OpenComputers/warpdriveMiningLaser/stop.lua | 6 +++++- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveForceFieldProjector/disable.lua b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveForceFieldProjector/disable.lua index 397bc6dc..a3d95d9c 100644 --- a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveForceFieldProjector/disable.lua +++ b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveForceFieldProjector/disable.lua @@ -1,13 +1,18 @@ local component = require("component") local term = require("term") +if not term.isAvailable() then + computer.beep() + os.exit() +end + if not component.isAvailable("warpdriveForceFieldProjector") then print("No force field projector detected") else local projector = component.warpdriveForceFieldProjector projector.enable(false) os.sleep(1) - status, isEnabled, isConnected, isPowered, shape, energy = projector.state() + local status, isEnabled, isConnected, isPowered, shape, energy = projector.state() print("Projector is disabled") print() print(status) diff --git a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveForceFieldProjector/enable.lua b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveForceFieldProjector/enable.lua index a3b0f324..7f19410a 100644 --- a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveForceFieldProjector/enable.lua +++ b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveForceFieldProjector/enable.lua @@ -1,13 +1,18 @@ local component = require("component") local term = require("term") +if not term.isAvailable() then + computer.beep() + os.exit() +end + if not component.isAvailable("warpdriveForceFieldProjector") then print("No force field projector detected") else local projector = component.warpdriveForceFieldProjector projector.enable(true) os.sleep(1) - status, isEnabled, isConnected, isPowered, shape, energy = projector.state() + local status, isEnabled, isConnected, isPowered, shape, energy = projector.state() if isConnected then if isPowered then print("Projector is enabled") diff --git a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveLaserTreefarm/farm.lua b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveLaserTreefarm/farm.lua index 20a8ff8d..0286b037 100644 --- a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveLaserTreefarm/farm.lua +++ b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveLaserTreefarm/farm.lua @@ -4,7 +4,11 @@ local term = require("term") if not term.isAvailable() then computer.beep() - return + os.exit() +end +if not component.gpu.getDepth() < 4 then + print("Tier 2 GPU required") + os.exit() end treefarms = {} diff --git a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveLaserTreefarm/stop.lua b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveLaserTreefarm/stop.lua index f615823a..3ae921b3 100644 --- a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveLaserTreefarm/stop.lua +++ b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveLaserTreefarm/stop.lua @@ -4,7 +4,11 @@ local term = require("term") if not term.isAvailable() then computer.beep() - return + os.exit() +end +if not component.gpu.getDepth() < 4 then + print("Tier 2 GPU required") + os.exit() end treefarms = {} diff --git a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveMiningLaser/mine.lua b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveMiningLaser/mine.lua index b1b1c804..7f7bc7ca 100644 --- a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveMiningLaser/mine.lua +++ b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveMiningLaser/mine.lua @@ -4,7 +4,11 @@ local term = require("term") if not term.isAvailable() then computer.beep() - return + os.exit() +end +if not component.gpu.getDepth() < 4 then + print("Tier 2 GPU required") + os.exit() end mininglasers = {} diff --git a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveMiningLaser/stop.lua b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveMiningLaser/stop.lua index c106546d..f3ed3c4d 100644 --- a/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveMiningLaser/stop.lua +++ b/src/main/resources/assets/warpdrive/lua.OpenComputers/warpdriveMiningLaser/stop.lua @@ -4,7 +4,11 @@ local term = require("term") if not term.isAvailable() then computer.beep() - return + os.exit() +end +if not component.gpu.getDepth() < 4 then + print("Tier 2 GPU required") + os.exit() end mininglasers = {}