mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 02:39:48 -04:00
Merge branch 'master-MC1.7.10' into master-MC1.10
This commit is contained in:
commit
82c486ffba
@ -103,7 +103,7 @@ function tty.stream:write(value)
|
|||||||
|
|
||||||
local x, y = tty.getCursor()
|
local x, y = tty.getCursor()
|
||||||
|
|
||||||
local _, ei, delim = unicode.sub(window.output_buffer, 1, window.width):find("([\27\t\r\n\a])")
|
local _, ei, delim = unicode.sub(window.output_buffer, 1, window.width):find("([\27\t\r\n\a\b\15])")
|
||||||
local segment = ansi_print .. (ei and window.output_buffer:sub(1, ei - 1) or window.output_buffer)
|
local segment = ansi_print .. (ei and window.output_buffer:sub(1, ei - 1) or window.output_buffer)
|
||||||
|
|
||||||
if segment ~= "" then
|
if segment ~= "" then
|
||||||
@ -132,9 +132,13 @@ function tty.stream:write(value)
|
|||||||
|
|
||||||
if delim == "\t" then
|
if delim == "\t" then
|
||||||
x = ((x-1) - ((x-1) % 8)) + 9
|
x = ((x-1) - ((x-1) % 8)) + 9
|
||||||
elseif delim == "\r" or (delim == "\n" and not window.cr_last) then
|
elseif delim == "\r" then
|
||||||
|
x = 1
|
||||||
|
elseif delim == "\n" then
|
||||||
x = 1
|
x = 1
|
||||||
y = y + 1
|
y = y + 1
|
||||||
|
elseif delim == "\b" then
|
||||||
|
x = x - 1
|
||||||
elseif delim == "\a" and not beeped then
|
elseif delim == "\a" and not beeped then
|
||||||
computer.beep()
|
computer.beep()
|
||||||
beeped = true
|
beeped = true
|
||||||
@ -143,7 +147,6 @@ function tty.stream:write(value)
|
|||||||
end
|
end
|
||||||
|
|
||||||
tty.setCursor(x, y)
|
tty.setCursor(x, y)
|
||||||
window.cr_last = delim == "\r"
|
|
||||||
end
|
end
|
||||||
return cursor.sy
|
return cursor.sy
|
||||||
end
|
end
|
||||||
|
@ -55,12 +55,12 @@ class DiskDrive extends traits.Environment with traits.ComponentInventory with t
|
|||||||
withComponent("disk_drive").
|
withComponent("disk_drive").
|
||||||
create()
|
create()
|
||||||
|
|
||||||
@Callback(doc = """function():boolean -- Checks whether some medium is currently in the drive.""")
|
@Callback(doc = "function():boolean -- Checks whether some medium is currently in the drive.")
|
||||||
def isEmpty(context: Context, args: Arguments): Array[AnyRef] = {
|
def isEmpty(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
result(filesystemNode.isEmpty)
|
result(filesystemNode.isEmpty)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(doc = """function([velocity:number]):boolean -- Eject the currently present medium from the drive.""")
|
@Callback(doc = "function([velocity:number]):boolean -- Eject the currently present medium from the drive.")
|
||||||
def eject(context: Context, args: Arguments): Array[AnyRef] = {
|
def eject(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
val velocity = args.optDouble(0, 0) max 0 min 1
|
val velocity = args.optDouble(0, 0) max 0 min 1
|
||||||
val ejected = decrStackSize(0, 1)
|
val ejected = decrStackSize(0, 1)
|
||||||
@ -77,6 +77,14 @@ class DiskDrive extends traits.Environment with traits.ComponentInventory with t
|
|||||||
else result(false)
|
else result(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Callback(doc = "function(): string -- Return the internal floppy disk address")
|
||||||
|
def media(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
|
if (filesystemNode.isEmpty)
|
||||||
|
result(Unit, "drive is empty")
|
||||||
|
else
|
||||||
|
result(filesystemNode.head.address)
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
// Analyzable
|
// Analyzable
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user