This commit is contained in:
Igor Timofeev 2016-04-07 16:37:28 +03:00
parent 7ffaf19c83
commit 301be967e5
19 changed files with 102 additions and 24 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -229,18 +229,19 @@ function multiScreen.set(x, y, text)
for i = 1, unicode.len(text) do
local xMonitor, yMonitor, xPos, yPos = getMonitorAndCoordinates(x + i - 1, y)
if currentAddress ~= monitors[xMonitor][yMonitor].address then
gpu.bind(monitors[xMonitor][yMonitor].address)
currentAddress = monitors[xMonitor][yMonitor].address
gpu.setResolution(monitors.screenResolutionByWidth, monitors.screenResolutionByHeight)
if monitors[xMonitor] and monitors[xMonitor][yMonitor] then
if currentAddress ~= monitors[xMonitor][yMonitor].address then
gpu.bind(monitors[xMonitor][yMonitor].address)
currentAddress = monitors[xMonitor][yMonitor].address
gpu.setResolution(monitors.screenResolutionByWidth, monitors.screenResolutionByHeight)
end
if gpu.getBackground ~= currentBackground then gpu.setBackground(currentBackground) end
if gpu.getForeground ~= currentForeground then gpu.setForeground(currentForeground) end
gpu.set(xPos, yPos, unicode.sub(text, i, i))
end
if gpu.getBackground ~= currentBackground then gpu.setBackground(currentBackground) end
if gpu.getForeground ~= currentForeground then gpu.setForeground(currentForeground) end
gpu.set(xPos, yPos, unicode.sub(text, i, i))
end
end
function multiScreen.image(x, y, picture)
@ -270,6 +271,38 @@ function multiScreen.image(x, y, picture)
end
end
local function drawBigImageFromOCIFRawFile(x, y, path)
local file = io.open(path, "r")
file:lines()
local lineLength, background, foreground, alpha, symbol
local xPos, yPos = x, y
for line in file:lines() do
local lineLength = unicode.len(line)
for i = 1, lineLength, 19 do
background = tonumber("0x" .. unicode.sub(line, i, i + 5))
foreground = tonumber("0x" .. unicode.sub(line, i + 7, i + 12))
alpha = tonumber("0x" .. unicode.sub(line, i + 14, i + 15))
symbol = unicode.sub(line, i + 17, i + 17)
if alpha ~= 0xff then
multiScreen.setBackground(background)
multiScreen.setForeground(foreground)
multiScreen.set(xPos, yPos, symbol)
end
xPos = xPos + 1
end
xPos = x
yPos = yPos + 1
end
file:close()
end
--------------------------------------------------------------------------------------------------------------------------------------------
loadConfig()
@ -278,23 +311,25 @@ loadConfig()
-- multiScreen.setForeground(ecs.colors.white)
multiScreen.clear(0x000000)
drawBigImageFromOCIFRawFile(1, 1, "Big.pic")
-- local picture = image.load("Girl.pic")
local x, y = 1, 1
local w, h = 4, 4
-- local x, y = 1, 1
-- local w, h = 4, 4
local picture
-- local picture
local counter = 1
for j = 1, h do
for i = 1, w do
picture = image.load( counter .. ".pic")
multiScreen.image(x, y, picture)
x = x + 160
counter = counter + 1
end
x = 1
y = y + 50
end
-- local counter = 1
-- for j = 1, h do
-- for i = 1, w do
-- picture = image.load( counter .. ".pic")
-- multiScreen.image(x, y, picture)
-- x = x + 160
-- counter = counter + 1
-- end
-- x = 1
-- y = y + 50
-- end
-- multiScreen.set(130, 2, "Сука мать ебал, пидор ты ебаный, хыыы!")

View File

@ -0,0 +1,43 @@
local component = require("component")
local robot = require("robot")
local currentToolSlot = 1
local counter = 0
local inventorySize = robot.inventorySize()
robot.select(1)
local success
while true do
success = robot.swing()
if success then
robot.place()
end
counter = counter + 1
if counter > 50 then
local durability = robot.durability() or 500000000
counter = 0
print("Текущая экспа: " .. robot.level())
print("Текущий слот: " .. currentToolSlot)
print("Текущая прочность: " .. durability)
print(" ")
if durability < 0.1 then
currentToolSlot = currentToolSlot + 1
if currentToolSlot > inventorySize then currentToolSlot = inventorySize end
robot.select(currentToolSlot)
component.inventory_controller.equip()
robot.select(1)
end
end
end