icon update - thx LDD

This commit is contained in:
kepler155c@gmail.com
2019-03-10 19:37:14 -04:00
parent 3192dc52d7
commit 1e5014492c
6 changed files with 239 additions and 12 deletions

View File

@@ -28,6 +28,9 @@ Needs work
title = "DiskCopy",
category = "System",
run = "DiskCopy",
iconExt = "\0309\0318\138\143\0317\133\030f\0319\148\030 \031 \030f\0318\151\129\
\0300\0319\149\030b\0318\138\143\0317\133\030f\031b\148\0308\031f\140\030f\0318\145\
\030 \031 \0300\031b\149\0310\128\128\030f\031b\149\0318\157\133",
},
[ "7ef35cac539f84722b0a988caee03b2df734c56a" ] = {
title = "AppStore",
@@ -72,10 +75,13 @@ Needs work
requires = "turtle",
},
--]]
[ "turtleFollow" ] = {
[ "66587a7a62a90fc91c4c88f1872bedaa52d23a35" ] = {
title = "Follow",
category = "Turtle",
run = "Follow.lua",
iconExt = "\030 \031 \030f\0314\144\
\030 \031 \0304\031f\139\133\0310\130\030f\0311\156\
\0307\0318\136\030f\0317\149\0307\0318\136\030f\0317\149\0304\031f\144\0314\128\030f\159",
},
df485c871329671f46570634d63216761441bcd6 = {
title = "Devices",

View File

@@ -3,21 +3,33 @@
title = "SameGame",
category = "Games",
run = "sameGame",
iconExt = "\132\132\132\132\132\132\132\132\
\030b\031e\148\030a\031d\139\030b\031a\154\030c\031b\139\030e\031c\138\030d\140\030e\031a\139\030f\031b\149\
\030a\031e\145\030e\031d\143\130\030c\149\030b\031e\156\030d\031b\149\030a\031d\132\030f\031e\149",
},
[ "f6a5201214fb1981e6d46a39303bb676325eb59b-ME2" ] = {
title = "Othello",
category = "Games",
run = "Othello",
iconExt = "\030 \031 \030d\031f\151\031d\128\031f\144\131\131\143\143\
\030d\031f\151\0300\031d\159\030d\031f\130\0300\031d\153\030f\139\030d\0310\132\031f\132\030f\031d\133\
\031d\131\131\143\143\030d\031f\129\031d\128\030f\133",
},
[ "785af2a4ad3c4ee912623c6e0b6d4299ea305bf6" ] = {
title = "Pipes",
category = "Games",
run = "Pipes",
iconExt = "\030 \031 \0300\0310\128\030 \031 \030f\0310\143\0300\031f\130\030 \031 \0300\0310\128\
\0300\031f\131\0310\128\031f\131\131\030f\0310\159\030 \031 \030f\0310\143\
\030 \031 \0305\0310\131\030 \031 \0300\031f\131",
},
[ "soundPlayer" ] = {
title = "Sounds",
category = "System",
run = "SoundPlayer",
iconExt = "\030 \031 \0307\031f\159\129\030f\0317\149\0310\144\0300\031f\155\030f\0310\137\144\
\0307\0317\128\128\128\030f\149\0300\031f\149\030f\128\0310\149\0300\031f\149\
\030 \031 \030f\0317\130\0307\031f\144\030f\0317\149\0310\129\134\152\129",
},
[ "a2accffe95b2c8be30e8a05e0c6ab7e8f5966f43" ] = {
title = "Strafe",

196
ignore/glasses.lua Normal file
View File

@@ -0,0 +1,196 @@
local class = require('class')
local UI = require('ui')
local Event = require('event')
local Peripheral = require('peripheral')
--[[-- Glasses device --]]--
local Glasses = class()
function Glasses:init(args)
local defaults = {
backgroundColor = colors.black,
textColor = colors.white,
textScale = .5,
backgroundOpacity = .5,
multiplier = 2.6665,
-- multiplier = 2.333,
}
defaults.width, defaults.height = term.getSize()
UI:setProperties(defaults, args)
UI:setProperties(self, defaults)
self.bridge = Peripheral.get({
type = 'openperipheral_bridge',
method = 'addBox',
})
self.bridge.clear()
self.setBackgroundColor = function(...) end
self.setTextColor = function(...) end
self.t = { }
for i = 1, self.height do
self.t[i] = {
text = string.rep(' ', self.width+1),
--text = self.bridge.addText(0, 40+i*4, string.rep(' ', self.width+1), 0xffffff),
bg = { },
textFields = { },
}
end
end
function Glasses:setBackgroundBox(boxes, ax, bx, y, bgColor)
local colors = {
[ colors.black ] = 0x000000,
[ colors.brown ] = 0x7F664C,
[ colors.blue ] = 0x253192,
[ colors.red ] = 0xFF0000,
[ colors.gray ] = 0x272727,
[ colors.lime ] = 0x426A0D,
[ colors.green ] = 0x2D5628,
[ colors.white ] = 0xFFFFFF
}
local function overlap(box, ax, bx)
if bx < box.ax or ax > box.bx then
return false
end
return true
end
for _,box in pairs(boxes) do
if overlap(box, ax, bx) then
if box.bgColor == bgColor then
ax = math.min(ax, box.ax)
bx = math.max(bx, box.bx)
box.ax = box.bx + 1
elseif ax == box.ax then
box.ax = bx + 1
elseif ax > box.ax then
if bx < box.bx then
table.insert(boxes, { -- split
ax = bx + 1,
bx = box.bx,
bgColor = box.bgColor
})
box.bx = ax - 1
break
else
box.ax = box.bx + 1
end
elseif ax < box.ax then
if bx > box.bx then
box.ax = box.bx + 1 -- delete
else
box.ax = bx + 1
end
end
end
end
if bgColor ~= colors.black then
table.insert(boxes, {
ax = ax,
bx = bx,
bgColor = bgColor
})
end
local deleted
repeat
deleted = false
for k,box in pairs(boxes) do
if box.ax > box.bx then
if box.box then
box.box.delete()
end
table.remove(boxes, k)
deleted = true
break
end
if not box.box then
box.box = self.bridge.addBox(
math.floor(self.x + (box.ax - 1) * self.multiplier),
self.y + y * 4,
math.ceil((box.bx - box.ax + 1) * self.multiplier),
4,
colors[bgColor],
self.backgroundOpacity)
else
box.box.setX(self.x + math.floor((box.ax - 1) * self.multiplier))
box.box.setWidth(math.ceil((box.bx - box.ax + 1) * self.multiplier))
end
end
until not deleted
end
function Glasses:write(x, y, text, bg)
if x < 1 then
error(' less ', 6)
end
if y <= #self.t then
local line = self.t[y]
local str = line.text
str = str:sub(1, x-1) .. text .. str:sub(x + #text)
self.t[y].text = str
for _,tf in pairs(line.textFields) do
tf.delete()
end
line.textFields = { }
local function split(st)
local words = { }
local offset = 0
while true do
local b,e,w = st:find('(%S+)')
if not b then
break
end
table.insert(words, {
offset = b + offset - 1,
text = w,
})
offset = offset + e
st = st:sub(e + 1)
end
return words
end
local words = split(str)
for _,word in pairs(words) do
local tf = self.bridge.addText(self.x + word.offset * self.multiplier,
self.y+y*4, '', 0xffffff)
tf.setScale(self.textScale)
tf.setZ(1)
tf.setText(word.text)
table.insert(line.textFields, tf)
end
self:setBackgroundBox(line.bg, x, x + #text - 1, y, bg)
end
end
function Glasses:clear(bg)
for _,line in pairs(self.t) do
for _,tf in pairs(line.textFields) do
tf.delete()
end
line.textFields = { }
line.text = string.rep(' ', self.width+1)
-- self.t[i].text.setText('')
end
end
function Glasses:reset()
self:clear()
self.bridge.clear()
self.bridge.sync()
end
function Glasses:sync()
self.bridge.sync()
end
return Glasses

View File

@@ -25,6 +25,10 @@ local peripheral = _G.peripheral
local turtle = _G.turtle
local STARTUP_FILE = 'usr/autorun/miloFurni.lua'
local SMELT_AMOUNT = 8
local INPUT_SLOT = 1
local FUEL_SLOT = 2
local OUTPUT_SLOT = 3
local function equip(side, item, rawName)
local equipped = peripheral.getType(side)
@@ -99,8 +103,8 @@ local function process(list)
local f = furnace.list()
-- items to cook
local item = list[1]
local cooking = f[1]
local item = list[INPUT_SLOT]
local cooking = f[INPUT_SLOT]
if cooking or item then
active = true
@@ -111,7 +115,7 @@ local function process(list)
local count = cooking and cooking.count or 0
if count < 64 then
print('cooking : ' .. furnace.name)
count = furnace.pullItems(localName, 1, 8, 1)
count = furnace.pullItems(localName, INPUT_SLOT, SMELT_AMOUNT, INPUT_SLOT)
item.count = item.count - count
Util.removeByValue(furni, furnace)
table.insert(furni, furnace)
@@ -120,18 +124,18 @@ local function process(list)
end
-- fuel
local fuel = f[2] or { count = 0 }
local fuel = f[FUEL_SLOT] or { count = 0 }
if fuel.count < 8 then
print('fueling ' ..furnace.name)
furnace.pullItems(localName, 2, 8 - fuel.count, 2)
furnace.pullItems(localName, FUEL_SLOT, 8 - fuel.count, FUEL_SLOT)
end
local result = f[3]
local result = f[OUTPUT_SLOT]
if result then
if not list[3] or result.name == list[3].name then
if not list[OUTPUT_SLOT] or result.name == list[OUTPUT_SLOT].name then
print('pulling from : ' .. furnace.name)
furnace.pushItems(localName, 3, result.count, 3)
list[3] = result
furnace.pushItems(localName, OUTPUT_SLOT, result.count, OUTPUT_SLOT)
list[OUTPUT_SLOT] = result
end
end
end

View File

@@ -4,14 +4,20 @@
category = "Neural",
run = "elytraFly.lua",
},
[ "Sensor" ] = {
[ "9101fc1744ab274aaa0b54ee22b14ca53ee6e236" ] = {
title = "Sensor",
category = "Neural",
run = "Sensor.lua",
iconExt = "\0315\156\0305\031f\131\147\0300\159\129\031e\152\031f\139\
\0315\157\131\0305\031f\145\030b\157\0300\031b\157\031e\136\140\030f\0316\148\
\0305\031f\138\131\133\030f\0310\130\0300\031f\144\031e\137\030f\0310\135\0306\031f\149",
},
[ "Scanner" ] = {
[ "c7ee483aa3d72126406fe52b8ed91bb9c419d02f" ] = {
title = "Scanner",
category = "Neural",
run = "Scanner.lua",
iconExt = "\030d\031f\143\143\143\0300\159\129\031e\152\031f\139\
\030c\031d\129\129\130\030b\031f\157\0300\031b\157\031e\136\140\030f\0316\148\
\031c\143\143\143\0310\130\0300\031f\144\031e\137\030f\0310\135\0306\031f\149",
},
}

View File

@@ -3,5 +3,8 @@
title = "Recipes",
category = "Apps",
run = "recipeBook",
iconExt = "\030d\031f\143\135\131\129\0307\031d\155\030d\031f\130\030f\031d\144\
\0300\031d\130\030d\0310\144\0317\137\0300\031d\159\143\135\131\
\130\143\143\135\131\129",
},
}