sorcery  Diff

Differences From Artifact [45b89ab03b]:

To Artifact [a381d20de4]:


1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
..
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
..
63
64
65
66
67
68
69

















70
71
72
73
74
75
76
local fragments_per_ingot = 4

minetest.register_lbm {
	label = "delete duranium ore";
	name = "sorcery:delete_duranium_ore";
	nodenames = {'sorcery:stone_with_duranium'};
	action = function(pos,node)
		minetest.set_node(pos, {name = 'default:stone'})
	end
}

sorcery.data.alloys = {}

sorcery.data.metallookup = {
	-- compat bullshit
	['moreores:silver_ingot'] = {
		id = 'silver'; data = sorcery.data.metals.silver;
		value = fragments_per_ingot;
	};
	['moreores:silver_block'] = {
................................................................................
	};
}

local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors
for name, metal in pairs(sorcery.data.metals) do
	local ingot = metal.ingot or 'sorcery:' .. name .. '_ingot'
	local block = metal.block or 'sorcery:' .. name .. '_block'

	local fragment = 'sorcery:fragment_' .. name
	if not metal.no_tools then for _,t in pairs(tools) do
		sorcery.matreg.lookup[(metal.items and metal.items[t]) or ('sorcery:' .. t .. '_' .. name)] = {
			metal = true;
			id = name; data = metal;
		}
	end end
	if not metal.no_armor then for _,a in pairs(armors) do
		sorcery.matreg.lookup[(metal.items and metal.items[t]) or ('sorcery:' .. a .. '_' .. name)] = {
			metal = true;
			id = name; data = metal;
		}
	end end
	sorcery.data.metallookup[ingot] = {
		id = name; data = metal;
		value = fragments_per_ingot;
................................................................................
	sorcery.data.metallookup[block] = {
		id = name; data = metal;
		value = fragments_per_ingot * 9;
	}
	sorcery.data.metallookup[fragment] = {
		id = name; data = metal;
		value = 1;

















	}
	if not sorcery.compat.defp(ingot) then
		-- TODO: remove instant_ores dependency
		instant_ores.register_metal {
			name = 'sorcery:' .. name;
			description = sorcery.lib.str.capitalize(name);
			color = sorcery.lib.color(metal.tone):hex() .. ':' .. ((metal.alpha and tostring(metal.alpha)) or '45');



|
|







>







 







>








|







 







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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
..
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
local fragments_per_ingot = 4

minetest.register_lbm {
	label = "delete duranium ore again";
	name = "sorcery:delete_duranium_ore_again";
	nodenames = {'sorcery:stone_with_duranium'};
	action = function(pos,node)
		minetest.set_node(pos, {name = 'default:stone'})
	end
}

sorcery.data.alloys = {}
sorcery.data.kilnrecs = {}
sorcery.data.metallookup = {
	-- compat bullshit
	['moreores:silver_ingot'] = {
		id = 'silver'; data = sorcery.data.metals.silver;
		value = fragments_per_ingot;
	};
	['moreores:silver_block'] = {
................................................................................
	};
}

local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors
for name, metal in pairs(sorcery.data.metals) do
	local ingot = metal.ingot or 'sorcery:' .. name .. '_ingot'
	local block = metal.block or 'sorcery:' .. name .. '_block'
	local screw = 'sorcery:screw_' .. name
	local fragment = 'sorcery:fragment_' .. name
	if not metal.no_tools then for _,t in pairs(tools) do
		sorcery.matreg.lookup[(metal.items and metal.items[t]) or ('sorcery:' .. t .. '_' .. name)] = {
			metal = true;
			id = name; data = metal;
		}
	end end
	if not metal.no_armor then for _,a in pairs(armors) do
		sorcery.matreg.lookup[(metal.items and metal.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
			metal = true;
			id = name; data = metal;
		}
	end end
	sorcery.data.metallookup[ingot] = {
		id = name; data = metal;
		value = fragments_per_ingot;
................................................................................
	sorcery.data.metallookup[block] = {
		id = name; data = metal;
		value = fragments_per_ingot * 9;
	}
	sorcery.data.metallookup[fragment] = {
		id = name; data = metal;
		value = 1;
	}
	sorcery.data.metallookup[screw] = {
		id = name; data = metal;
		value = 0; -- prevent use in smelting
	}
	minetest.register_craftitem(screw, {
		description = sorcery.lib.str.capitalize(name) .. ' screw';
		inventory_image = sorcery.lib.image('sorcery_screw.png'):multiply(sorcery.lib.color(metal.tone)):render();
	})
	-- TODO: replace crafting recipe with kiln recipe
	minetest.register_craft {
		output = screw.. ' 4';
		recipe = {
			{fragment,fragment,fragment};
			{'',      fragment,''};
			{'',      fragment,''};
		};
	}
	if not sorcery.compat.defp(ingot) then
		-- TODO: remove instant_ores dependency
		instant_ores.register_metal {
			name = 'sorcery:' .. name;
			description = sorcery.lib.str.capitalize(name);
			color = sorcery.lib.color(metal.tone):hex() .. ':' .. ((metal.alpha and tostring(metal.alpha)) or '45');