Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Turbolift Carriage Client
- -- For use in NCC-1701-D
- -- This client resides in the carriage
- -- it talks to the server to operate
- -- the lift. Computer is configured
- -- with a modem and a chat listener.
- function loadSettings()
- settings = json.decode("/sys/turbolift/conf.json")
- if settings == nil then
- settings = {modemSide = "top", rsSide = "left", chatterSide = "right", name = "", deck = ""}
- end
- end
- function writeSettings()
- local s = fs.open("/sys/turbolift/conf.json", "w")
- s.write(json.encode(settings))
- s.close()
- end
- -- transporter cab waits patiently for
- -- someone to talk.
- function onChat(p, m)
- local req = {cmd = "findDoor", player = p, cabId = settings.cabId, query = m}
- rednet.send(settings.serv, json.encode(req)
- end
- function onDoorFound(d)
- local req = {cmd = "set", dst = d, cabId = settings.cabId}
- rednet.send(settings.serv, json.encode(req))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement