milo shop updates

This commit is contained in:
kepler155c@gmail.com
2019-01-11 20:13:50 -05:00
parent 11da26e078
commit 9cb3a084db
2 changed files with 13 additions and 4 deletions

View File

@@ -71,6 +71,7 @@ local function createPage(node)
if node.header then if node.header then
self:centeredWrite(2, node.header, nil, colors.white) self:centeredWrite(2, node.header, nil, colors.white)
end end
self:write(self.width - 15, 3, 'powered by Milo', nil, colors.lightGray)
end end
function page.footer.info:draw() function page.footer.info:draw()
@@ -88,8 +89,8 @@ local function createPage(node)
end end
function page.grid:getRowTextColor(row, selected) function page.grid:getRowTextColor(row, selected)
if row.count == 0 then if selected then
return colors.lightGray return colors.yellow
end end
return UI.Grid:getRowTextColor(row, selected) return UI.Grid:getRowTextColor(row, selected)
end end
@@ -147,6 +148,14 @@ local function createPage(node)
page:sync() page:sync()
end end
local chars = { '\183', '\7', '\186', '\7' }
Event.onInterval(1, function()
local ch = chars[math.floor(os.clock() % #chars) + 1]
page.header:write(2, 2, ch)
page.header:write(page.header.width - 1, 2, ch)
page:sync()
end)
UI:setPage(page) UI:setPage(page)
return page return page
end end
@@ -162,7 +171,7 @@ Event.on('store_provide', function(_, item, quantity, uid)
Milo:queueRequest({ }, function() Milo:queueRequest({ }, function()
local count = Milo:eject(itemDB:splitKey(item), quantity) local count = Milo:eject(itemDB:splitKey(item), quantity)
os.queueEvent('store_provided', uid, count) os.queueEvent('store_provided', uid, count)
Sound.play('entity.villager.no') Sound.play('entity.villager.yes')
end) end)
end) end)

View File

@@ -77,7 +77,7 @@ local function handleTransaction(transaction)
local count = math.floor(value / price) local count = math.floor(value / price)
local uid = math.random() local uid = math.random()
print('requesting %d of %s', count, itemId) print(string.format('requesting %d of %s', count, itemId))
os.queueEvent('store_provide', itemId, count, uid) os.queueEvent('store_provide', itemId, count, uid)
local timerId = os.startTimer(5) local timerId = os.startTimer(5)
while true do while true do