diff --git a/Applications.cfg b/Applications.cfg index bd0621bb..614b2344 100644 --- a/Applications.cfg +++ b/Applications.cfg @@ -1020,7 +1020,7 @@ about="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/TurretControl/About/", icon="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/Applications/TurretControl/Icon.pic", createShortcut="desktop", - version=1.03, + version=1.04, resources={ { path="/Turret.pic", diff --git a/Applications/TurretControl/TurretControl.lua b/Applications/TurretControl/TurretControl.lua index a79b7714..07668ce2 100644 --- a/Applications/TurretControl/TurretControl.lua +++ b/Applications/TurretControl/TurretControl.lua @@ -29,8 +29,8 @@ local spaceBetweenTurretsHorizontal = 2 local spaceBetweenTurretsVertical = 1 local turretHeight = turretImage[2] + 12 local turretWidth = turretImage[1] + 8 -local countOfTurretsCanBeShowByWidth = math.floor(buffer.screen.width / (turretWidth + spaceBetweenTurretsHorizontal)) -local xTurrets = math.floor(buffer.screen.width / 2 - (countOfTurretsCanBeShowByWidth * (turretWidth + spaceBetweenTurretsHorizontal)) / 2 ) + math.floor(spaceBetweenTurretsHorizontal / 2) +local countOfTurretsCanBeShowByWidth = math.floor(buffer.width / (turretWidth + spaceBetweenTurretsHorizontal)) +local xTurrets = math.floor(buffer.width / 2 - (countOfTurretsCanBeShowByWidth * (turretWidth + spaceBetweenTurretsHorizontal)) / 2 ) + math.floor(spaceBetweenTurretsHorizontal / 2) local yellowColor = 0xFFDB40 @@ -95,8 +95,8 @@ local function drawTurrets(y) if #turrets <= 0 then local text = "Подключите турели из мода OpenModularTurrets" - local x = math.floor(buffer.screen.width / 2 - unicode.len(text) / 2) - buffer.text(x, math.floor(buffer.screen.height / 2 - 2), yellowColor, text) + local x = math.floor(buffer.width / 2 - unicode.len(text) / 2) + buffer.text(x, math.floor(buffer.height / 2 - 2), yellowColor, text) return end @@ -130,7 +130,7 @@ local function drawTurrets(y) end local function drawSeparator(y) - buffer.text(1, y, yellowColor, string.rep("─", buffer.screen.width)) + buffer.text(1, y, yellowColor, string.rep("─", buffer.width)) end local function drawButtonWithState(x, y, width, height, text, state) @@ -145,18 +145,18 @@ end local function drawBottomBar() local height = 6 - local y = buffer.screen.height - height + 1 - buffer.square(1, y, buffer.screen.width, height, 0x000000, yellowColor, " ") + local y = buffer.height - height + 1 + buffer.square(1, y, buffer.width, height, 0x000000, yellowColor, " ") drawSeparator(y) local text = " ECS® Security Systems™ " - local x = math.floor(buffer.screen.width / 2 - unicode.len(text) / 2) + local x = math.floor(buffer.width / 2 - unicode.len(text) / 2) buffer.text(x, y, yellowColor, text) y = y + 2 local widthOfButton = 19 local totalWidth = (widthOfButton + 2) * 6 - local x = math.floor(buffer.screen.width / 2 - totalWidth / 2) + 1 + local x = math.floor(buffer.width / 2 - totalWidth / 2) + 1 newObj("BottomButtons", "On", x, y, x + widthOfButton - 1, y + 2) x = drawButtonWithState(x, y, widthOfButton, 3, turretConfig.turretsOn and "Турели ВКЛ" or "Турели ВЫКЛ", turretConfig.turretsOn)