diff --git a/src/main/resources/assets/opencomputers/loot/openos/boot/00_base.lua b/src/main/resources/assets/opencomputers/loot/openos/boot/00_base.lua index 7bd7b3aba..0709614b4 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/boot/00_base.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/boot/00_base.lua @@ -34,7 +34,7 @@ function print(...) local stdout = io.stdout local pre = "" for i = 1, args.n do - stdout:write(pre, tostring(args[i])) + stdout:write(pre, (assert(tostring(args[i]), "'tostring' must return a string to 'print'"))) pre = "\t" end stdout:write("\n") diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_vt.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_vt.lua index ee4b4f494..6e95d685a 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_vt.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_vt.lua @@ -35,8 +35,16 @@ end -- [Line;ColumnH Move cursor to screen location v,h -- [Line;Columnf ^ same -rules[{"%[", "%d+", ";", "%d+", "[Hf]"}] = function(window, _, y, _, x) - set_cursor(window, tonumber(x), tonumber(y)) +-- [;H Move cursor to upper left corner +-- [;f ^ same +rules[{"%[", "%d*", ";", "%d*", "[Hf]"}] = function(window, _, y, _, x) + set_cursor(window, tonumber(x) or 1, tonumber(y) or 1) +end + +-- [H move cursor to upper left corner +-- [f ^ same +rules[{"%[[Hf]"}] = function(window) + set_cursor(window, 1, 1) end -- [K clear line from cursor right @@ -63,14 +71,6 @@ rules[{"%[", "[012]?", "J"}] = function(window, _, n) window.gpu.fill(1 + window.dx, y + window.dy, window.width, rep, " ") end --- [H move cursor to upper left corner --- [;H ^ same --- [f ^ same --- [;f ^ same -rules[{"%[;?", "[Hf]"}] = function(window) - set_cursor(window, 1, 1) -end - -- [6n get the cursor position [ EscLine;ColumnR Response: cursor is at v,h ] rules[{"%[", "6", "n"}] = function(window) -- this solution puts the response on stdin, but it isn't echo'd diff --git a/src/main/scala/li/cil/oc/server/PacketSender.scala b/src/main/scala/li/cil/oc/server/PacketSender.scala index 0b038bc70..7a5218373 100644 --- a/src/main/scala/li/cil/oc/server/PacketSender.scala +++ b/src/main/scala/li/cil/oc/server/PacketSender.scala @@ -256,8 +256,10 @@ object PacketSender { val x = (xz >> 8).toByte val z = xz.toByte pb.writeShort(xz) - pb.writeInt(t.volume(x + z * t.width)) - pb.writeInt(t.volume(x + z * t.width + t.width * t.width)) + val rangeStart: Int = x + z * t.width + val rangeFinal: Int = x + z * t.width + t.width * t.width + pb.writeInt(t.volume(rangeStart max 0 min t.volume.length - 1)) + pb.writeInt(t.volume(rangeFinal max 0 min t.volume.length - 1)) } pb.sendToPlayersNearTileEntity(t)