-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmbeddedKOSKirkuits.cfg
463 lines (451 loc) · 25.5 KB
/
EmbeddedKOSKirkuits.cfg
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
// TL;DR: mod support / other mods can rebalance EmbeddedKOSKirkuits by patching
// "@EMBEDDED_KOS_KIRKUITS:BEFORE[EmbeddedKOSKirkuits] { ... }", should use
// plain "NEEDS[EmbeddedKOSKirkuits]" to set markers, and may use "LAST[EmbeddedKOSKirkuits]"
// to change the modules generated by EmbeddedKOSKirkuits
//
// Patch order in detail
// - Initial setup is done as an insert node for EMBEDDED_KOS_KIRKUITS.
// Don't define a node with that name yourself.
// - Values within the initial setup can be patched inside an
// "@EMBEDDED_KOS_KIRKUITS { ... }" block and must be done before the
// corresponding values are accessed.
// Recommended phase to do this is either "FIRST" or "BEFORE[@EmbeddedKOSKirkuits]"
// - Default mass and cost budget factors are added to processor options that
// do not already define them in "FOR[@EmbeddedKOSKirkuits]"
// - Set markers on parts using "NEEDS[EmbeddedKOSKirkuits]" and
// optinally any "BEFORE", "FOR" or "AFTER" directives to sort the
// patch order for your needs. Typical usage for a mod support patch
// is "NEEDS[EmbeddedKOSKirkuits]:AFTER[TheModIWantToSupport]"
// - EmbeddedKOSKirkuits uses "LAST[@EmbeddedKOSKirkuits]" to actually
// add the required modules to the marked parts.
// - If you need to access the nodes generated in the "LAST[@EmbeddedKOSKirkuits]"
// phase, use "LAST[EmbeddedKOSKirkuits]" (without the "@") - this is guaranteed
// to run after EmbeddedKOSKirkuits added the modules (and this is actually the
// reason that "@EmbeddedKOSKirkuits" exists at all)
// - Cleanup of leftover markers and the EMBEDDED_KOS_KIRKUITS config node
// is done in the "FINAL" phase to ensure that everything in "LAST[*]" still has
// access to the markers.
//
// Tweakables for the individual processor modules
EMBEDDED_KOS_KIRKUITS {
defaultKOSProcessorType = default
defaultKOSProcessorInclude = if_in_budget
defaultMassBudgetFactor = 0.25
defaultCostBudgetFactor = 0.25
// Early game processor. Weak, expensive, inefficient, massive.
PROCESSOR {
name = early_basic
diskSpace = 500
ECPerBytePerSecond = 0.00001
ECPerInstruction = 0.00008
baseDiskSpace = 500
diskSpaceCostFactor = 0.0244140625
diskSpaceMassFactor = 0.00000048829
baseModuleCost = 300
baseModuleMass = 0.020
}
// Early game "high end" processor. Three times
// the storage for only three times the price.
PROCESSOR {
name = early_advanced
diskSpace = 1500
ECPerBytePerSecond = 0.00001
ECPerInstruction = 0.00008
baseDiskSpace = 1500
diskSpaceCostFactor = 0.0244140625
diskSpaceMassFactor = 0.00000048829
baseModuleCost = 600
baseModuleMass = 0.030
}
// Standard option, mid game. Embedded version of the
// "KR-2042 b Scriptable Control System", with the same
// settings (apart from mass and cost).
// This is the natural upgrade option for early_basic in mid game
PROCESSOR {
name = default
diskSpace = 5000
ECPerBytePerSecond = 0
ECPerInstruction = 0.000004
baseDiskSpace = 5000
diskSpaceCostFactor = 0.0244140625
diskSpaceMassFactor = 0.0000000048829
baseModuleCost = 300
baseModuleMass = 0.020
}
// Advanced option, mid game. Embedded version of the
// "CX-4181 Scriptable Control System", with the same
// settings (apart from mass and cost).
// This is the natural upgrade option for early_advanced in mid game.
PROCESSOR {
name = advanced
diskSpace = 10000
ECPerBytePerSecond = 0
ECPerInstruction = 0.000004
baseDiskSpace = 10000
diskSpaceCostFactor = 0.0244140625
diskSpaceMassFactor = 0.0000000048829
baseModuleCost = 600
costBudgetFactor = 0.5 // adjusted to match the 1200 funds for the standalone module
baseModuleMass = 0.030
}
// Small contemporary or near future option, late mid game.
// Inexpensive, does not need much resource wise,
// but with limited performance. Think "Microcontroller".
// Not on any upgrade path, but an option for really small satellites, probes or rovers
PROCESSOR {
name = modern_small
diskSpace = 1500
ECPerBytePerSecond = 0
ECPerInstruction = 0.0000004
baseDiskSpace = 750
diskSpaceCostFactor = 0.0244140625
diskSpaceMassFactor = 0.00000000048829
baseModuleCost = 50
baseModuleMass = 0.001
}
// Allround contemporary or near future option, late mid game.
// A bit more expensive, not quite as effective as the "small" option,
// but with more storage space.
// This is the natural upgrade option for "default"
PROCESSOR {
name = modern_medium
diskSpace = 5000
ECPerBytePerSecond = 0
ECPerInstruction = 0.0000008
baseDiskSpace = 5000
diskSpaceCostFactor = 0.0244140625
diskSpaceMassFactor = 0.00000000048829
baseModuleCost = 100
baseModuleMass = 0.005
}
// Advanced contemporary or near future option, late mid game.
// Double the storage for only 2 times the mass, but three times the price
// This is the natural upgrade option for "advanced"
PROCESSOR {
name = modern_large
diskSpace = 10000
ECPerBytePerSecond = 0
ECPerInstruction = 0.0000008
baseDiskSpace = 10000
diskSpaceCostFactor = 0.0244140625
diskSpaceMassFactor = 0.00000000048829
baseModuleCost = 300
baseModuleMass = 0.010
}
// Far Future option, late game. Same mass and cost as the small microcontroller,
// but effectively unlimited storage at no extra cost and mass, and uses
// even less electricity.
// Don't even think about it, just slap it in.
PROCESSOR {
name = unlimited
diskSpace = 4000000
ECPerBytePerSecond = 0
ECPerInstruction = 0.00000004
baseDiskSpace = 1000000
diskSpaceCostFactor = 0
diskSpaceMassFactor = 0
baseModuleCost = 50
baseModuleMass = 0.001
}
// KSC datacenter terminal. No extra cost, no extra mass, no EC demands for running, no
// integrated disk space.
// Intended for use in launch bases as a connection to the powerful stationary
// computers in the KSC datacenter, with software run directly from the archive.
PROCESSOR {
name = datacenter_terminal
diskSpace = 0
ECPerBytePerSecond = 0
ECPerInstruction = 0
baseDiskSpace = 0
diskSpaceCostFactor = 0
diskSpaceMassFactor = 0
baseModuleCost = 0
baseModuleMass = 0
}
}
@EMBEDDED_KOS_KIRKUITS:FOR[@EmbeddedKOSKirkuits] {
// Set default mass an cost budget factors if none have been set yet
@PROCESSOR:HAS[~massBudgetFactor] {
massBudgetFactor = #$../defaultMassBudgetFactor$
}
@PROCESSOR:HAS[~costBudgetFactor] {
costBudgetFactor = #$../defaultCostBudgetFactor$
}
}
////
//// Add a default EmbeddedKOSProcessorType when a processor should be included
//// but no type is set explicitly
////
@PART:HAS[~EmbeddedKOSProcessorType,~EmbeddedKOSProcessorInclude[never],#EmbeddedKOSProcessorInclude]:LAST[@EmbeddedKOSKirkuits] {
EmbeddedKOSProcessorType = #$@EMBEDDED_KOS_KIRKUITS/defaultKOSProcessorType$
}
////
//// Add MODULE[kOSProcessor] to all parts that should include one and
//// Do not have one yet.
////
@PART:HAS[!MODULE[kOSProcessor],#EmbeddedKOSProcessorInclude,~EmbeddedKOSProcessorInclude[never]]:NEEDS[kOS]:LAST[@EmbeddedKOSKirkuits] {
MODULE
{
name = kOSProcessor
EmbeddedKOSProcessorType = #$/EmbeddedKOSProcessorType$
id = kOSProcessor
}
}
////
//// Configure the modules (including existing modules upgrade nodes with an explicitly
/// added EmbeddedKOSProcessorType) and upgrade nodes.
////
@PART:HAS[@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType]]:LAST[@EmbeddedKOSKirkuits] {
// Set the processor data. Needs to be repeated for each variant because recursive
// variable references like #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[#$/EmbeddedKOSProcessorType$]/title$
// don't work im MM
@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType[early_basic]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/baseModuleCost$
%massBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/massBudgetFactor$
%costBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_basic]/costBudgetFactor$
}
@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType[early_advanced]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/baseModuleCost$
%massBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/massBudgetFactor$
%costBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/costBudgetFactor$
}
@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType[default]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/baseModuleCost$
%massBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/massBudgetFactor$
%costBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/costBudgetFactor$
}
@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType[advanced]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/diskSpaceMassFactor$
%massBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/massBudgetFactor$
%costBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/costBudgetFactor$
}
@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType[modern_small]]{
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/baseModuleCost$
%massBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/massBudgetFactor$
%costBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/costBudgetFactor$
}
@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType[modern_medium]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/baseModuleCost$
%massBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/massBudgetFactor$
%costBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/costBudgetFactor$
}
@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType[modern_large]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/baseModuleCost$
%massBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/massBudgetFactor$
%costBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/costBudgetFactor$
}
@MODULE[kOSProcessor]:HAS[#EmbeddedKOSProcessorType[unlimited]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/baseModuleCost$
%massBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/massBudgetFactor$
%costBudgetFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/costBudgetFactor$
}
// Same for any upgrade nodes in a MODULE[kOSProcessor] node
@MODULE[kOSProcessor]:HAS[@UPGRADES] {
@UPGRADES {
@UPGRADE:HAS[#EmbeddedKOSProcessorType[early_advanced]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[early_advanced]/baseModuleCost$
}
@UPGRADE:HAS[#EmbeddedKOSProcessorType[default]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[default]/baseModuleCost$
}
@UPGRADE:HAS[#EmbeddedKOSProcessorType[advanced]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[advanced]/diskSpaceMassFactor$
}
@UPGRADE:HAS[#EmbeddedKOSProcessorType[modern_small]]{
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_small]/baseModuleCost$
}
@UPGRADE:HAS[#EmbeddedKOSProcessorType[modern_medium]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_medium]/baseModuleCost$
}
@UPGRADE:HAS[#EmbeddedKOSProcessorType[modern_large]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[modern_large]/baseModuleCost$
}
@UPGRADE:HAS[#EmbeddedKOSProcessorType[unlimited]] {
%diskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/diskSpace$
%ECPerBytePerSecond = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/ECPerBytePerSecond$
%ECPerInstruction = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/ECPerInstruction$
%baseDiskSpace = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/baseDiskSpace$
%diskSpaceCostFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/diskSpaceCostFactor$
%diskSpaceMassFactor = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/diskSpaceMassFactor$
%baseModuleMass = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/baseModuleMass$
%baseModuleCost = #$@EMBEDDED_KOS_KIRKUITS/PROCESSOR[unlimited]/baseModuleCost$
}
}
}
}
////
//// Determine mass and cost budget for EmbeddedKOSProcessorInclude[if_in_budget].
//// A negative number means the module won't fit into the mass/cost budget.
////
@PART:HAS[#EmbeddedKOSProcessorInclude[if_in_budget],@MODULE[kOSProcessor]:HAS[#baseModuleMass[>0],#massBudgetFactor]]:LAST[@EmbeddedKOSKirkuits] {
%EmbeddedKOSProcessorMassBudget = #$/mass$
@EmbeddedKOSProcessorMassBudget *= #$MODULE[kOSProcessor]/massBudgetFactor$
@EmbeddedKOSProcessorMassBudget -= #$MODULE[kOSProcessor]/baseModuleMass$
}
@PART:HAS[#EmbeddedKOSProcessorInclude[if_in_budget],@MODULE[kOSProcessor]:HAS[#baseModuleCost[>0],#costBudgetFactor]]:LAST[@EmbeddedKOSKirkuits] {
%EmbeddedKOSProcessorCostBudget = #$/cost$
@EmbeddedKOSProcessorCostBudget *= #$MODULE[kOSProcessor]/costBudgetFactor$
@EmbeddedKOSProcessorCostBudget -= #$MODULE[kOSProcessor]/baseModuleCost$
}
////
//// Drop everything that is outside the mass or cost budget.
//// This also drops any MODULE[kOSProcessor] nodes that may have
//// been added directly to allow conditional includes
//// for kOSProcessor modules with upgrades from a mod support patch
////
@PART:HAS[#EmbeddedKOSProcessorMassBudget[<0]]:LAST[@EmbeddedKOSKirkuits] {
-EmbeddedKOSProcessorInclude = deleted
-EmbeddedKOSProcessorType = deleted
-EmbeddedKOSProcessorMassBudget = deleted
-EmbeddedKOSProcessorCostBudget = deleted
-MODULE[kOSProcessor] {}
}
@PART:HAS[#EmbeddedKOSProcessorCostBudget[<0]]:LAST[@EmbeddedKOSKirkuits] {
-EmbeddedKOSProcessorInclude = deleted
-EmbeddedKOSProcessorType = deleted
-EmbeddedKOSProcessorMassBudget = deleted
-EmbeddedKOSProcessorCostBudget = deleted
-MODULE[kOSProcessor] {}
}
////
//// Reduce base part mass/cost if the embedded kOS processor has a positive baseModuleMass/baseModuleCost.
//// This exists mainly to allow upgrades to change mass/cost simply by
//// adjusting baseModuleMass/baseModuleCost in MODULE[kOSProcessor].
////
@PART:HAS[@MODULE[kOSProcessor]:HAS[#baseModuleCost[>0]]]:LAST[@EmbeddedKOSKirkuits] {
@cost -= #$MODULE[kOSProcessor]/baseModuleCost$
}
@PART:HAS[@MODULE[kOSProcessor]:HAS[#baseModuleMass[>0]]]:LAST[@EmbeddedKOSKirkuits] {
@mass -= #$MODULE[kOSProcessor]/baseModuleMass$
}
////
//// Sanity check: Do not allow negative mass/cost
//// If this happens, re-set the mass/cost to 0 and deliberately cause a MM patch error
//// (because this will only happen if a broken patch explicitly includes a processor
//// option that is too massive/expensive)
////
@PART:HAS[@MODULE[kOSProcessor],#cost[<0]]:LAST[@EmbeddedKOSKirkuits] {
@cost = 0
error = #$@ERROR$: MODULE[kOSProcessor] costs more than the whole part!
}
@PART:HAS[@MODULE[kOSProcessor],#mass[<0]]:LAST[@EmbeddedKOSKirkuits] {
@mass = 0
error = #$@ERROR$: MODULE[kOSProcessor] is more massive than the whole part!
}
////
//// Final cleanup, remove all markers on parts and the EMBEDDED_KOS_KIRKUITS configuration node itself
////
//// Note: We deliberately leave the EmbeddedKOSProcessorType marker
//// on the MODULE[kOSProcessor] itself and on any upgrade nodes, because it does
//// not break kOS, and gives kOS scripts the opportunity to check which
//// "processor class" they are running on (potential use case: use this in a
//// kOS script to dynamically change CONFIG:IPU to match the "processor
//// class")
////
@PART:HAS[#EmbeddedKOSProcessorInclude]:FINAL {
-EmbeddedKOSProcessorInclude = deleted
}
@PART:HAS[#EmbeddedKOSProcessorType]:FINAL {
-EmbeddedKOSProcessorType = deleted
}
@PART:HAS[#EmbeddedKOSProcessorMassBudget]:FINAL {
-EmbeddedKOSProcessorMassBudget = deleted
}
@PART:HAS[#EmbeddedKOSProcessorCostBudget]:FINAL {
-EmbeddedKOSProcessorCostBudget = deleted
}
-EMBEDDED_KOS_KIRKUITS:FINAL {}