Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- MOB Farmer Program
- -- Author: theonlycozzy
- -- Build 3 July 3, 2013
- local chat = peripheral.wrap("top")
- local m = peripheral.wrap("left")
- local active = false
- local curOutput = 0
- local mods = {"theonlycozzy","ijpooi","jitsublade","beslam","t_ork","detoxii"}
- local mobs = {
- skeleton = {active=false,x=4,y=3,output=colors.lime},
- zombie = {active=false,x=4,y=4,output=colors.pink},
- spider = {active=false,x=4,y=5,output=colors.orange},
- blaze = {active=false,x=4,y=6,output=colors.lightGray},
- creeper = {active=false,x=4,y=7,output=colors.yellow},
- mooshroom = {active=false,x=4,y=8,output=colors.white},
- witch = {active=false,x=4,y=9,output=colors.lightBlue},
- magmaCube = {active=false,x=4,y=10,output=colors.magenta},
- enderman = {active=false,x=4,y=11,output=colors.gray},
- skeletonWither = {active=false,x=19,y=3,output=colors.cyan},
- chicken = {active=false,x=19,y=4,output=colors.purple}}
- if cozCore == nil then
- os.loadAPI("cozCore")
- end
- local X,Y = m.getSize()
- m.setCursorPos(6,Y-1)
- m.write("Use '-soc mob toggle [NAME]'")
- m.setCursorPos(6,Y)
- m.write("Use '-soc mob alloff' to shutdown system")
- while true do
- for name,data in pairs(mobs) do
- if data.active then
- m.setCursorPos(data.x,data.y)
- m.setBackgroundColor(colors.lime)
- m.write("->"..name.." ")
- m.setBackgroundColor(colors.black)
- else
- m.setCursorPos(data.x,data.y)
- m.setBackgroundColor(colors.red)
- m.write(" "..name.." ")
- m.setBackgroundColor(colors.black)
- end
- end
- e,p1,p2 = os.pullEvent()
- if e == "redstone" then
- local input = rs.getBundledInput("right")
- if input == 1 then -- all off
- os.sleep(0.9)
- chat.say("[Spirit of Coz] Emergency Shutoff Aknowledged",128)
- for name,data in pairs(mobs) do
- data.active = false
- end
- elseif input == 2 then -- all on
- os.sleep(0.9)
- chat.say("[Spirit of Coz] Warning! Activated All Mobs",128)
- for name,data in pairs(mobs) do
- data.active = true
- end
- end
- end
- if e == "chat" then
- local args = cozCore.splitString(string.lower(p2))
- for k,v in pairs(mods) do
- if v == string.lower(p1) then
- if args[1] == "-soc" then
- if args[2] == "mob" then
- if args[3] == "toggle" then
- for name,data in pairs(mobs) do
- if string.lower(name) == args[4] then
- if data.active then
- data.active = not data.active
- os.sleep(0.3)
- chat.say("[Spirit of Coz] De-actived Mob "..name,128)
- else
- data.active = not data.active
- os.sleep(0.3)
- chat.say("[Spirit of Coz] Actived Mob "..name,128)
- end
- end
- end
- elseif args[3] == "alloff" then
- for name,data in pairs(mobs) do
- data.active = false
- end
- os.sleep(0.3)
- chat.say("[Spirit of Coz] Mob Farm shutdown Complete",128)
- curOutput = 0
- end
- end
- end
- end
- end
- end
- curOutput = 0
- for name,data in pairs(mobs) do
- if data.active then
- curOutput = curOutput + data.output
- end
- end
- if curOutput > 1 then
- active = true
- else
- active = false
- end
- rs.setOutput("bottom",active)
- rs.setBundledOutput("back",curOutput)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement