repl.it
@MinecraftMrGabe/

global communicator

Lua

No description

fork
loading
Files
  • main.lua
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--frequency 0-1 (emergency rescue system)
input = {1000,1555,0,1} -- x, y, altitude,urgency
output = input
--frequency 100 (automatic landing portal)
n = 0
if input[4] == 1 then--1 is land, 0 is takeoff
output = n+100.1
n = (n+0.1)%10
end
--output is to the automatic landing system

--frequency 100-110 (automatic landing system) there should be at least 2 per airport
--airport variables
i1 = 100 -- start of runway x
i2 = 200 -- start of runway y
i3 = 200 -- end of runway x
i4 = 300 -- end of runway y
i5 = 10 -- altitude or runway
i6 = 200 -- point inline with runway x
i7 = 300 -- point inline runway y
--radio in
r1 = 1 -- guidence on => 1 
r2 = 0
r3 = 100
r4 = 0.25--plane compass
r5 = 100--altidude
--program start
math = require 'math'
if r1>=1 then
  if r1==1 then
    x3 = i6-r2
    y3 = i7-r3
    rotate_target = math.atan2(x3,y3)/2
  end
  if r1==2 then
    x3 = i3-r2
    y3 = i4-r3
    rotate_target = math.atan2(x3,y3)/2
  end
  if r1==3 then
    x3 = i1-r2
    y3 = i2-r3
    rotate_target = math.atan2(x3,y3)/2
  end

end