Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- litteraly just a turtle to deploy turtles
- local ports = {
- ["serverPort"] = 8080,
- ["deployerPort"] = 5050
- }
- local modem = peripheral.wrap("left")
- modem.open(ports.deployerPort)
- function getItemIndex(itemName)
- for slot = 1, 16, 1 do
- local item = turtle.getItemDetail(slot)
- if(item ~= nil) then
- if(item["name"] == itemName) then
- return slot
- end
- end
- end
- end
- local info = nil
- repeat
- event, side, senderChannel, replyChannel, msg, distance = os.pullEvent("modem_message")
- if msg == "DEPLOY_TURTLE" and replyChannel == ports.serverPort then
- print("Deploying turtle")
- local itemIndex = getItemIndex("computercraft:turtle_normal")
- turtle.place(itemIndex)
- os.sleep(0.5)
- local newTurtle = peripheral.wrap("front") -- assuming turtle is at front of unit
- newTurtle.turnOn() -- turns turtle on
- elseif msg == "BREAK_TURTLE" then
- turtle.dig() -- digs infront to check for turtle incase needs to be destroyed low chance of breaking turtle that is just starting
- end
- until info ~= nil
- print("over")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement