spaces->tab, equipper improvements, supertreefarm rewrite, follow improvements, sensor cleanup, milo multiple items allowed in recipes, remote canvas access

This commit is contained in:
kepler155c@gmail.com
2019-06-18 15:23:20 -04:00
parent 3b9b509429
commit 045b32884f
162 changed files with 20448 additions and 20286 deletions

View File

@@ -10,50 +10,50 @@ local USER_DIR = '/usr/etc/names'
local nameDB = TableDB()
function nameDB:loadDirectory(directory)
if fs.exists(directory) then
local files = fs.list(directory)
table.sort(files)
if fs.exists(directory) then
local files = fs.list(directory)
table.sort(files)
for _,file in ipairs(files) do
local mod = file:match('(%S+).json')
if mod then
local blocks = JSON.decodeFromFile(fs.combine(directory, file))
for _,file in ipairs(files) do
local mod = file:match('(%S+).json')
if mod then
local blocks = JSON.decodeFromFile(fs.combine(directory, file))
if not blocks then
error('Unable to read ' .. fs.combine(directory, file))
end
if not blocks then
error('Unable to read ' .. fs.combine(directory, file))
end
for strId, block in pairs(blocks) do
strId = string.format('%s:%s', mod, strId)
if type(block.name) == 'string' then
self.data[strId .. ':0'] = block.name
else
for nid,name in pairs(block.name) do
self.data[strId .. ':' .. (nid-1)] = name
end
end
end
for strId, block in pairs(blocks) do
strId = string.format('%s:%s', mod, strId)
if type(block.name) == 'string' then
self.data[strId .. ':0'] = block.name
else
for nid,name in pairs(block.name) do
self.data[strId .. ':' .. (nid-1)] = name
end
end
end
elseif file:match('(%S+).db') then
local names = Util.readTable(fs.combine(directory, file))
if not names then
error('Unable to read ' .. fs.combine(directory, file))
end
for key,name in pairs(names) do
self.data[key] = name
end
end
end
end
elseif file:match('(%S+).db') then
local names = Util.readTable(fs.combine(directory, file))
if not names then
error('Unable to read ' .. fs.combine(directory, file))
end
for key,name in pairs(names) do
self.data[key] = name
end
end
end
end
end
function nameDB:load()
self:loadDirectory(CORE_DIR)
self:loadDirectory(USER_DIR)
self:loadDirectory(CORE_DIR)
self:loadDirectory(USER_DIR)
end
function nameDB:getName(strId)
return self.data[strId] or strId
return self.data[strId] or strId
end
nameDB:load()