summaryrefslogtreecommitdiff
path: root/shop2
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-01-07 04:50:32 +0000
committerubq323 <ubq323@ubq323.website>2023-01-07 04:50:32 +0000
commitd295f4756237d981259e37a2d924f064e7f1fde5 (patch)
tree1c7957803829b4bb254652e99e440cd07b7867a2 /shop2
parent5b4093d518d8415bbc64d844120233708bc66423 (diff)
removement
Diffstat (limited to 'shop2')
-rw-r--r--shop2/main.lua38
1 files changed, 0 insertions, 38 deletions
diff --git a/shop2/main.lua b/shop2/main.lua
index e79872c..c110f83 100644
--- a/shop2/main.lua
+++ b/shop2/main.lua
@@ -40,44 +40,6 @@ local function parsemeta(m)
end
return out
end
-
-local chest
-for _,name in ipairs(peripheral.getNames()) do
- if name:match("chest") then chest = peripheral.wrap(name) break end
-end
-assert(chest,"couldn't find chest")
--- might not work if there are multiple modems but why would you do that
-local localname = peripheral.find("modem").getNameLocal()
-
-local function take_stock()
- -- if you do this in parallel, you avoid having to wait 1 tick for each
- -- slot of the chest. which is probably good.
- local out = {}
- local fns = {}
- for i=1,chest.size() do
- fns[i] = function() out[i] = chest.getItemDetail(i) end
- end
- parallel.waitForAll(unpack(fns))
- return out
-end
-
-local function item_desc_matches(idesc,itemdetail)
- -- idesc is an entry from ITEMS
- -- itemdetail is something returned from getItemDetail on the chest
- -- if you were wondering
- return idesc.itname == itemdetail.name
-end
-
-local function stock_amt(stockinfo,idesc)
- local total = 0
- for ix,itm in pairs(stockinfo) do
- if item_desc_matches(idesc,itm) then
- total = total + itm.count
- end
- end
- return total
-end
-
local function give(stockinfo,idesc,amt)
amt = amt or 1
-- assumes that we have at least amt in stock already