39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
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
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
...
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
...
500
501
502
503
504
505
506
507
508
509
510
511
512
513
...
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
...
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
...
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
...
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
...
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
|
-- crafting, while programs require a certain amount of memory.
-- chips have a variable number of program slots and a single bootloader slot
--
starlit.item.chip = lib.registry.mk 'starlit_electronics:chip'
-- software is of one of the following types:
-- schematic: program for your matter compiler that enables crafting a given item.
-- output: the result
-- driver: inserted into a Core to control attached hardware
-- suitPower: provides suit functionality like nanoshredding or healing
-- passive powers are iterated on suit application/configuration and upon fst-tick
-- cost: what the software needs to run. some fields are fab-specific
-- energy: for fab, total energy cost of process in joules
-- for suitPassive, added suit power consumption in watts
starlit.item.sw = lib.registry.mk 'starlit_electronics:sw'
................................................................................
inventory_image = def.img or 'starlit-item-battery.png';
description = starlit.ui.tooltip {
title = def.name;
desc = def.desc;
color = lib.color(0,.2,1);
props = {
{ title = 'Optimal Capacity', affinity = 'info';
desc = lib.math.si('J', def.capacity) };
{ title = 'Discharge Rate', affinity = 'info';
desc = lib.math.si('W', def.dischargeRate) };
{ title = 'Charge Efficiency', affinity = 'info';
desc = string.format('%s%%', (1-def.leak) * 100) };
{ title = 'Size', affinity = 'info';
desc = lib.math.si('m', def.fab.size.print) };
};
};
_starlit = {
event = {
create = function(st, how)
--[[if not how.gift then -- cheap hack to make starting batteries fully charged
E.battery.setCharge(st, 0)
................................................................................
-- eluthrai ("uncompromising"): high power, high quality, wildly expensive
-- firstborn ("god-tier"): exceptional
local batteryTiers = {
makeshift = {
name = 'Makeshift'; capacity = .5, decay = 3, leak = 2, dischargeRate = 1,
fab = starlit.type.fab {
metal = {copper=10};
};
desc = "Every attosecond this electrical abomination doesn't explode in your face is but the unearned grace of the Wild Gods.";
complexity = 1;
sw = {rarity = 1};
};
imperial = {
name = 'Imperial'; capacity = 2, decay = 2, leak = 2, dischargeRate = 2;
fab = starlit.type.fab {
metal = {copper=15, iron = 20};
size = { print = 0.1 };
};
desc = "The Empire's native technology is a lumbering titan: bulky, inefficient, unreliable, ugly, and awesomely powerful. Their batteries are no exception, with raw capacity and throughput that exceed even Usukinwya designs.";
drm = 1;
complexity = 2;
sw = {rarity = 2};
};
commune = {
name = 'Commune'; capacity = 1, decay = .5, leak = .2, dischargeRate = 1;
fab = starlit.type.fab {
metal = {vanadium=50, steel=10};
size = { print = 0.05 };
};
desc = "The Commune's proprietary battery designs prioritize reliability, compactness, and maintenance concerns above raw throughput, with an elegance of engineering and design that would make a Su'ikuri cry.";
complexity = 5;
sw = {rarity = 3};
};
usukwinya = {
name = 'Usukwinya'; capacity = 2, decay = 1, leak = 1, dischargeRate = 1.5,
fab = starlit.type.fab {
metal = {vanadium=30, argon=10};
size = { print = 0.07 };
};
desc = "A race of consummate value engineers, the Usukwinya have spent thousands of years refining their tech to be as cheap to build as possible, without compromising much on quality. The Tradebirds drive an infamously hard bargain, but their batteries are more than worth their meagre cost.";
drm = 2;
sw = {rarity = 10};
complexity = 15;
};
eluthrai = {
name = 'Eluthrai'; capacity = 3, decay = .4, leak = .1, dischargeRate = 1.5,
fab = starlit.type.fab {
metal = {beryllium=20, platinum=20, technetium = 1, cinderstone = 10 };
size = { print = 0.03 };
};
desc = "The uncompromising Eluthrai are never satisfied until every quantifiable characteristic of their tech is maximally optimised down to the picoscale. Their batteries are some of the best in the Reach, and unquestionably the most expensive -- especially for those lesser races trying to copy the designs without the benefit of the sublime autofabricator ecosystem of the Eluthrai themselves.";
complexity = 200;
sw = {rarity = 0}; -- you think you're gonna buy eluthran schematics on SuperDiscountNanoWare.space??
};
firstborn = {
name = 'Firstborn'; capacity = 5, decay = 0.1, leak = 0, dischargeRate = 3;
fab = starlit.type.fab {
metal = {neodymium=20, xenon=150, technetium=5, sunsteel = 10 };
crystal = {astrite = 1};
size = { print = 0.05 };
};
desc = "Firstborn engineering seamlessly merges psionic effects with a mastery of the physical universe unattained by even the greatest of the living Starsouls. Their batteries reach levels of performance that strongly imply Quantum Gravity Theory -- and several major holy books -- need to be rewritten. From the ground up.";
complexity = 1000;
sw = {rarity = 0}; -- lol no
};
................................................................................
complexity = 3;
};
chemical = {
name = 'Chemical';
desc = '';
fab = starlit.type.fab {
element = { lithium = 3};
metal = {iron = 5};
size = {print=1.0};
};
sw = {
cost = {
cycles = 1e9; -- 1 bil cycles
ram = 2e9; -- 2GB
};
................................................................................
};
hybrid = {
name = 'Hybrid';
desc = '';
capacity = 1;
fab = starlit.type.fab {
element = {
lithium = 3;
};
metal = {
iron = 5;
};
size = {print=1.5};
};
sw = {
cost = {
cycles = 65e9; -- 65 bil cycles
ram = 96e9; -- 96GB
................................................................................
else
rare = bType.sw.rarity + bTier.sw.rarity
end
starlit.item.sw.link(swID, {
kind = 'schematic';
name = name .. ' Schematic';
output = id;
size = bType.sw.pgmSize;
cost = bType.sw.cost;
rarity = rare;
})
E.schematicGroupLink('starlit_electronics:battery', swID)
................................................................................
data = {}
defOnly = true
end
def = assert(def._starlit.chip)
end
local props = {
{title = 'Clock Rate', affinity = 'info';
desc = lib.math.si('Hz', def.clockRate)};
{title = 'RAM', affinity = 'info';
desc = lib.math.si('B', def.ram)};
}
if not defOnly then
table.insert(props, {
title = 'Free Storage', affinity = 'info';
desc = lib.math.si('B', E.chip.freeSpace(ch, data)) .. ' / '
.. lib.math.si('B', def.flash);
})
local swAffMap = {
schematic = 'schematic';
suitPower = 'ability';
driver = 'driver';
}
for i, e in ipairs(data.files) do
................................................................................
affinity = aff;
desc = name;
})
end
else
table.insert(props, {
title = 'Flash Storage', affinity = 'info';
desc = lib.math.si('B', def.flash);
})
end
return starlit.ui.tooltip {
title = data.label and data.label~='' and string.format('<%s>', data.label) or def.name;
color = lib.color(.6,.6,.6);
desc = def.desc;
props = props;
................................................................................
local circMat = t.circ or 'silicon';
starlit.item.chip.link(id, {
name = t.name;
clockRate = t.clockRate;
flash = t.flash;
ram = t.ram;
powerEfficiency = t.powerEfficiency; -- cycles per joule
fab = {
flag = {
silicompile = true;
};
time = {
silicompile = t.size * 24*60;
};
cost = {
................................................................................
end;
open = function(self,fn)
return E.chip.fileOpen(self.chip, self.inode, fn)
end;
};
}
function E.chip.usableSoftware(chips,pgm)
local comp = E.chip.sumCompute(chips)
local r = {}
local unusable = {}
local sw if pgm then
if type(pgm) == 'string' then
pgm = {starlit.item.sw.db[pgm]}
end
................................................................................
end
end
end
end
end
for _, s in pairs(sw) do
if s.sw.cost.ram <= comp.ram then
table.insert(r, {
sw = s.sw;
chip = s.chip, chipSlot = s.chipSlot;
file = s.file;
fd = E.chip.fileHandle(s.chip, s.inode);
speed = s.sw.cost.cycles / comp.cycles;
powerCost = s.sw.cost.cycles / comp.powerEfficiency;
|
|
|
|
|
|
|
|
>
>
|
|
>
|
>
|
<
|
<
<
|
>
|
|
|
|
|
|
|
>
|
|
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
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
...
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
...
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
...
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
...
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
...
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
...
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
...
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
...
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
|
-- crafting, while programs require a certain amount of memory.
-- chips have a variable number of program slots and a single bootloader slot
--
starlit.item.chip = lib.registry.mk 'starlit_electronics:chip'
-- software is of one of the following types:
-- schematic: program for your matter compiler that enables crafting a given item.
-- output (convertible to ItemStack): the result
-- driver: inserted into a Core to control attached hardware
-- suitPower: provides suit functionality like nanoshredding or healing
-- passive powers are iterated on suit application/configuration and upon fst-tick
-- cost: what the software needs to run. some fields are fab-specific
-- energy: for fab, total energy cost of process in joules
-- for suitPassive, added suit power consumption in watts
starlit.item.sw = lib.registry.mk 'starlit_electronics:sw'
................................................................................
inventory_image = def.img or 'starlit-item-battery.png';
description = starlit.ui.tooltip {
title = def.name;
desc = def.desc;
color = lib.color(0,.2,1);
props = {
{ title = 'Optimal Capacity', affinity = 'info';
desc = lib.math.siUI('J', def.capacity) };
{ title = 'Discharge Rate', affinity = 'info';
desc = lib.math.siUI('W', def.dischargeRate) };
{ title = 'Charge Efficiency', affinity = 'info';
desc = string.format('%s%%', (1-def.leak) * 100) };
{ title = 'Size', affinity = 'info';
desc = lib.math.siUI('m', def.fab.size.print) };
};
};
_starlit = {
event = {
create = function(st, how)
--[[if not how.gift then -- cheap hack to make starting batteries fully charged
E.battery.setCharge(st, 0)
................................................................................
-- eluthrai ("uncompromising"): high power, high quality, wildly expensive
-- firstborn ("god-tier"): exceptional
local batteryTiers = {
makeshift = {
name = 'Makeshift'; capacity = .5, decay = 3, leak = 2, dischargeRate = 1,
fab = starlit.type.fab {
element = {copper=10};
};
desc = "Every attosecond this electrical abomination doesn't explode in your face is but the unearned grace of the Wild Gods.";
complexity = 1;
sw = {rarity = 1};
};
imperial = {
name = 'Imperial'; capacity = 2, decay = 2, leak = 2, dischargeRate = 2;
fab = starlit.type.fab {
element = {copper=15, iron = 20};
size = { print = 0.1 };
};
desc = "The Empire's native technology is a lumbering titan: bulky, inefficient, unreliable, ugly, and awesomely powerful. Their batteries are no exception, with raw capacity and throughput that exceed even Usukinwya designs.";
drm = 1;
complexity = 2;
sw = {rarity = 2};
};
commune = {
name = 'Commune'; capacity = 1, decay = .5, leak = .2, dischargeRate = 1;
fab = starlit.type.fab {
element = {vanadium = 50};
metal = {steel=10};
size = { print = 0.05 };
};
desc = "The Commune's proprietary battery designs prioritize reliability, compactness, and maintenance concerns above raw throughput, with an elegance of engineering and design that would make a Su'ikuri cry.";
complexity = 5;
sw = {rarity = 3};
};
usukwinya = {
name = 'Usukwinya'; capacity = 2, decay = 1, leak = 1, dischargeRate = 1.5,
fab = starlit.type.fab {
element = {argon=10};
metal = {vanadium=30};
size = { print = 0.07 };
};
desc = "A race of consummate value engineers, the Usukwinya have spent thousands of years refining their tech to be as cheap to build as possible, without compromising much on quality. The Tradebirds drive an infamously hard bargain, but their batteries are more than worth their meagre cost.";
drm = 2;
sw = {rarity = 10};
complexity = 15;
};
eluthrai = {
name = 'Eluthrai'; capacity = 3, decay = .4, leak = .1, dischargeRate = 1.5,
fab = starlit.type.fab {
element = {beryllium=20, platinum=20, technetium = 1};
metal = {cinderstone = 10};
size = { print = 0.03 };
};
desc = "The uncompromising Eluthrai are never satisfied until every quantifiable characteristic of their tech is maximally optimised down to the picoscale. Their batteries are some of the best in the Reach, and unquestionably the most expensive -- especially for those lesser races trying to copy the designs without the benefit of the sublime autofabricator ecosystem of the Eluthrai themselves.";
complexity = 200;
sw = {rarity = 0}; -- you think you're gonna buy eluthran schematics on SuperDiscountNanoWare.space??
};
firstborn = {
name = 'Firstborn'; capacity = 5, decay = 0.1, leak = 0, dischargeRate = 3;
fab = starlit.type.fab {
element = {neodymium=20, xenon=150, technetium=5};
metal = {sunsteel = 10};
crystal = {astrite = 1};
size = { print = 0.05 };
};
desc = "Firstborn engineering seamlessly merges psionic effects with a mastery of the physical universe unattained by even the greatest of the living Starsouls. Their batteries reach levels of performance that strongly imply Quantum Gravity Theory -- and several major holy books -- need to be rewritten. From the ground up.";
complexity = 1000;
sw = {rarity = 0}; -- lol no
};
................................................................................
complexity = 3;
};
chemical = {
name = 'Chemical';
desc = '';
fab = starlit.type.fab {
element = { lithium = 3 };
size = {print=1.0};
};
sw = {
cost = {
cycles = 1e9; -- 1 bil cycles
ram = 2e9; -- 2GB
};
................................................................................
};
hybrid = {
name = 'Hybrid';
desc = '';
capacity = 1;
fab = starlit.type.fab {
element = {
lithium = 10;
carbon = 20;
};
size = {print=1.5};
};
sw = {
cost = {
cycles = 65e9; -- 65 bil cycles
ram = 96e9; -- 96GB
................................................................................
else
rare = bType.sw.rarity + bTier.sw.rarity
end
starlit.item.sw.link(swID, {
kind = 'schematic';
name = name .. ' Schematic';
input = fab;
output = id;
size = bType.sw.pgmSize;
cost = bType.sw.cost;
rarity = rare;
})
E.schematicGroupLink('starlit_electronics:battery', swID)
................................................................................
data = {}
defOnly = true
end
def = assert(def._starlit.chip)
end
local props = {
{title = 'Clock Rate', affinity = 'info';
desc = lib.math.siUI('Hz', def.clockRate)};
{title = 'RAM', affinity = 'info';
desc = lib.math.siUI('B', def.ram)};
}
if not defOnly then
table.insert(props, {
title = 'Free Storage', affinity = 'info';
desc = lib.math.siUI('B', E.chip.freeSpace(ch, data)) .. ' / '
.. lib.math.siUI('B', def.flash);
})
local swAffMap = {
schematic = 'schematic';
suitPower = 'ability';
driver = 'driver';
}
for i, e in ipairs(data.files) do
................................................................................
affinity = aff;
desc = name;
})
end
else
table.insert(props, {
title = 'Flash Storage', affinity = 'info';
desc = lib.math.siUI('B', def.flash);
})
end
return starlit.ui.tooltip {
title = data.label and data.label~='' and string.format('<%s>', data.label) or def.name;
color = lib.color(.6,.6,.6);
desc = def.desc;
props = props;
................................................................................
local circMat = t.circ or 'silicon';
starlit.item.chip.link(id, {
name = t.name;
clockRate = t.clockRate;
flash = t.flash;
ram = t.ram;
powerEfficiency = t.powerEfficiency; -- cycles per joule
fab = starlit.type.fab {
flag = {
silicompile = true;
};
time = {
silicompile = t.size * 24*60;
};
cost = {
................................................................................
end;
open = function(self,fn)
return E.chip.fileOpen(self.chip, self.inode, fn)
end;
};
}
function E.chip.usableSoftware(chips,pgm,pred)
pred = pred or function() return true end
local comp = E.chip.sumCompute(chips)
local r = {}
local unusable = {}
local sw if pgm then
if type(pgm) == 'string' then
pgm = {starlit.item.sw.db[pgm]}
end
................................................................................
end
end
end
end
end
for _, s in pairs(sw) do
if s.sw.cost.ram <= comp.ram and pred(s) then
table.insert(r, {
sw = s.sw;
chip = s.chip, chipSlot = s.chipSlot;
file = s.file;
fd = E.chip.fileHandle(s.chip, s.inode);
speed = s.sw.cost.cycles / comp.cycles;
powerCost = s.sw.cost.cycles / comp.powerEfficiency;
|