From 1ba73454c114a00c322bcf809cbadd9342ca53dd Mon Sep 17 00:00:00 2001 From: SquidDev Date: Sun, 23 Sep 2018 09:34:28 +0100 Subject: [PATCH] Add .getCursorBlink to monitors and terminals Closes #576 --- .../java/dan200/computercraft/core/apis/TermAPI.java | 6 +++++- .../shared/peripheral/monitor/MonitorPeripheral.java | 10 ++++++++-- .../assets/computercraft/lua/rom/apis/window.lua | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/dan200/computercraft/core/apis/TermAPI.java b/src/main/java/dan200/computercraft/core/apis/TermAPI.java index 38a64b059..55ac97094 100644 --- a/src/main/java/dan200/computercraft/core/apis/TermAPI.java +++ b/src/main/java/dan200/computercraft/core/apis/TermAPI.java @@ -78,7 +78,8 @@ public class TermAPI implements ILuaAPI "setPaletteColour", "setPaletteColor", "getPaletteColour", - "getPaletteColor" + "getPaletteColor", + "getCursorBlink", }; } @@ -298,6 +299,9 @@ public class TermAPI implements ILuaAPI } return null; } + case 23: + // getCursorBlink + return new Object[] { m_terminal.getCursorBlink() }; default: { return null; diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java index a063bef2f..7d29e72ae 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java @@ -65,7 +65,8 @@ public class MonitorPeripheral implements IPeripheral "setPaletteColour", "setPaletteColor", "getPaletteColour", - "getPaletteColor" + "getPaletteColor", + "getCursorBlink", }; } @@ -249,8 +250,13 @@ public class MonitorPeripheral implements IPeripheral } return null; } + case 24: + // getCursorBlink + Terminal terminal = m_monitor.getTerminal().getTerminal(); + return new Object[] { terminal.getCursorBlink() }; + default: + return null; } - return null; } @Override diff --git a/src/main/resources/assets/computercraft/lua/rom/apis/window.lua b/src/main/resources/assets/computercraft/lua/rom/apis/window.lua index 154c44727..cffbf5bdd 100644 --- a/src/main/resources/assets/computercraft/lua/rom/apis/window.lua +++ b/src/main/resources/assets/computercraft/lua/rom/apis/window.lua @@ -258,6 +258,10 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible ) end end + function window.getCursorBlink() + return bCursorBlink + end + local function isColor() return parent.isColor() end