Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function modemStartup()
- --print("Warping modem on " .. modemLocation .. " side")
- modem = peripheral.wrap("bottom")
- modem.open(3) -- Open channel 3 so that we can listen on it
- end
- function clearRedstone()
- for key,side in pairs(redstone.getSides()) do
- redstone.setOutput(side, false)
- end
- end
- function allButSide(side)
- for k,v in pairs(redstone.getSides()) do
- if side == v then
- redstone.setOutput(side, false)
- else
- redstone.setOutput(v, true)
- end
- end
- end
- ------------------------------------------
- --Main Program
- ------------------------------------------
- print("Starting spawner control")
- modemStartup()
- local mobs = {}
- mobs["endermen"] = "left"
- mobs["ghasts"] = "right"
- mobs["pigmen"] = "front"
- mobs["creepers"] = "back"
- mobs["all"] = "all"
- mobs["list"] = "list"
- while true do
- local event, modemSide, senderChannel,
- replyChannel, message, senderDistance = os.pullEvent("modem_message")
- print("Message: "..message)
- local action = mobs[message]
- if action == "all" then
- clearRedstone()
- modem.transmit(replyChannel, 3, "spawning all mobs")
- elseif action == "list" then
- modem.transmit(replyChannel, 3, mobs)
- elseif action then
- allButSide(action)
- modem.transmit(replyChannel, 3, "spawning " .. message)
- else
- allButSide()
- modem.transmit(replyChannel, 3, "spawning no mobs")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement