Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print()
- local modem = peripheral.find("modem")
- modem.open(3777)
- local exitPressed = false
- local AnimationTable = {"[O---]","[-O--]","[--O-]","[---O]"}
- local function DrawExit()
- term.setCursorPos(17,1)
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- print("<")
- term.setBackgroundColor(colors.black)
- term.setTextColor(1)
- end
- local function findWhichButton(x,y)
- if (y == 5) and x == 2 then
- return 0
- elseif y==5 and (x==5 or x==6) then
- return -3
- elseif (y==5) and (13<x and x<17) then
- return 10
- elseif y==1 and x == 17 then
- return -1
- elseif x==2 or x==4 or x==6 then
- if y==2 then
- return x/2
- elseif y==3 then
- return x/2 + 3
- elseif y==4 then
- return x/2 + 6
- end
- end
- return -2
- end
- local function useKeyPad(BlocksOrIngots)
- shell.execute("clear")
- exitPressed = false
- local Num = 0
- print()
- for i = 1 ,9 do
- write("|")
- term.setTextColor(colors.lightBlue)
- write(i)
- term.setTextColor(1)
- if i%3==0 then write("|\n") end
- end
- write("|")
- term.setTextColor(colors.lightBlue)
- write(0)
- term.setTextColor(1)
- write("|[")
- term.setTextColor(colors.orange)
- write("<<")
- term.setTextColor(1)
- write("]")
- term.setCursorPos(12,5)
- write("[")
- term.setTextColor(colors.lime)
- write("Enter")
- term.setTextColor(1)
- write("]")
- sleep(0.1)
- if BlocksOrIngots == "Blocks" then
- term.setCursorPos(9,2)
- write("Enter num")
- term.setCursorPos(9,3)
- write("of Blocks")
- elseif BlocksOrIngots == "Ingots" then
- term.setCursorPos(9,2)
- write("Enter num")
- term.setCursorPos(9,3)
- write("of Ingots")
- end
- DrawExit()
- local i = 0
- repeat
- local event, button, x, y = os.pullEvent("mouse_click")
- local Button = findWhichButton(x,y)
- if Button == 0 and i ~= 0 then
- Num = Num * 10
- i = i + 1
- elseif Button == 10 then
- i = 5
- elseif Button == -2 then
- elseif Button == -1 then
- i = 5
- exitPressed = true
- elseif Button == -3 then
- if i~=0 then
- Num = (Num - (Num%10))/10
- i = i - 1
- end
- else
- Num = Num*10 + Button
- i = i + 1
- end
- term.setCursorPos(1,1)
- term.clearLine(0)
- write(Num)
- DrawExit()
- until i > 3
- if exitPressed == true then
- else
- return Num
- end
- end
- local function UseCastingManu()
- exitPressed = false
- shell.execute("clear")
- term.setCursorPos(1,3)
- write("[")
- term.setTextColor(colors.lightBlue)
- write("Blocks")
- term.setTextColor(1)
- write("] [")
- term.setTextColor(colors.lightBlue)
- write("Ingots")
- term.setTextColor(1)
- write("]")
- DrawExit()
- local tempOwO = 0
- repeat
- local event, button, x, y = os.pullEvent("mouse_click")
- if 1<x and x<8 and y == 3 then
- tempOwO = "Blocks"
- elseif 11<x and x<18 and y == 3 then
- tempOwO = "Ingots"
- elseif x==17 and y==1 then
- tempOwO = 1
- exitPressed = true
- end
- until tempOwO ~= 0
- if exitPressed == false then
- local ItemNum = useKeyPad(tempOwO)
- if ItemNum ~= nil then
- local MsgPackage = {ItemNum,tempOwO}
- modem.transmit(3777,3777,MsgPackage)
- shell.execute("clear")
- term.getCursorPos(6,3)
- write("Casting")
- local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
- end
- end
- end
- local function UseTankOrMixing(TankOrMixing)
- exitPressed = false
- shell.execute("clear")
- term.setCursorPos(7,3)
- write("[")
- term.setTextColor(colors.lightBlue)
- write("Pour")
- term.setTextColor(1)
- write("]")
- DrawExit()
- local i = false
- repeat
- local event, button, x, y = os.pullEvent("mouse_click")
- if y == 1 and x == 17 then
- exitPressed = true
- i = true
- elseif y == 3 and 7<x and x<12 then
- i = true
- end
- until i == true
- if exitPressed == false then
- if TankOrMixing == "Mixing" then
- redstone.setOutput("left",true)
- sleep(0.3)
- redstone.setOutput("left",false)
- elseif TankOrMixing == "Tank" then
- redstone.setOutput("back",true)
- sleep(0.4)
- redstone.setOutput("back",false)
- end
- shell.execute("clear")
- for j = 1 , 25 do
- for i = 1 , 4 do
- term.setCursorPos(7,3)
- write(AnimationTable[i])
- sleep(0.3)
- end
- end
- end
- end
- local function UseTankManu()
- exitPressed = false
- shell.execute("clear")
- term.setCursorPos(1,2)
- write("[")
- term.setTextColor(colors.lightBlue)
- write("Casting")
- term.setTextColor(1)
- write("]")
- term.setCursorPos(1,4)
- write("[")
- term.setTextColor(colors.lightBlue)
- write("Mixing")
- term.setTextColor(1)
- write("]")
- DrawExit()
- local tempUwU = 0
- repeat
- local event, button, x, y = os.pullEvent("mouse_click")
- if y==2 and 1<x and x<9 then
- tempUwU = "Casting"
- elseif y==4 and 1<x and x<8 then
- tempUwU = "Mixing"
- elseif y==1 and x==17 then
- tempUwU = 1
- exitPressed = true
- end
- until tempUwU ~= 0
- if exitPressed == false then
- if tempUwU == "Casting" then
- UseCastingManu()
- elseif tempUwU == "Mixing" then
- UseTankOrMixing("Mixing")
- end
- end
- end
- while true do
- shell.execute("clear")
- term.setCursorPos(1,2)
- write("[")
- term.setTextColor(colors.orange)
- write("Smeltery")
- term.setTextColor(1)
- write("]")
- term.setCursorPos(1,4)
- write("[")
- term.setTextColor(colors.blue)
- write("Tank")
- term.setTextColor(1)
- write("]")
- local i = 0
- repeat
- local event, button, x, y = os.pullEvent("mouse_click")
- if y == 2 and 1<x and x<9 then
- i = "Smeltery"
- elseif y == 4 and 1<x and x<6 then
- i = "Tank"
- end
- until i ~= 0
- if i == "Smeltery" then
- UseTankOrMixing("Tank")
- elseif i == "Tank" then
- UseTankManu()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement