Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Forestry V1.01
- --written in 05/2025 by Kay Michaelsen
- --
- --vardef
- --
- monitor1 = peripheral.wrap("monitor_16")
- monitor2 = peripheral.wrap("monitor_0")
- monitor3 = peripheral.wrap("monitor_15")
- monitor4 = peripheral.wrap("monitor_8")
- monitor5 = peripheral.wrap("monitor_10")
- --monitor6 = peripheral.wrap("monitor_16")
- rss = peripheral.wrap("meBridge_0")
- --
- obergrenze = 1000
- aPro = 0
- arsn = "ars_nouveau:"
- arse = "ars_elemental:"
- myst = "mysticalagriculture:"
- imm = "immersiveengineering:"
- minc = "minecraft:"
- biom = "biomesoplenty:"
- cau ="caupona:"
- dyn = "integrateddynamics:"
- twf = "twilightforest"
- automat = true
- dPage = 1
- dMax = 0
- pName = {}
- pDN = {}
- pStat = {}
- pByte = {}
- pFound = {}
- pStored = {}
- pSide = {}
- pMax = {}
- aPro = 28
- dMax = math.floor(aPro / 18) +1
- for zahl = 1, aPro do
- pMax[zahl] = obergrenze
- end
- for lauf = 1,14 do
- pSide[lauf] = 1
- pSide[lauf + 15] = 2
- end
- for lauf = 1, aPro do
- pStored[lauf] = 0
- end
- pName[1] = minc.."oak_log"
- pDN[1] = "Oak"
- pStat[1] = false
- pByte[1] = colors.green
- pSide[1] = 1
- pMax[1] = 3000
- pName[2] = minc.."dark_oak_log"
- pDN[2] = "Dark Oak"
- pStat[2] = false
- pByte[2] = colors.brown
- pSide[2] = 1
- pMax[2] = 3000
- pName[3] = minc.."bamboo"
- pDN[3] = "Bamboo"
- pStat[3] = false
- pByte[3] = colors.blue
- pSide[3] = 1
- pMax[3] = 1000
- pName[4] = dyn.."menril_log"
- pDN[4] = "Menril"
- pStat[4] = true
- pByte[4] = colors.purple
- pSide[4] = 1
- pMax[4] = 1000
- pName[5] = arsn.."blue_archwood_log"
- pDN[5] = "Cascading Ar."
- pStat[5] = false
- pByte[5] = colors.cyan
- pSide[5] = 1
- pMax[5] = 1000
- pName[6] = arsn.."red_archwood_log"
- pDN[6] = "Blazing Ar."
- pStat[6] = false
- pByte[6] = colors.lightGray
- pSide[6] = 1
- pMax[6] = 1000
- pName[7] = arsn.."green_archwood_log"
- pDN[7] = "FlourishAr."
- pStat[7] = true
- pByte[7] = colors.gray
- pSide[7] = 1
- pMax[7] = 1000
- pName[8] = arse.."yellow_archwood_log"
- pDN[8] = "Flashing Ar."
- pStat[8] = true
- pByte[8] = colors.pink
- pSide[8] = 1
- pMax[8] = 1000
- pName[9] =arsn.."purple_archwood_log"
- pDN[9] = "Vexing Ar."
- pStat[9] = false
- pByte[9] = colors.lime
- pSide[9] = 1
- pMax[9] = 1000
- pName[10] = biom.."palm_log"
- pDN[10] = "Palm"
- pStat[10] = false
- pByte[10] = colors.yellow
- pSide[10] = 1
- pMax[10] = 1000
- pName[11] = minc.."acacia_log"
- pDN[11] = "Acacia"
- pStat[11] = false
- pByte[11] = colors.lightBlue
- pSide[11] = 1
- pMax[11] = 1000
- pName[12] = minc.."mangrove_log"
- pDN[12] = "Mangrove Pr."
- pStat[12] = false
- pByte[12] = colors.magenta
- pSide[12] = 1
- pMax[12] = 1000
- pName[13] = twf.."mangrove_log"
- pDN[13] = "Mangrove"
- pStat[13] = true
- pByte[13] = colors.orange
- pSide[13] = 1
- pMax[13] = 1000
- pName[14] = "blue_skies:maple_log"
- pDN[14] = "Maple"
- pStat[14] = true
- pByte[14] = colors.white
- pMax[14] = 1000
- pSide[14] = 1
- pName[15] = "silentgear:netherwood_log"
- pDN[15] = "Netherwood"
- pStat[15] = true
- pByte[15] = colors.green
- pSide[15] = 2
- pMax[15] = 1000
- pName[16] = minc.."birch_log"
- pDN[16] = "Birch"
- pStat[16] = true
- pByte[16] = colors.brown
- pSide[16] = 2
- pMax[16] = 1000
- pName[17] = minc.."cherry_log"
- pDN[17] = "Cherry"
- pStat[17] = true
- pByte[17] = colors.blue
- pSide[17] = 2
- pMax[17] = 1000
- pName[18] = biom.."mahogany_log"
- pDN[18] = "Mahogany"
- pStat[18] = true
- pByte[18] = colors.purple
- pSide[18] = 2
- pMax[18] = 1000
- pName[19] = biom.."redwood_log"
- pDN[19] = "Redwood"
- pStat[19] = true
- pByte[19] = colors.cyan
- pSide[19] = 2
- pMax[19] = 1000
- pName[20] = "gtceu:rubber_log"
- pDN[20] = "Rubber"
- pStat[20] = true
- pByte[20] = colors.lightGray
- pSide[20] = 2
- pMax[20] = 1000
- pName[21] = "aether:skyroot_log"
- pDN[21] = "Skyroot"
- pStat[21] = true
- pByte[21] = colors.gray
- pSide[21] = 2
- pMax[21] = 1000
- pName[22] = "undergarden:grongle_log"
- pDN[22] = "Grongle"
- pStat[22] = true
- pByte[22] = colors.pink
- pSide[22] = 2
- pMax[22] = 1000
- pName[23] = "undergarden:smogstem_log"
- pDN[23] = "Smogstem"
- pStat[23] = true
- pByte[23] = colors.lime
- pSide[23] = 2
- pMax[23] = 1000
- pName[24] = cau.."walnut_log"
- pDN[24] = "Walnut"
- pStat[24] = true
- pByte[24] = colors.yellow
- pSide[24] = 2
- pMax[24] = 1000
- pName[25] = minc.."spruce_log"
- pDN[25] = "Spruce"
- pStat[25] = true
- pByte[25] = colors.lightBlue
- pSide[25] = 2
- pMax[25] = 1000
- pName[26] = minc.."jungle_log"
- pDN[26] = "Jungle"
- pStat[26] = true
- pByte[26] = colors.magenta
- pSide[26] = 2
- pMax[26] = 1000
- pName[27] = "croptopia:cinnamon_log"
- pDN[27] = "Cinnamon"
- pStat[27] = true
- pByte[27] = colors.orange
- pSide[27] = 2
- pMax[27] = 1000
- pName[28] = biom.."jacaranda_log"
- pDN[28] = "Jacaranda"
- pStat[28] = true
- pByte[28] = colors.white
- pSide[28] = 2
- pMax[28] = 1000
- function UserCommand( xpos, ypos)
- local bunt = {}
- print("UC" ,xpos ,ypos)
- if ypos == 23 then
- if (xpos>42) and (xpos<54) then
- if automat == true then
- automat = false
- else
- automat = true
- end
- end
- elseif ypos == 1 then
- if (xpos<6) then
- --prev page
- if dPage > 1 then
- dPage = dPage -1
- end
- elseif (xpos>52) then
- if dPage < dMax then
- dPage = dPage +1
- end
- end
- elseif (ypos == 4) or (ypos == 7) or (ypos == 10) or (ypos == 13) or (ypos == 16) or (ypos == 19) then
- npos = (ypos-1) / 3 - 1
- mpos = 0
- if (xpos>9) and (xpos<16) then
- mpos = 1
- elseif (xpos>28) and (xpos<35) then
- mpos = 2
- elseif (xpos>47) and (xpos<54) then
- mpos = 3
- end
- if not(mpos == 0) then
- proNr = (dPage - 1) * 18 + npos * 3 + mpos
- print(proNr)
- if pStat[proNr] == false then
- pStat[proNr] = true
- else
- pStat[proNr] = false
- end
- bunt[1] = 0
- bunt[2] = 0
- bunt[3] = 0
- for mpos = 1, aPro do
- if pStat[mpos] == true then
- bunt[pSide[mpos]] = bunt[pSide[mpos]] + pByte[mpos]
- end
- end
- redstone.setBundledOutput("right", bunt[1])
- redstone.setBundledOutput("bottom", bunt[2])
- --redstone.setBundledOutput("bottom", bunt[3])
- print(bunt[1], bunt[2])
- end
- end
- end
- function CheckInferiumReihe(lesen)
- for i = 1,aPro do
- pFound[i] = false
- end
- such = {}
- such.name = "mysticalagriculture"
- rs = rss.listItems()
- if not(rs == nil) then
- for slot, item in pairs(rs) do
- for i = 1, aPro do
- if item.name == pName[i] then
- found = true
- pStored[i] = item.amount
- pFound[i] = true
- if automat == true then
- if item.amount > pMax[i] then
- pStat[i] = false
- else
- pStat[i] = true
- end
- end
- end
- end
- end
- for I = 1, aPro do
- if pFound[i] == false then
- print(pName[i].." not found!")
- end
- end
- end
- rs = rss.listFluid()
- if not(rs == nil) then
- for slot, item in pairs(rs) do
- for i = 1, aPro do
- if item.name == pName[i] then
- found = true
- pStored[i] = item.amount / 1000
- pFound[i] = true
- if automat == true then
- if (item.amount / 1000) > pMax[i] then
- pStat[i] = false
- else
- pStat[i] = true
- end
- end
- end
- end
- end
- end
- local bunt = {}
- bunt[1] = 0
- bunt[2] = 0
- bunt[3] = 0
- for i = 1, aPro do
- if pStat[i] == true then
- bunt[pSide[i]] = bunt[pSide[i]] + pByte[i]
- end
- end
- redstone.setBundledOutput("right", bunt[1])
- redstone.setBundledOutput("bottom", bunt[2])
- --redstone.setBundledOutput("bottom", bunt[3])
- end
- function MonAufbau(moni)
- if not(moni == nil) then
- moni.setTextScale(0.5)
- moni.setBackgroundColor(colors.black)
- moni.clear()
- moni.setBackgroundColor(colors.green)
- moni.setTextColor(colors.black)
- moni.setCursorPos(13,1)
- moni.write(" *** Wuffelz Forestry Control *** ")
- moni.setCursorPos(2,1)
- if dPage > 1 then
- moni.setBackgroundColor(colors.orange)
- else
- moni.setBackgroundColor(colors.black)
- moni.setTextColor(colors.orange)
- end
- moni.write(" << ")
- moni.setCursorPos(7,1)
- moni.setBackgroundColor(colors.black)
- moni.setTextColor(colors.orange)
- moni.write(string.format("%1d", dPage))
- moni.setCursorPos(53,1)
- if dPage < dMax then
- moni.setBackgroundColor(colors.orange)
- moni.setTextColor(colors.black)
- else
- moni.setBackgroundColor(colors.black)
- moni.setTextColor(colors.orange)
- end
- moni.write(" >> ")
- for i = 1,6 do
- k = (i-1) * 3 + 1
- for j = 0,2 do
- moni.setBackgroundColor(colors.black)
- moni.setTextColor(colors.blue)
- if j == 1 then
- moni.setTextColor(colors.orange)
- end
- px = j * 19
- py = (i-1) * 3 + 3
- moni.setCursorPos(px + 1, py)
- pr = k + j + ((dPage - 1) * 18)
- if pr <= aPro then
- moni.write(pDN[pr])
- moni.setCursorPos(px+13, py)
- moni.write(string.format("%6d", pStored[pr]))
- moni.setCursorPos(px + 1, py + 1)
- if pStat[pr] == true then
- moni.setTextColor(colors.lime)
- moni.write("online")
- moni.setTextColor(colors.white)
- moni.setBackgroundColor(colors.red)
- moni.setCursorPos(px + 10, py + 1)
- moni.write("-> off")
- else
- moni.setTextColor(colors.red)
- moni.write("offline")
- moni.setTextColor(colors.white)
- moni.setBackgroundColor(colors.lime)
- moni.setCursorPos(px + 10, py + 1)
- moni.write("-> on ")
- end
- end
- end
- end
- moni.setBackgroundColor(colors.black)
- moni.setTextColor(colors.blue)
- moni.setCursorPos(5,23)
- moni.write("Automatic limit control is ")
- moni.setCursorPos(33,23)
- if automat then
- moni.setTextColor(colors.lime)
- moni.write("enabled ")
- moni.setCursorPos(43,23)
- moni.setBackgroundColor(colors.red)
- moni.setTextColor(colors.white)
- moni.write("-> disable ")
- else
- moni.setTextColor(colors.red)
- moni.write("disabled ")
- moni.setCursorPos(43,23)
- moni.setBackgroundColor(colors.lime)
- moni.setTextColor(colors.white)
- moni.write("-> enable ")
- end
- end
- end
- while true do
- CheckInferiumReihe(lesen)
- MonAufbau(monitor1)
- MonAufbau(monitor2)
- MonAufbau(monitor3)
- MonAufbau(monitor4)
- MonAufbau(monitor5)
- --MonAufbau(monitor6)
- event, button, x, y = os.pullEventRaw()
- if event == "terminate" then
- break
- elseif event == "redstone" then
- --neuer Durchlauf
- elseif (event == "monitor_touch") and (button == "monitor_16") then
- UserCommand( x, y)
- elseif (event == "monitor_touch") and (button == "monitor_0") then
- UserCommand( x, y)
- elseif (event == "monitor_touch") and (button == "monitor_15") then
- UserCommand( x, y)
- elseif (event == "monitor_touch") and (button == "monitor_8") then
- UserCommand( x, y)
- elseif (event == "monitor_touch") and (button == "monitor_10") then
- UserCommand( x, y)
- else
- print(event, button, x, y)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment