starlit  Diff

Differences From Artifact [bf764e9a62]:

To Artifact [2d3d2d3760]:


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
..
60
61
62
63
64
65
66
























67
68
69
70
71
72
73
..
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
local lib = starlit.mod.lib
local scenario = starlit.world.scenario


local function makeChip(label, schem, sw)
	local E = starlit.mod.electronics
	local files = {}
	local sz = 0
	for _, e in ipairs(schem) do
		local p = E.sw.findSchematicFor(e[1])
		if p then
			local file = {
				kind = 'sw', name = '', drm = e[2];
				body = {pgmId = p};
			}
			table.insert(files, file)
			sz = sz + E.chip.fileSize(file)
		end
	end
	for _, e in ipairs(sw) do
		local file = {
			kind = 'sw', name = '', drm = e[2];
			body = {pgmId = e[1]};
		}
		table.insert(files, file)
		sz = sz + E.chip.fileSize(file)
	end
	local chip = ItemStack(assert(E.chip.findBest(function(c)
		return c.flash >= sz, c.ram + c.clockRate
	end)))
................................................................................

local battery = function(name)
	local s = ItemStack(name)
	starlit.mod.electronics.battery.setChargeF(s, 1.0)
	return s
end


























table.insert(scenario, {
	id = 'starlit_scenario:imperialExpat';
	name = 'Imperial Expat';
	desc = "Hoping to escape a miserable life deep in the grinding gears of the capitalist machine for the bracing freedom of the frontier, you sought entry as a colonist to the new Commune world of Thousand Petal. Fate -- which is to say, terrorists -- intervened, and you wound up stranded on Farthest Shadow with little more than the nanosuit on your back, ship blown to tatters and your soul thoroughly mauled by the explosion of a twisted alien artifact -- which SOMEONE neglected to inform you your ride would be carrying.\nAt least you got some nifty psionic powers out of this whole clusterfuck. Hopefully they're safe to use.";

	species = 'human';
................................................................................
			-- came with this chip already plugged in. it's apparently true
			-- what they say: the Commune is always prepared for everything.
			-- E V E R Y T H I N G.
		};
		suitGuns = {};
		suitAmmo = {};
		suitCans = {
			ItemStack('starlit_material:canister_small');

		};
		carry = {
			chipLibrary.compendium;
			-- you bought this on a whim before you left the Empire, and
			-- just happened to still have it on your person when everything
			-- went straight to the Wild Gods' privy
		};


>










|








|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>







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
..
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
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
local lib = starlit.mod.lib
local scenario = starlit.world.scenario
local log = starlit.logger 'scenario'

local function makeChip(label, schem, sw)
	local E = starlit.mod.electronics
	local files = {}
	local sz = 0
	for _, e in ipairs(schem) do
		local p = E.sw.findSchematicFor(e[1])
		if p then
			local file = {
				kind = 'sw', name = '', drm = e[2];
				body = {pgmId = p, conf = {}};
			}
			table.insert(files, file)
			sz = sz + E.chip.fileSize(file)
		end
	end
	for _, e in ipairs(sw) do
		local file = {
			kind = 'sw', name = '', drm = e[2];
			body = {pgmId = e[1], conf = {}};
		}
		table.insert(files, file)
		sz = sz + E.chip.fileSize(file)
	end
	local chip = ItemStack(assert(E.chip.findBest(function(c)
		return c.flash >= sz, c.ram + c.clockRate
	end)))
................................................................................

local battery = function(name)
	local s = ItemStack(name)
	starlit.mod.electronics.battery.setChargeF(s, 1.0)
	return s
end

local function volume(kind,name,mass)
	local sorted = {}
	for k,v in pairs(starlit.item.canister.db) do
		table.insert(sorted, {id=k, can=v})
	end
	table.sort(sorted, function(a,b) return a.can.vol < b.can.vol end)

	local liq = starlit.world.material[kind].db[name]

	local can
	for i, v in ipairs(sorted) do
		if v.can.vol <= liq.density * mass then
			can = ItemStack(i)
			break
		end
	end
	if can == nil then log.fatal('failed to find canister size for gift %s', kind) end

	local st = starlit.item.canister.meta(can)
	st.write('contents', {kind = kind, id = name, mass = mass})

	return can
end


table.insert(scenario, {
	id = 'starlit_scenario:imperialExpat';
	name = 'Imperial Expat';
	desc = "Hoping to escape a miserable life deep in the grinding gears of the capitalist machine for the bracing freedom of the frontier, you sought entry as a colonist to the new Commune world of Thousand Petal. Fate -- which is to say, terrorists -- intervened, and you wound up stranded on Farthest Shadow with little more than the nanosuit on your back, ship blown to tatters and your soul thoroughly mauled by the explosion of a twisted alien artifact -- which SOMEONE neglected to inform you your ride would be carrying.\nAt least you got some nifty psionic powers out of this whole clusterfuck. Hopefully they're safe to use.";

	species = 'human';
................................................................................
			-- came with this chip already plugged in. it's apparently true
			-- what they say: the Commune is always prepared for everything.
			-- E V E R Y T H I N G.
		};
		suitGuns = {};
		suitAmmo = {};
		suitCans = {
-- 			ItemStack('starlit_material:canister_small');
			volume('liquid', 'water', 5);
		};
		carry = {
			chipLibrary.compendium;
			-- you bought this on a whim before you left the Empire, and
			-- just happened to still have it on your person when everything
			-- went straight to the Wild Gods' privy
		};