/
ee.lua
206 lines (186 loc) · 4.18 KB
/
ee.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
--- Elementary Lua additions to EE.
--
-- (It might be a good idea to let EE provide some of these values.)
--
-- **Planned additions**
--
-- - Constants for crew positions.
--
-- **Changelog**
--
-- *Version 0.7* (2020.08)
--
-- - Add constants for the scanned states and the array `SCANNED_STATES`.
--
-- *Version 0.6* (2020.05)
--
-- - Add the constant `MAX_PLAYER_SHIPS`.
-- - Add constants for the missile types and the array `MISSILE_TYPES`.
-- - Add constants for the alert levels and the array `ALERT_LEVELS`.
--
-- *Version 0.5* (2020.05)
--
-- - Add the constants `SYS_REACTOR` etc. and the array `SYSTEMS`.
--
-- @usage
-- require("ee.lua")
-- -- and see below
--
-- @module ee
-- @author Tom
--- Playerships.
-- @section playerships
--- Maximum number of player spaceships.
--
-- @usage
-- for index = 1, MAX_PLAYER_SHIPS do
-- local pship = getPlayerShip(index)
-- if pship then
-- -- do something
-- print(index, pship:getCallSign())
-- end
-- end
MAX_PLAYER_SHIPS = 32
--- Missiles.
--
-- String constants for the missile types (type `EMissileWeapons` in `script_reference.html`).
--
-- @section missile_types
--- `"Homing"`
MISSILE_HOMING = "Homing"
--- `"Nuke"`
MISSILE_NUKE = "Nuke"
--- `"Mine"`
MISSILE_MINE = "Mine"
--- `"EMP"`
MISSILE_EMP = "EMP"
--- `"HVLI"`
MISSILE_HVLI = "HVLI"
--- Array of the missile types.
MISSILE_TYPES = {
MISSILE_HOMING,
MISSILE_NUKE,
MISSILE_MINE,
MISSILE_EMP,
MISSILE_HVLI
}
--- Systems.
--
-- String constants for the systems (type `ESystem` in `script_reference.html`).
-- They can be used as argument in functions concerning Engineering.
--
-- The values are taken from `shipTemplate.hpp`.
--
-- @section systems
--- `"reactor"`
SYS_REACTOR = "reactor"
--- `"beamweapons"`
SYS_BEAMWEAPONS = "beamweapons"
--- `"missilesystem"`
SYS_MISSILESYSTEM = "missilesystem"
--- `"maneuver"`
SYS_MANEUVER = "maneuver"
--- `"impulse"`
SYS_IMPULSE = "impulse"
--- `"warp"`
SYS_WARP = "warp"
--- `"jumpdrive"`
SYS_JUMPDRIVE = "jumpdrive"
--- `"frontshield"`
SYS_FRONTSHIELD = "frontshield"
--- `"rearshield"`
SYS_REARSHIELD = "rearshield"
--- Array of the system names.
--
-- @usage
-- local pship = getPlayerShip(-1)
-- for idx, system in ipairs(SYSTEMS) do
-- pship:setSystemHealth(system, 1.0)
-- pship:setSystemHeat(system, 0.0)
-- pship:setSystemPower(system, 1.0)
-- pship:commandSetSystemPowerRequest(system, 1.0)
-- pship:setSystemCoolant(system, 0.0)
-- pship:commandSetSystemCoolantRequest(system, 0.0)
-- end
SYSTEMS = {
SYS_REACTOR,
SYS_BEAMWEAPONS,
SYS_MISSILESYSTEM,
SYS_MANEUVER,
SYS_IMPULSE,
SYS_WARP,
SYS_JUMPDRIVE,
SYS_FRONTSHIELD,
SYS_REARSHIELD
}
--- Scanned states.
--
-- String constants for the scanned states (type `EScannedState` in `script_reference.html`).
--
-- See `EScannedState` in `spaceObject.h`.
--
-- @section scanned_states
--- `"notscanned"`
SS_NOT_SCANNED = "notscanned"
--- `"friendorfoeidentified"`
SS_FRIEND_OR_FOE_IDENTIFIED = "friendorfoeidentified"
--- `"simplescan"`
SS_SIMPLE_SCAN = "simplescan"
--- `"fullscan"`
SS_FULL_SCAN = "fullscan"
--- Array of the scanned states.
SCANNED_STATES = {
SS_NOT_SCANNED,
SS_FRIEND_OR_FOE_IDENTIFIED,
SS_SIMPLE_SCAN,
SS_FULL_SCAN
}
--- Alert Levels.
--
-- String constants for the alert levels (type `EAlertLevel` in `script_reference.html`).
--
-- See `playerSpaceship.cpp`.
--
-- @section alert_levels
--- `"Normal"` alert
ALERT_NORMAL = "Normal"
--- `"YELLOW ALERT"`
ALERT_YELLOW = "YELLOW ALERT"
--- `"RED ALERT"`
ALERT_RED = "RED ALERT"
--- Array of the alert levels.
ALERT_LEVELS = {
ALERT_NORMAL,
ALERT_YELLOW,
ALERT_RED
}
--- Scanning Complexity.
--
-- String constants for scanning complexity (type `EScanningComplexity` in `script_reference.html`).
--
-- See `gameGlobalInfo.h`.
SC_NONE = "none"
SC_SIMPLE = "simple"
SC_NORMAL = "normal"
SC_ADVANCED = "advanced"
--- Array of the scan complexities.
SCANNING_COMPLEXITIES = {
SC_NONE,
SC_SIMPLE,
SC_NORMAL,
SC_ADVANCED
}
--- Hacking Games.
--
-- String constants for hacking games (type `EHackingGames` in `script_reference.html`).
--
-- See `gameGlobalInfo.h`.
HG_Mine = "mines"
HG_Lights = "lights"
HG_All = "all"
--- Array of the scan complexities.
HACKING_GAMES = {
HG_Mine,
HG_Lights,
HG_All,
}