Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- transSide="back"
- receiveSide="right"
- m = peripheral.wrap("top")
- m.clear()
- m.setBackgroundColor(colors.black)
- trans = peripheral.wrap(transSide)
- receive = peripheral.wrap(receiveSide)
- local button={}
- --create mob to frequency tables
- mobTableOn = {pig = 4001,
- angryzombie = 4002,
- cavespider = 4003,
- pigman = 4004,
- chicken = 4005,
- mooshroom = 4006,
- skeleton = 4007,
- blaze = 4008,
- creeper = 4009,
- endermen = 4010,
- witherskeleton = 4011}
- mobTableOff = {pig = 4101,
- angryzombie = 4102,
- cavespider = 4103,
- pigman = 4104,
- chicken = 4105,
- mooshroom = 4106,
- skeleton = 4107,
- blaze = 4108,
- creeper = 4109,
- endermen = 4110,
- witherskeleton = 4111}
- function setTable(name, text, xmin, ymin, width, height, onFreq, offFreq)
- button[name] = {}
- button[name]["text"] = text
- button[name]["active"] = false
- button[name]["xmin"] = xmin
- button[name]["ymin"] = ymin
- button[name]["width"] = width
- button[name]["height"] = height
- button[name]["onFreq"] = onFreq
- button[name]["offFreq"] = offFreq
- end
- function toggleButton(name)
- button[name]["active"] = not buttonAPI[name]["active"]
- end
- function drawButton(x, y, width, height, bcolor, tcolor, text)
- m.setBackgroundColor(bcolor)
- --Draw the background
- for i=1,height do
- m.setCursorPos(x,y+i-1)
- m.write(string.rep(" ", width))
- end
- -- m.setBackgroundColor(colors.black)
- --Write the text
- m.setTextColor(tcolor)
- local textX = x + math.floor(width/2 - string.len(text)/2)
- local textY = y + math.floor(height/2)
- m.setCursorPos(textX, textY)
- m.write(text)
- end
- --name, text, xmin, ymin, width, height, onFreq, offFreq
- function regButtons()
- setTable("creeper", "Creeper", 2, 1, 7, 1, 4009 ,4109)
- setTable("endermen", "Endermen", 10, 1, 8, 1, 4010 ,4110)
- setTable("angryzombie", "Angry Zombie", 19, 1, 12, 1, 4009,4109)
- setTable("cavespider", "Cave Spider", 32, 1, 11, 1, 4009,4109)
- setTable("pigman", "Pigmen", 44, 1, 6, 1, 4009,4109)
- setTable("witherskeleton", "Wither Skeleton", 2, 3, 15, 1, 4009,4109)
- setTable("skeleton", "Skeleton", 18, 3, 8, 1, 4009,4109)
- setTable("blaze", "Blaze", 27, 3, 5, 1, 4009,4109)
- setTable("mooshroom", "Mooshroom", 33, 3, 9, 1, 4009,4109)
- setTable("chicken", "Chicken", 43, 3, 7, 1, 4009,4109)
- setTable("pig", "Pig", 2, 5, 3, 1, 4009,4109)
- setTable("twmobs", "Twilight Forest Mobs", 6 ,5 ,20 ,1 , 4009,4109)
- setTable("xp_mode", "XP Mode", 43, 5, 7, 1 , 0,0)
- end
- function displayGUI()
- m.clear()
- m.setBackgroundColor(colors.black)
- regButtons()
- for name,data in pairs(button) do
- print(name.." : "..data)
- end
- -- drawButton(button["pig"][xmin],button["pig"][ymin],button["pig"][width],button["pig"][height],colors.blue, colors.white,button["pig"][text])
- -- drawButton(2,1,7,1,colors.blue, colors.white, "Creeper")
- -- drawButton(10,1,8,1,colors.blue, colors.white, "Endermen")
- -- drawButton(19,1,12,1,colors.blue, colors.white, "Angry Zombie")
- -- drawButton(32,1,11,1,colors.blue, colors.white, "Cave Spider")
- -- drawButton(44,1,6,1,colors.blue, colors.white, "Pigmen")
- -- drawButton(2,3,15,1,colors.blue, colors.white, "Wither Skeleton")
- -- drawButton(18,3,8,1,colors.blue, colors.white, "Skeleton")
- -- drawButton(27,3,5,1,colors.blue, colors.white, "Blaze")
- -- drawButton(33,3,9,1,colors.blue, colors.white, "Mooshroom")
- -- drawButton(43,3,7,1,colors.blue, colors.white, "Chicken")
- -- drawButton(2,5,3,1,colors.blue, colors.white, "Pig")
- -- drawButton(6,5,20,1,colors.blue, colors.white, "Twilight Forest Mobs")
- -- drawButton(43,5,7,1,colors.lime, colors.white, "XP Mode")
- end
- function enableSpawer(mob)
- if checkMobDisabled(mob) then
- trans.setFreq(mobTableOn[mob])
- redstone.setOutput(transSide, true)
- sleep(.4)
- redstone.setOutput(transSide, false)
- print(mob.." enabled")
- else
- print(mob.." already enabled")
- end
- trans.setFreq(0)
- end
- function disableSpawer(mob)
- if checkMobDisabled(mob) then
- print(mob.." already disabled")
- else
- trans.setFreq(mobTableOn[mob])
- redstone.setOutput(transSide, true)
- sleep(.4)
- redstone.setOutput(transSide, false)
- print(mob.." disabled")
- end
- trans.setFreq(0)
- end
- function toggleSpawner(mob)
- end
- function checkMobDisabled(mob)
- receive.setFreq(mobTableOff[mob])
- if redstone.getInput(receiveSide) then
- return true
- else
- return false
- end
- end
- function disableAll()
- for k, v in pairs(mobTableOn) do
- disableSpawer(k)
- end
- end
- function xpMode()
- end
- tArgs = {...}
- if tArgs[1] == nil then
- print("Usage: spawner enable|disable <mob>")
- print("Alt Usage: spawner disableAll")
- print("Mob options:")
- for k, v in pairs(mobTableOn) do
- print(k)
- sleep(0.1)
- end
- elseif string.lower(tArgs[1]) == "enable" and string.lower(tArgs[2]) ~= nil then
- enableSpawer(string.lower(tArgs[2]))
- elseif string.lower(tArgs[1]) == "disable" and tArgs[2] ~= nil then
- disableSpawer(string.lower(tArgs[2]))
- elseif string.lower(tArgs[1]) == "disableall" then
- disableAll()
- elseif string.lower(tArgs[1]) == "gui" then
- displayGUI()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement