Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Farm Control
- --Vars
- pipe = peripheral.wrap("back")
- mon = peripheral.wrap("right")
- farmSize = 80
- essMin = 10
- essMax = 200000
- --Table/Arrays
- local itemMap = {
- [1] = {"Air Shard",8535,8536},
- [2] = {"Blaze",8457,8419},
- [3] = {"Certus Quartz",8481,8482},
- [4] = {"Chicken",8465,8427},
- [5] = {"Dye",8441,8402},
- [6] = {"Emerald",8456,8418},
- [7] = {"Enderium",8515,8516},
- [8] = {"Enderman",8459,8421},
- [9] = {"Fluix",8517,8518},
- [10] = {"Ghast",8460,8422},
- [11] = {"Gold",8451,8413},
- [12] = {"Manasteel",8523,8524},
- [13] = {"Platinum",8495,8496},
- [14] = {"Quartz",8454,8416},
- [15] = {"Spider",8463,8425},
- [16] = {"Wither",8464,8426},
- [17] = {"Terrasteel",8533,8534},
- [18] = {"Diamond",8455,8417},
- [19] = {"Cow",8466,8428},
- [20] = {"Wheat",296,295},
- [21] = {"Minico",8433,8405},
- [22] = {"Redstone",8446,8408},
- [23] = {"Glowstone",8447,8409},
- [24] = {"Iron",8450,8412},
- [25] = {"Skeleton",8461,8423},
- [26] = {"Nature",8444,8406},
- [27] = {"Creeper",8458,8420},
- [28] = {"Lapis",8452,8414},
- [29] = {"Nether",8449,8411},
- [30] = {"Earth",8442,8403},
- [31] = {"Water",8445,8407},
- [32] = {"Steel",8531,8532},
- [33] = {"Copper",8479,8480}
- }
- --Functions
- function redOn()
- --turns on the redstone signal
- redstone.setOutput("bottom",true)
- end
- function redOff()
- --turns off the redstone signal
- redstone.setOutput("bottom",false)
- end
- function redTog(time)
- --turns on the redstone signal for var time in
- --seconds
- redOn()
- sleep(time)
- redOff()
- end
- function callItem(ident,amt)
- --calls the item with id ident and from the ME system
- --the number of items called is amt
- lp = pipe.getLP()
- builder = lp.getItemIdentifierBuilder()
- builder.setItemID(ident)
- item = builder.build()
- pipe.makeRequest(item,amt)
- end
- function quaryAmt(ident)
- lp = pipe.getLP()
- builder = lp.getItemIdentifierBuilder()
- builder.setItemID(ident)
- item = builder.build()
- itemAmt = pipe.getItemAmount(item)
- -- print(itemAmt)
- end
- function amtLoop(time)
- a = itemMap
- for i = 1, #itemMap do
- -- print(tostring(a[i][2]))
- quaryAmt(a[i][2])
- if itemAmt < essMax then
- print("Planting "..a[i][1].."seeds")
- quaryAmt(a[i][3])
- amt = itemAmt
- if amt > farmSize then
- amt = farmSize
- print("To Many Seeds... Planting: "..amt)
- else
- print("Not Enough Seeds... Planting: "..amt)
- end
- callItem(a[i][3],amt)
- quaryAmt(a[i][2])
- while itemAmt < essMax do
- sleep(5)
- quaryAmt(a[i][2])
- print(a[i][1].." Essence at: "..itemAmt)
- end
- print(a[i][1].." Compleate: Changeing Crop")
- redTog(time)
- else
- print(a[i][1].. " at set cap, cycleing...")
- sleep(1)
- end
- end
- end
- --Script
- term.clear()
- print("Farm Control Startup")
- while true do
- amtLoop(240)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement