Differences From
Artifact [358af6b345]:
1 1 local lib = starlit.mod.lib
2 2
3 3 local E = {}
4 4 starlit.mod.electronics = E
5 +
6 +--------------------------------
7 +-- software context interface --
8 +-------------------------------- ---------------------------------------
9 +-- any time a program is run() or bgProc()eeded, a context argument MUST
10 +-- be passed to the entry point. this argument must have at least the
11 +-- following fields and functions:
12 +
13 +-- string context ('suit', 'device', etc)
14 +-- names the context in which the program is being run
15 +-- swCap program
16 +-- a structure as returned from usableSoftware(), providing the
17 +-- program with access to and information about its substrate
18 +-- function verify() --> bool
19 +-- return true if the chip the program was loaded from is still
20 +-- accessible
21 +-- function drawCurrent(power, time, whatFor, [min]) --> J
22 +-- attempt to draw current from the power source of whatever core
23 +-- the program is running on
24 +-- function pullConf() --> ()
25 +-- updates the conf structure provided to the program as part of
26 +-- its initial context
27 +-- function saveConf([conf]) --> ()
28 +-- saves any changes made to the conf structure
29 +-- function availableChips() --> inventory list
30 +-- returns the list of chips that are available in the execution
31 +-- context. needed to retrieve system files
32 +
33 +-- currently, this interface is implemented by
34 +-- - starlit/interfaces.lua
35 +-- - starlit/suit.lua
5 36
6 37 ---------------------
7 38 -- item registries --
8 39 ---------------------
9 40
10 41 -- a dynamo is any item that produces power and can be slotted into a power
11 42 -- source slot. this includes batteries, but also things like radiothermal