phone_server.lua

27 lines · 594 B

Open raw

PHONE APP MINE--

Copy & run

wget https://perlytiara.github.io/turtles.tips/raw/programs/Maengorn/phone_server.lua
1--PHONE APP MINE--
2
3local SERVER_PORT = 420
4local PHONE_PORT = 69
5
6modem = peripheral.wrap("back")
7local size = vector.new()
8
9if (#arg == 3) then
10 size.x = tonumber(arg[1])
11 size.y = tonumber(arg[2])
12 size.z = tonumber(arg[3])
13else
14 print("NO SIZE GIVEN")
15 os.exit(1)
16end
17
18local target = vector.new(gps.locate())
19local payloadMessage = string.format("%d %d %d %d %d %d %d",
20 target.x, target.y - 1, target.z,
21 size.x, size.y, size.z,
22 1
23)
24
25print(string.format("Targetting %d %d %d", target.x, target.y, target.z))
26modem.transmit(SERVER_PORT, PHONE_PORT, payloadMessage)
27