multiMiner tweak
This commit is contained in:
@@ -340,10 +340,10 @@ context.page = page
|
||||
|
||||
function context:setStatus(status)
|
||||
page.menuBar.infoBar.values = status
|
||||
if page.menuBar.infoBar.enabled then
|
||||
--if page.menuBar.infoBar.enabled then
|
||||
page.menuBar.infoBar:draw()
|
||||
page:sync()
|
||||
end
|
||||
--end
|
||||
end
|
||||
|
||||
local function processMessages(s)
|
||||
|
||||
@@ -155,7 +155,9 @@ local function run(member, point)
|
||||
local slot = turtle.getSlot(index)
|
||||
if slot.count > 0 then
|
||||
blockTypes[pt.key] = slot.key
|
||||
blockTypes[slot.key] = true
|
||||
if slot.key ~= pt.key then
|
||||
blockTypes[slot.key] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,6 +51,9 @@ local function getItemDetails(item)
|
||||
end
|
||||
end
|
||||
|
||||
local function logTransaction(transaction, details)
|
||||
end
|
||||
|
||||
local function handleTransaction(transaction)
|
||||
local from = transaction.from
|
||||
local to = transaction.to
|
||||
@@ -68,11 +71,13 @@ local function handleTransaction(transaction)
|
||||
local function refundTransaction(amount, reason)
|
||||
print("Refunding to ", recipient)
|
||||
await(k.makeTransaction, privatekey, recipient, amount, reason)
|
||||
logTransaction(transaction, { refund = amount, reason = reason })
|
||||
end
|
||||
|
||||
local itemId, price = getItemDetails(metadata.name)
|
||||
if not itemId or not price then
|
||||
print('invalid item')
|
||||
logTransaction(transaction, { reason = 'invalid item' })
|
||||
--return refundTransaction(value, "error=Item specified is not valid")
|
||||
return -- there could be multiple stores...
|
||||
end
|
||||
@@ -96,6 +101,7 @@ local function handleTransaction(transaction)
|
||||
|
||||
elseif e == 'shop_provided' and p1 == uid then
|
||||
local extra = value - (price * p2)
|
||||
logTransaction(transaction, { purchased = p2 })
|
||||
if extra > 0 then
|
||||
print('extra: ' .. extra)
|
||||
refundTransaction(extra, "message=Here's your change!")
|
||||
|
||||
Reference in New Issue
Block a user