From ec905fad07eedddc8cffa9a165223f1974391ce6 Mon Sep 17 00:00:00 2001 From: Rivulet Date: Sun, 5 Apr 2026 01:58:53 +0000 Subject: [PATCH] Update startup.lua --- startup.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/startup.lua b/startup.lua index 685e8ce..899de3e 100644 --- a/startup.lua +++ b/startup.lua @@ -157,6 +157,32 @@ local function input() db.setWorth(added_currency_name,added_currency_worth) end end + elseif event[2] == keys.i then + sleep(0) + local added_item_name = nil + local added_item_price = nil + local x,y = term.getSize() + term.setCursorPos(1,y) + term.write("item name > ") + local materials = db.getMaterials() + added_item_name = read(nil,nil, function(text) return completion.choice(text, materials) end) + if added_item_name == "" then + added_item_name = nil + else + repeat + print("price in items per 1 "..unit_name) + term.write("item price > ") + added_item_price = 1/tonumber(read()) + until added_item_price ~= nil + if added_item_price <= 0 then + added_item_name = nil + added_item_price = nil + else + ---@cast added_item_price number + db.setPrice(added_item_name,added_item_price) + price_map[added_item_name] = db.getPrice(added_item_name) + end + end end end end