-
Notifications
You must be signed in to change notification settings - Fork 1
/
lib_rt.ks
26 lines (22 loc) · 922 Bytes
/
lib_rt.ks
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
@LAZYGLOBAL OFF.
// RemoteTech supports.
RUN ONCE lib_util.
FUNCTION RT_ToggleAntennas {
PARAMETER active IS -1. // -1: Toggle all. 0/False: Deactivate all. 1/True: Activate all.
SET active TO IIF(IsFalse(active), 0, IIF(IsTrue(active), 1, active)).
FOR module IN ship:modulesNamed("ModuleRTAntenna") {
IF active<>0 AND module:HasEvent("Activate") {
module:doEvent("Activate").
} ELSE IF active<>1 AND module:HasEvent("Deactivate") {
module:doEvent("Deactivate").
}
}
}
// Given a circular orbit, an antenna range and a set number of satellites, returns the maximum radius of the orbit such that each satellite can reach the next satellite in the sequence.
// Or: Given a regular "numsats"-sided polygon with side "antennarange", return the circumradius.
// With a regular polygon of
FUNCTION RT_MaxRadius {
PARAMETER antennarange.
PARAMETER numsats.
RETURN antennarange/SIN(180/numsats)/2.
}