75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
end;
};
metallic = {
subclass = {'metal'};
predicate = function(name)
-- matreg is a registry binding crafted items,
-- like armors and tools, to the material they
-- are made out of
local mat = sorcery.matreg.lookup[name]
if mat and mat.metal then return mat end
local prop = minetest.registered_items[name]._sorcery
if prop and prop.material and prop.material.metal then
return prop.material
end
end;
};
ore = {
groups = { 'ore' };
compat = 'ore';
predicate = function(name)
-- maybe revise this at some point once sorcery is extricated
-- from instant_ores and we have more control over the items
-- we generate
................................................................................
return { metal = true, id = iname }
elseif sorcery.data.gems[iname] then
return { gem = true, id = iname }
end
end
end;
};
-- fuel = {};
};
get = function(name,class)
local c = sorcery.itemclass.classes[class]
local o
if not c then return false end
if type(name) ~= 'string' then name = name:get_name() end
|
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
...
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
end;
};
metallic = {
subclass = {'metal'};
predicate = function(name)
-- matreg is a registry binding crafted items,
-- like armors and tools, to the material they
-- are made out of. it's necessary because not
-- all items we want to interact with have
-- definitions under our control
local mat = sorcery.matreg.lookup[name]
if mat and mat.metal then return mat end
local prop = minetest.registered_items[name]._sorcery
if prop and prop.material and prop.material.metal then
return prop.material
end
end;
};
material = {
subclass = {'metallic','crystalline'};
};
ore = {
groups = { 'ore' };
compat = 'ore';
predicate = function(name)
-- maybe revise this at some point once sorcery is extricated
-- from instant_ores and we have more control over the items
-- we generate
................................................................................
return { metal = true, id = iname }
elseif sorcery.data.gems[iname] then
return { gem = true, id = iname }
end
end
end;
};
fuel = {
groups = {'fuel','flammable'};
predicate = function(name)
local c,di = minetest.get_craft_result {
method = 'fuel';
width = 1;
items = { ItemStack(name) };
}
if c.time and c.time > 0 then
return {
burntime = c.time;
leftover = di and di[1];
}
end
end;
};
};
get = function(name,class)
local c = sorcery.itemclass.classes[class]
local o
if not c then return false end
if type(name) ~= 'string' then name = name:get_name() end
|