CCCPaste

17c3e43932f6a

monitor = peripheral.wrap("monitor_1")
function pos(...) return term.setCursorPos(...) end
function cls(...) return term.clear() end
function tCol(...) return term.setTextColor(...) end
function bCol(...) return term.setBackgroundColor(...) end
function box(...) return paintutils.drawFilledBox(...) end
function line(...) return paintutils.drawLine(...) end
function write(...) return term.write(...) end
term.redirect(monitor)
w, h = monitor.getSize()
local menu = require("menu")


function getSize() w,h = monitor.getSize() end
tCol(colors.white)
local andes = false
local darkmode = true
local darkmodec

local boolArray = {false, false, false, false, false, false, false, false, false, false, false, false, false}



local darkmode = true
local darkmodec

-------------------------------------------------------------

local function foundry()
    monitor.setTextScale(1.5)
    getSize()
    cls()
    if darkmode then
    darkmodec = colours.black
else
    darkmodec = colours.blue
end
    box(1,1,w,h,darkmodec)
    pos(w/2-#"FOUNDRY"/2,1)
    write("FOUNDRY")
    pos(5,3)
    write("Andesit Compound")
    if boolArray[1]==false then
        box(23,3,26,3,colors.red) else box(23,3,26,3,colors.lime)
    end
    
    pos(5,5)
    bCol(darkmodec)
    write("B.R. Concrete")
    if boolArray[2]==false then
        box(23,5,26,5,colors.red) else box(23,5,26,5,colors.lime)
    end
    
    pos(5,7)
    bCol(darkmodec)
    write("Molten Rose Gold")
    if boolArray[3]==false then
        box(23,7,26,7,colors.red) else box(23,7,26,7,colors.lime)
    end
    
    pos(5,9)
    bCol(darkmodec)
    write("Molten Brass")
    if boolArray[4]==false then
        box(23,9,26,9,colors.red) else box(23,9,26,9,colors.lime)
    end

    pos(5,11)
    bCol(darkmodec)
    write("Molten Bronze")
    if boolArray[5]==false then
        box(23,11,26,11,colors.red) else box(23,11,26,11,colors.lime)
    end

    pos(5,13)
    bCol(darkmodec)
    write("Silicon")
    if boolArray[6]==false then
        box(23,13,26,13,colors.red) else box(23,13,26,13,colors.lime)
    end

    pos(5,15)
    bCol(darkmodec)
    write("Brass Ingot")
    if boolArray[7]==false then
        box(23,15,26,15,colors.red) else box(23,15,26,15,colors.lime)
    end

    pos(5,17)
    bCol(darkmodec)
    write("Bronze Ingot")
    if boolArray[8]==false then
        box(23,17,26,17,colors.red) else box(23,17,26,17,colors.lime)
    end

    pos(5,19)
    bCol(darkmodec)
    write("Silver Ingot")
    if boolArray[9]==false then
        box(23,19,26,19,colors.red) else box(23,19,26,19,colors.lime)
    end

    pos(28,3)
    bCol(darkmodec)
    write("Desh Ingot")
    if boolArray[10]==false then
        box(46,3,49,3,colors.red) else box(46,3,49,3,colors.lime)
    end

    pos(28,5)
    bCol(darkmodec)
    write("Tin Ingot")
    if boolArray[11]==false then
        box(46,5,49,5,colors.red) else box(46,5,49,5,colors.lime)
    end

    pos(28,7)
    bCol(darkmodec)
    write("Copper Ingot")
    if boolArray[12]==false then
        box(46,7,49,7,colors.red) else box(46,7,49,7,colors.lime)
    end

    pos(28,9)
    bCol(darkmodec)
    write("Andesite Alloy")
    if boolArray[13]==false then
        box(46,9,49,9,colors.red) else box(46,9,49,9,colors.lime)
    end

    
    pos(1,h)
    bCol(colors.black)
    write("EXIT")
    while true do
    
        local event, button, mx, my = os.pullEvent()
        if event == "monitor_touch" then
        
            if mx >= 1 and mx <= (1+#"EXIT") and my == h then
                menu.main()             
            elseif mx >= 23 and mx<= 26 and my == 3 then
                boolArray[1] = not boolArray[1]
                foundry()
            elseif mx >= 23 and mx<= 26 and my == 5 then
                boolArray[2] = not boolArray[2]
                foundry()
            elseif mx >= 23 and mx<= 26 and my == 7 then
                boolArray[3] = not boolArray[3]
                foundry()
            elseif mx >= 23 and mx<= 26 and my == 9 then
                boolArray[4] = not boolArray[4]
                foundry()
            elseif mx >= 23 and mx<= 26 and my == 11 then
                boolArray[5] = not boolArray[5]
                foundry()
            elseif mx >= 23 and mx<= 26 and my == 13 then
                boolArray[6] = not boolArray[6]
                foundry()
            elseif mx >= 23 and mx<= 26 and my == 15 then
                boolArray[7] = not boolArray[7]
                foundry()
            elseif mx >= 23 and mx<= 26 and my == 17 then
                boolArray[8] = not boolArray[8]
                foundry()
            elseif mx >= 23 and mx<= 26 and my == 19 then
                boolArray[9] = not boolArray[9]
                foundry()
            elseif mx >= 46 and mx<= 49 and my == 3 then
                boolArray[10] = not boolArray[10]
                foundry()
            elseif mx >= 46 and mx<= 49 and my == 5 then
                boolArray[11] = not boolArray[11]
                foundry()
            elseif mx >= 46 and mx<= 49 and my == 7 then
                boolArray[12] = not boolArray[12]
                foundry()
            elseif mx >= 46 and mx<= 49 and my == 9 then
                boolArray[13] = not boolArray[13]
                foundry()
            
            elseif mx >= w/2-#"FOUNDRY"/2 and mx <= w/2+#"FOUNDRY"/2 and my == 1 then
                darkmode = not darkmode
                foundry()
            end
        end
    end 
end

return {foundry = foundry}