local rsSide = "back"
local sCount = 1
local mon = peripheral.wrap("right")
local spawn = {
creeper = {status = "off", color = colors.green, yPos = 3,},
witch = {status = "off", color = colors.red, yPos = 4,},
skeleton = {status = "off", color = colors.white, yPos = 5,},
blaze = {status = "off", color = colors.orange, yPos = 6,},
pigmen = {status = "off", color = colors.yellow, yPos = 7,},
slime = {status = "off", color = colors.lime, yPos = 8,},
chicken = {status = "off", color = colors.pink, yPos = 9,},
zombie = {status = "off", color = colors.purple, yPos = 10,},
cow = {status = "off", color = colors.brown, yPos = 11,},
spider = {status = "off", color = colors.lightGray, yPos = 12,},
wither = {status = "off", color = colors.black, yPos = 13,},
}
local function header()
mon.clear()
mon.setCursorPos(1,1)
mon.setBackgroundColor(colors.black)
mon.setTextColor(colors.white)
mon.write("Camp's Spawner v0.3")
for mob, data in pairs(spawn) do
mon.setCursorPos(3, data.yPos)
mon.write(" "..mob..": ")
if data.status == "on" then
mon.setBackgroundColor(colors.green)
mon.setTextColor(colors.white)
elseif data.status == "off" then
mon.setBackgroundColor(colors.red)
mon.setTextColor(colors.black)
end
mon.setCursorPos(16,data.yPos)
mon.write(data.status)
mon.setBackgroundColor(colors.black)
mon.setTextColor(colors.white)
mon.setCursorPos(24,data.yPos)
mon.write(sCount)
end
end
local function toggleSpawn()
for mob,data in pairs(spawn) do
if data.status == "on" then
rs.setBundledOutput(rsSide, rs.getBundledOutput(rsSide)-data.color)
data.status = "on"
else
rs.setBundledOutput(rsSide, rs.getBundledOutput(rsSide)+data.color)
data.status = "off"
end
end
end
local function checkClick(row, xMin, xMax, mob)
if yClick == row then
if xClick >= xMin and xClick <= xMax then
if mob == "off" then
mob = "on"
else
mob = "off"
end
end
end
end
while true do
toggleSpawn()
header()
event, side, xClick, yClick = os.pullEvent("monitor_touch")
checkClick(3,16,21,spawn.creeper.status)
checkClick(4,16,21,spawn.witch.status)
checkClick(5,16,21,spawn.skeleton.status)
checkClick(6,16,21,spawn.blaze.status)
checkClick(7,16,21,spawn.pigmen.status)
checkClick(8,16,21,spawn.slime.status)
checkClick(9,16,21,spawn.chicken.status)
checkClick(10,16,21,spawn.zombie.status)
checkClick(11,16,21,spawn.cow.status)
checkClick(12,16,21,spawn.spider.status)
end