-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib_general.ks
More file actions
68 lines (56 loc) · 1.24 KB
/
lib_general.ks
File metadata and controls
68 lines (56 loc) · 1.24 KB
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
@LAZYGLOBAL OFF.
// Ship profiles
GLOBAL profileAsc IS "Ascending".
GLOBAL profileDesc IS "Descending".
GLOBAL profileOrb IS "Orbiting".
FUNCTION GetProfile {
IF STATUS = "PRELAUNCH" OR STATUS = "LANDED" OR STATUS = "SPLASHED" {
RETURN "N/A".
}
IF APOAPSIS > 0 and PERIAPSIS > 0 {
RETURN profileOrb.
}
IF ETA:APOAPSIS < ETA:PERIAPSIS {
RETURN profileAsc.
} ELSE {
RETURN profileDesc.
}
}
FUNCTION GetTrueAltitude {
LOCAL terrainHeight IS SHIP:GEOPOSITION:TERRAINHEIGHT.
IF ALT:RADAR = ALTITUDE {
RETURN ALTITUDE.
} ELSE {
IF terrainHeight <= 0 {
SET terrainHeight TO 0.
}
RETURN ALTITUDE - terrainHeight.
}
}
FUNCTION DrawLabelList { PARAMETER labelList, xPos, yPos.
FOR label IN labelList {
PRINT label AT (xPos, yPos).
SET yPos TO yPos + 1.
}
}
FUNCTION DrawDataList { PARAMETER dataList, xPos, yPos.
LOCAL spaces IS " ".
FOR data in dataList {
PRINT data + spaces AT (xPos, yPos).
SET yPos TO yPos + 1.
}
}
FUNCTION GetCommStatus {
IF ADDONS:RT:HASKSCCONNECTION(SHIP) = TRUE {
RETURN "Connected".
} ELSE {
RETURN "Not connection".
}
}
FUNCTION GetCommDelay {
IF ADDONS:RT:HASKSCCONNECTION(SHIP) {
RETURN ROUND(ADDONS:RT:KSCDELAY(SHIP), 2).
} ELSE {
RETURN "Not connected".
}
}