aboutsummaryrefslogtreecommitdiffhomepage
path: root/desktop/sources/scripts/core/orca.js
diff options
context:
space:
mode:
authorneauoire <[email protected]>2019-11-24 20:13:43 -0500
committerneauoire <[email protected]>2019-11-24 20:13:43 -0500
commit308722337b066329587befce0051b878d23d4b7c (patch)
treef25fd04d56003869b0b5531556f736d0a722ef8e /desktop/sources/scripts/core/orca.js
parent4fd9ad72aafbb3f0c71139fd36ae421f1d8f352a (diff)
downloadOrca-308722337b066329587befce0051b878d23d4b7c.tar.gz
Orca-308722337b066329587befce0051b878d23d4b7c.zip
Improved injection command
Diffstat (limited to 'desktop/sources/scripts/core/orca.js')
-rw-r--r--desktop/sources/scripts/core/orca.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/desktop/sources/scripts/core/orca.js b/desktop/sources/scripts/core/orca.js
index f2a2d2b..e5fe5a6 100644
--- a/desktop/sources/scripts/core/orca.js
+++ b/desktop/sources/scripts/core/orca.js
@@ -103,6 +103,34 @@ function Orca (library) {
return { w, h }
}
+ // Blocks
+
+ this.getBlock = (x, y, w, h) => {
+ const block = []
+ for (let _y = y; _y < y + h; _y++) {
+ const line = []
+ for (let _x = x; _x < x + w; _x++) {
+ line.push(this.glyphAt(_x, _y))
+ }
+ block.push(line)
+ }
+ return block
+ }
+
+ this.writeBlock = (x, y, block, overlap = false) => {
+ if (!block || block.length === 0) { return }
+ let _y = y
+ for (const line of block) {
+ let _x = x
+ for (const y in line) {
+ const glyph = line[y]
+ client.orca.write(_x, _y, overlap === true && glyph === '.' ? this.glyphAt(_x, _y) : glyph)
+ _x++
+ }
+ _y++
+ }
+ }
+
// Locks
this.release = function () {