-
Notifications
You must be signed in to change notification settings - Fork 0
/
gate.lua
62 lines (50 loc) · 1.37 KB
/
gate.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- Stargate Control library made by TinyDeskEngie1
-- Makes controlling AUNIS stargates less tedious
c = require("component")
event = require("event")
sg = c.stargate
gate = {}
gate.symbols = {}
gate.symbols.origin = {}
gate.symbols.origin["MILKYWAY"] = "Point of Origin"
gate.symbols.origin["PEGASUS"] = "Subido"
gate.symbols.origin["UNIVERSE"] = "Glyph 17"
gate.dial = function(...)
local args = {...}
local address = {}
if type(args[1]) == "table" then
address = args[1]
else
for i = 1, #args do
address[i] = args[i]
end
end
if #address < 7 or #address > 9 then
error("Too few or too many symbols in address", 2)
end
for a = 2, #address do
for b = 1, a-1 do
if address[a] == address[b] then
error("Symbol \'" .. address[a] .. "\' occurs multiple times in address", 2)
end
end
end
if address[#address] ~= gate.symbols.origin[sg.getGateType()] then
error("Last symbol (" .. address[#address] .. ") does not match connected gate's Point of Origin symbol", 2)
end
for i = 1, #address do
sg.engageSymbol(address[i])
event.pull("stargate_spin_chevron_engaged")
end
if sg.engageGate() == "stargate_engage" then
event.pull("stargate_wormhole_stabilized")
end
end
gate.isOpen = function()
if sg.getGateStatus() == "open" then
return true
else
return false
end
end
return gate