Added support for wired forcefield in CC scripts
This commit is contained in:
parent
af99f09fa3
commit
6ff9966d4a
2 changed files with 18 additions and 18 deletions
|
@ -3,13 +3,13 @@ if not term.isColor() then
|
||||||
exit()
|
exit()
|
||||||
end
|
end
|
||||||
|
|
||||||
Side = { "bottom", "top", "back", "left", "right" }
|
local sides = peripheral.getNames()
|
||||||
for i = 1,5 do
|
local projector
|
||||||
if peripheral.getType(Side[i]) == "warpdriveForceFieldProjector" then
|
for key, side in pairs(sides) do
|
||||||
projector = peripheral.wrap(Side[i])
|
os.sleep(0)
|
||||||
break
|
local deviceType = peripheral.getType(side)
|
||||||
else
|
if deviceType == "warpdriveForceFieldProjector" then
|
||||||
projector = nil
|
projector = peripheral.wrap(side)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ if projector == nil then
|
||||||
term.write("No force field projector detected")
|
term.write("No force field projector detected")
|
||||||
else
|
else
|
||||||
projector.enable(false)
|
projector.enable(false)
|
||||||
sleep(1)
|
os.sleep(1)
|
||||||
status, isEnabled, isConnected, isPowered, shape, energy = projector.state()
|
local status, isEnabled, isConnected, isPowered, shape, energy = projector.state()
|
||||||
term.setBackgroundColor(colors.lime)
|
term.setBackgroundColor(colors.lime)
|
||||||
term.setTextColor(colors.blue)
|
term.setTextColor(colors.blue)
|
||||||
term.write("Projector is disabled")
|
term.write("Projector is disabled")
|
||||||
|
|
|
@ -3,13 +3,13 @@ if not term.isColor() then
|
||||||
exit()
|
exit()
|
||||||
end
|
end
|
||||||
|
|
||||||
Side = { "bottom", "top", "back", "left", "right" }
|
local sides = peripheral.getNames()
|
||||||
for i = 1,5 do
|
local projector
|
||||||
if peripheral.getType(Side[i]) == "warpdriveForceFieldProjector" then
|
for key, side in pairs(sides) do
|
||||||
projector = peripheral.wrap(Side[i])
|
os.sleep(0)
|
||||||
break
|
local deviceType = peripheral.getType(side)
|
||||||
else
|
if deviceType == "warpdriveForceFieldProjector" then
|
||||||
projector = nil
|
projector = peripheral.wrap(side)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ if projector == nil then
|
||||||
term.write("No force field projector detected")
|
term.write("No force field projector detected")
|
||||||
else
|
else
|
||||||
projector.enable(true)
|
projector.enable(true)
|
||||||
sleep(1)
|
os.sleep(1)
|
||||||
status, isEnabled, isConnected, isPowered, shape, energy = projector.state()
|
local status, isEnabled, isConnected, isPowered, shape, energy = projector.state()
|
||||||
if isConnected then
|
if isConnected then
|
||||||
if isPowered then
|
if isPowered then
|
||||||
term.setBackgroundColor(colors.lime)
|
term.setBackgroundColor(colors.lime)
|
||||||
|
|
Loading…
Add table
Reference in a new issue