-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscience.ks
More file actions
116 lines (91 loc) · 2.45 KB
/
science.ks
File metadata and controls
116 lines (91 loc) · 2.45 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
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
// global eqp to Lexicon().
// eqp:ADD( "bar", List() ).
// eqp:ADD( "therm", List() ).
// for part in ship:parts {
// local instrument is "".
// if part:name = "sensorBarometer" {
// eqp["bar"]:add(part:getModule("ModuleScienceExperiment")).
// } else if part:name = "sensorThermometer" {
// eqp["therm"]:add(part:getModule("ModuleScienceExperiment")).
// }
// }
function measure {
declare parameter instumentName is "".
local instuments is ship:partsnamed(instumentName).
if instuments:length = 0 {
print "no " + instumentName + "s onboard".
return.
}
for instument in instuments {
if not instument:hasModule("ModuleScienceExperiment") {
print instumentName + " is not a scientific instument".
return.
}
local module is instument:getModule("ModuleScienceExperiment").
if not (module:inoperable or module:deployed or module:hasdata) {
module:deploy.
print instumentName + " deployed".
return module.
}
}
print "all " + instumentName + "s already used".
}
function measureALL {
measure("sensorBarometer").
measure("sensorThermometer").
measure("science.module").
// wait 2.0.
// measure("science.module").
local goo to measure("GooExperiment").
if goo <> 0 {
when goo:hasdata then {
set goo to measure("GooExperiment").
if goo <> 0 {
when goo:hasdata then {
measure("GooExperiment").
}
}
}
}
}
function resetALL {
local parts to ship:parts.
for part in parts {
if part:hasModule("ModuleScienceExperiment") {
part:getModule("ModuleScienceExperiment"):reset.
print part:name + " reset".
}
}
}
function transmitALL {
local parts to ship:parts.
for part in parts {
if part:hasModule("ModuleScienceExperiment") {
local module to part:getModule("ModuleScienceExperiment").
if module:hasdata {
module:transmit.
print part:name + "'s data transmitted".
}
}
}
}
function storeAll {
parameter containerN is 0.
local containers to getPartList(LIST("ScienceBox")).
if containers:length <= containerN {
print "no container with such number".
return.
}
local container to containers[containerN].
container:getModule("ModuleScienceContainer"):collectAll.
}
function getPartList {
parameter nameList.
local parts to LIST().
for partName in nameList {
for part in ship:partsnamed(partName) {
parts:add(part).
}
}
return parts.
}