Merge branch 'master-MC1.11' into master-MC1.12

This commit is contained in:
payonel 2018-09-27 18:27:24 -07:00
commit 9cd56fd77d
4 changed files with 23 additions and 32 deletions

View File

@ -2,6 +2,6 @@
![Don't belittle it.](block:OpenComputers:microcontroller) ![Don't belittle it.](block:OpenComputers:microcontroller)
Microcontrollers are built using a [microcontroller case](../item/microcontrollerCase1.md) in the [assembler](assembler.md). They have less functionality compared to [computers](../general/computer.md), but are cheaper to build. In particular, the *can not* interact with external components. Microcontrollers are built using a [microcontroller case](../item/microcontrollerCase1.md) in the [assembler](assembler.md). They have less functionality compared to [computers](../general/computer.md), but are cheaper to build. In particular, they *can not* interact with external components.
Microcontrollers can take various components, such as [CPUs](../item/cpu1.md), [memory (RAM)](../item/ram1.md), and Expansion cards. Microcontrollers are unable to contain a [hard disk drive](../item/hdd1.md), but do contain a slot for an [EEPROM](../item/eeprom.md), which can be programmed for very specific tasks. They have an advantage over [computer cases](case1.md), in that they can also make use of some upgrades, such as the [piston upgrade](../item/pistonUpgrade.md). Microcontrollers can take various components, such as [CPUs](../item/cpu1.md), [memory (RAM)](../item/ram1.md), and Expansion cards. Microcontrollers are unable to contain a [hard disk drive](../item/hdd1.md), but do contain a slot for an [EEPROM](../item/eeprom.md), which can be programmed for very specific tasks. They have an advantage over [computer cases](case1.md), in that they can also make use of some upgrades, such as the [piston upgrade](../item/pistonUpgrade.md).

View File

@ -1 +1 @@
{fromDir="/data/"} {label="Network", reboot=true, fromDir="/data/"}

View File

@ -1,6 +0,0 @@
local filesystem = require "filesystem"
local shell = require "shell"
local process = require "process"
shell.execute("install --noboot --nolabelset --name=Network --fromDir=/data/ --from="..filesystem.get(process.running()).address)
print("You must reboot to start network services.")

View File

@ -178,8 +178,8 @@ local function getCursor()
end end
local function line() local function line()
local cbx, cby = getCursor() local _, cby = getCursor()
return buffer[cby] return buffer[cby] or ""
end end
local function getNormalizedCursor() local function getNormalizedCursor()
@ -269,12 +269,12 @@ local function highlight(bx, by, length, enabled)
end end
local function home() local function home()
local cbx, cby = getCursor() local _, cby = getCursor()
setCursor(1, cby) setCursor(1, cby)
end end
local function ende() local function ende()
local cbx, cby = getCursor() local _, cby = getCursor()
setCursor(unicode.wlen(line()) + 1, cby) setCursor(unicode.wlen(line()) + 1, cby)
end end
@ -299,8 +299,8 @@ local function right(n)
n = n or 1 n = n or 1
local cbx, cby = getNormalizedCursor() local cbx, cby = getNormalizedCursor()
local be = unicode.wlen(line()) + 1 local be = unicode.wlen(line()) + 1
local wide, right = isWideAtPosition(line(), cbx + n) local wide, isRight = isWideAtPosition(line(), cbx + n)
if wide and right then if wide and isRight then
n = n + 1 n = n + 1
end end
if cbx + n <= be then if cbx + n <= be then
@ -327,7 +327,7 @@ local function down(n)
end end
local function delete(fullRow) local function delete(fullRow)
local cx, cy = term.getCursor() local _, cy = term.getCursor()
local cbx, cby = getCursor() local cbx, cby = getCursor()
local x, y, w, h = getArea() local x, y, w, h = getArea()
local function deleteRow(row) local function deleteRow(row)
@ -370,7 +370,6 @@ local function insert(value)
return return
end end
term.setCursorBlink(false) term.setCursorBlink(false)
local cx, cy = term.getCursor()
local cbx, cby = getCursor() local cbx, cby = getCursor()
local x, y, w, h = getArea() local x, y, w, h = getArea()
local index = lengthToChars(line(), cbx) local index = lengthToChars(line(), cbx)
@ -384,7 +383,7 @@ end
local function enter() local function enter()
term.setCursorBlink(false) term.setCursorBlink(false)
local cx, cy = term.getCursor() local _, cy = term.getCursor()
local cbx, cby = getCursor() local cbx, cby = getCursor()
local x, y, w, h = getArea() local x, y, w, h = getArea()
local index = lengthToChars(line(), cbx) local index = lengthToChars(line(), cbx)
@ -404,8 +403,7 @@ end
local findText = "" local findText = ""
local function find() local function find()
local x, y, w, h = getArea() local _, _, _, h = getArea()
local cx, cy = term.getCursor()
local cbx, cby = getCursor() local cbx, cby = getCursor()
local ibx, iby = cbx, cby local ibx, iby = cbx, cby
while running do while running do
@ -464,11 +462,11 @@ local keyBindHandlers = {
home = home, home = home,
eol = ende, eol = ende,
pageUp = function() pageUp = function()
local x, y, w, h = getArea() local _, _, _, h = getArea()
up(h - 1) up(h - 1)
end, end,
pageDown = function() pageDown = function()
local x, y, w, h = getArea() local _, _, _, h = getArea()
down(h - 1) down(h - 1)
end, end,
@ -513,13 +511,13 @@ local keyBindHandlers = {
local f, reason = io.open(filename, "w") local f, reason = io.open(filename, "w")
if f then if f then
local chars, firstLine = 0, true local chars, firstLine = 0, true
for _, line in ipairs(buffer) do for _, bline in ipairs(buffer) do
if not firstLine then if not firstLine then
line = "\n" .. line bline = "\n" .. bline
end end
firstLine = false firstLine = false
f:write(line) f:write(bline)
chars = chars + unicode.len(line) chars = chars + unicode.len(bline)
end end
f:close() f:close()
local format local format
@ -600,14 +598,13 @@ end
local function onClipboard(value) local function onClipboard(value)
value = value:gsub("\r\n", "\n") value = value:gsub("\r\n", "\n")
local cbx, cby = getCursor()
local start = 1 local start = 1
local l = value:find("\n", 1, true) local l = value:find("\n", 1, true)
if l then if l then
repeat repeat
local line = string.sub(value, start, l - 1) local next_line = string.sub(value, start, l - 1)
line = text.detab(line, 2) next_line = text.detab(next_line, 2)
insert(line) insert(next_line)
enter() enter()
start = l + 1 start = l + 1
l = value:find("\n", start, true) l = value:find("\n", start, true)
@ -632,9 +629,9 @@ do
if f then if f then
local x, y, w, h = getArea() local x, y, w, h = getArea()
local chars = 0 local chars = 0
for line in f:lines() do for fline in f:lines() do
table.insert(buffer, line) table.insert(buffer, fline)
chars = chars + unicode.len(line) chars = chars + unicode.len(fline)
if #buffer <= h then if #buffer <= h then
drawLine(x, y, w, h, #buffer) drawLine(x, y, w, h, #buffer)
end end