-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib_core.ks
More file actions
83 lines (67 loc) · 1.57 KB
/
lib_core.ks
File metadata and controls
83 lines (67 loc) · 1.57 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@LAZYGLOBAL OFF.
// Locks
LOCK surfaceRetrograde TO R(0,0,0) * V(0-VELOCITY:SURFACE:X, 0-VELOCITY:SURFACE:Y, 0-VELOCITY:SURFACE:Z).
// 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".
}
}
FUNCTION GetDeltaV {
LOCAL totalIsp IS 0.
LOCAL gravity IS 0.
LIST ENGINES IN engineList.
FOR engine in engineList {
SET totalIsp TO totalIsp + ENGINE:ISP.
}
LOCAL Ve IS totalIsp * gravity.
}