Compare commits
3 Commits
c95af9b7a6
...
b316ced862
| Author | SHA1 | Date | |
|---|---|---|---|
| b316ced862 | |||
| a008309155 | |||
| 48eb260fbb |
42
.vscode/settings.json
vendored
Normal file
42
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"Lua.diagnostics.severity": {
|
||||
"redefined-local": "Warning"
|
||||
},
|
||||
"Lua.diagnostics.globals": [
|
||||
"printError",
|
||||
"sleep",
|
||||
"read",
|
||||
"write",
|
||||
"print",
|
||||
"colony",
|
||||
"colours",
|
||||
"colors",
|
||||
"commands",
|
||||
"disk",
|
||||
"fs",
|
||||
"gps",
|
||||
"help",
|
||||
"http",
|
||||
"paintutils",
|
||||
"parallel",
|
||||
"peripheral",
|
||||
"rednet",
|
||||
"redstone",
|
||||
"keys",
|
||||
"settings",
|
||||
"shell",
|
||||
"multishell",
|
||||
"term",
|
||||
"textutils",
|
||||
"turtle",
|
||||
"pocket",
|
||||
"vector",
|
||||
"bit32",
|
||||
"window",
|
||||
"_CC_DEFAULT_SETTINGS",
|
||||
"_HOST",
|
||||
"_VERSION",
|
||||
"_"
|
||||
],
|
||||
"Lua.runtime.version": "Lua 5.1",
|
||||
}
|
||||
68
digroom.lua
Normal file
68
digroom.lua
Normal file
@ -0,0 +1,68 @@
|
||||
-- local coordinates!
|
||||
local tArgs = { ... }
|
||||
local x = tArgs[1]
|
||||
local y = tArgs[2]
|
||||
local z = tArgs[3]
|
||||
local fuel = 16
|
||||
local up = true
|
||||
local fw = false
|
||||
|
||||
local function digUp()
|
||||
for i = 2, z do
|
||||
while not turtle.up() do
|
||||
turtle.digUp()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function digDown()
|
||||
for i = 2, z do
|
||||
while not turtle.down() do
|
||||
turtle.digDown()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function digVertical()
|
||||
if up then
|
||||
digUp()
|
||||
else
|
||||
digDown()
|
||||
end
|
||||
up = not up
|
||||
end
|
||||
|
||||
local function digFw()
|
||||
while not turtle.forward() do
|
||||
turtle.dig()
|
||||
end
|
||||
end
|
||||
|
||||
local function turn()
|
||||
if fw then
|
||||
turtle.turnRight()
|
||||
else
|
||||
turtle.turnLeft()
|
||||
end
|
||||
end
|
||||
|
||||
local function refuel()
|
||||
if turtle.getFuelLevel() <= 4 * z then
|
||||
if not turtle.refuel() then
|
||||
print("No fuel!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, x do
|
||||
digFw()
|
||||
turn()
|
||||
fw = not fw
|
||||
for j = 2, y do
|
||||
digVertical()
|
||||
digFw()
|
||||
refuel()
|
||||
end
|
||||
digVertical()
|
||||
turn()
|
||||
end
|
||||
11
monitor.lua
Normal file
11
monitor.lua
Normal file
@ -0,0 +1,11 @@
|
||||
require("printTable")
|
||||
local monitors = { peripheral.find("monitor") }
|
||||
for key, monitor in pairs(monitors) do
|
||||
monitor.setTextScale(0.5)
|
||||
monitor.clear()
|
||||
monitor.setCursorPos(1, 1)
|
||||
--monitor.write("Hello World!")
|
||||
end
|
||||
local wo = colony.getWorkOrders()
|
||||
local pr = textutils.serialise(wo)
|
||||
printTable(wo, 0)
|
||||
14
printTable.lua
Normal file
14
printTable.lua
Normal file
@ -0,0 +1,14 @@
|
||||
local function _printTable(table, s, tabs)
|
||||
for key, value in pairs(table) do
|
||||
if type(value) == "table" then
|
||||
_printTable(table, "", tabs + 1)
|
||||
else
|
||||
print(string.rep(' ', tabs), key, value)
|
||||
end
|
||||
end
|
||||
return s
|
||||
end
|
||||
|
||||
function printTable(table)
|
||||
return _printTable(table, "", 0)
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user