starlit  Diff

Differences From Artifact [7b434e8bee]:

To Artifact [35031ce713]:


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72



73
74











































75
76
77
78
79
80
81
...
129
130
131
132
133
134
135

B.path = {}
-- this maps stage IDs to tables of the following form
--[[ {
	part = {
		['starlit_building:pipe'] = 'myMod:stage3';
	};
	tool = {
		['starlit:scredriver'] = 'myMod:otherThing_stage1';
		['starlit:saw'] = function(node, tool)
			minetest.replace_node(node, {name='myMod:stage1'})
			minetest.drop_item(node, 'starlit_building:pipe')
		end;
		['myMod:laserWrench'] = {
			allow = function(node, tool) ... end;
			handle = function(node, tool) ... end;
................................................................................
			fixed = { ... };
		};
	})
]]

B.part = lib.registry.mk 'starlit_building:part'
-- a part is implemented as a special craftitem with the proper callbacks
-- to index the registries and place/replace noes by reference to the
-- build tree.
--[[
	starlit.mod.building.part.link(id, {
		name = ''; -- display name
		desc = ''; -- display desc
		img = ''; -- display image



	})
]]












































B.stage.foreach('starlit:stageGen', {}, function(id, e)
	local box = {type = 'fixed', fixed = {}}
	local tex = {}
	local ofs = vector.new(0,0,0)
	for idx, p in ipairs(e.pieces) do
		local ho, pieceID, pos
................................................................................
end

function B.pathFind(from, kind, what)
	if not B.path[from] then return nil end
	return B.path[from][kind][what]
end









|







 







|






>
>
>


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







 







>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
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
...
175
176
177
178
179
180
181
182
B.path = {}
-- this maps stage IDs to tables of the following form
--[[ {
	part = {
		['starlit_building:pipe'] = 'myMod:stage3';
	};
	tool = {
		['starlit:screwdriver'] = 'myMod:otherThing_stage1';
		['starlit:saw'] = function(node, tool)
			minetest.replace_node(node, {name='myMod:stage1'})
			minetest.drop_item(node, 'starlit_building:pipe')
		end;
		['myMod:laserWrench'] = {
			allow = function(node, tool) ... end;
			handle = function(node, tool) ... end;
................................................................................
			fixed = { ... };
		};
	})
]]

B.part = lib.registry.mk 'starlit_building:part'
-- a part is implemented as a special craftitem with the proper callbacks
-- to index the registries and place/replace nodes by reference to the
-- build tree.
--[[
	starlit.mod.building.part.link(id, {
		name = ''; -- display name
		desc = ''; -- display desc
		img = ''; -- display image
		mass = 0;
		fab = {}; -- (optional) auto-gen schematic
		rarity = 0;
	})
]]
B.part.foreach('starlit:partGen', {}, function(id, e)
	local props = {}
	if e.mass then
		table.insert(props, {title='Mass', desc=lib.math.siUI('g',e.mass), affinity='info'})
	end
	local rev, scmID
	if e.fab then
		scmID = string.format('%s_schematic', id)
		rev = {
			sw = scmID;
			complexity = e.complexity or 1;
		}
	end
	minetest.register_craftitem(id, {
		short_description = e.name;
		description = starlit.ui.tooltip {
			title = e.name;
			desc = e.desc;
			props = props;
		};
		inventory_image = e.img;
		_starlit = {
			mass = e.mass;
			reverseEngineer = rev;
			recover = e.recover or e.fab;
		};
	})
	if e.fab then
		starlit.item.sw.link(scmID, {
			kind = 'schematic';
			name = string.format('%s Schematic', e.name);
			size = e.size or 32e6;
			input = e.fab;
			output = id;
			cost = e.cost or {
				cycles = 4e9;
				ram = 1e9;
			};
			rarity = e.rarity or 0;
		})
	end

end)

B.stage.foreach('starlit:stageGen', {}, function(id, e)
	local box = {type = 'fixed', fixed = {}}
	local tex = {}
	local ofs = vector.new(0,0,0)
	for idx, p in ipairs(e.pieces) do
		local ho, pieceID, pos
................................................................................
end

function B.pathFind(from, kind, what)
	if not B.path[from] then return nil end
	return B.path[from][kind][what]
end

starlit.include 'parts'