1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
..
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
...
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
...
220
221
222
223
224
225
226
227
|
local u = sorcery.lib
sorcery.data.infusions = {} -- not sure where to put this tbh
sorcery.data.infusion_leftovers = {}
sorcery.register_potion = function(name,label,desc,color,imgvariant,glow,extra)
local image = 'sorcery_liquid_'..(imgvariant or 'dull')..'.png' ..
'^[multiply:'..tostring(color)..
'^vessels_glass_bottle.png'
sorcery.data.register.infusion_leftover('sorcery:' .. name, 'vessels:glass_bottle')
local node = {
description = color:darken(0.8):bg(
sorcery.lib.ui.tooltip {
title = label;
desc = desc;
color = color:readable();
}
................................................................................
node.groups.vessel = 1;
node.groups.not_in_creative_inventory = 1;
minetest.register_node("sorcery:"..name, node)
end
sorcery.register_oil = function(name,label,desc,color,imgvariant,extra)
local image = 'xdecor_bowl.png^(sorcery_oil_' .. (imgvariant or 'dull') .. '.png^[colorize:'..tostring(color)..':140)'
sorcery.data.register.infusion_leftover('sorcery:' .. name, 'xdecor:bowl')
extra.description = label;
extra.inventory_image = image;
if not extra.groups then extra.groups = {} end
minetest.register_craftitem('sorcery:' .. name, extra)
end
sorcery.register_potion('blood', 'Blood', 'A bottle of sacrificial blood, imbued\nwith stolen life force', u.color(219,19,14))
sorcery.register_potion('potion_water', 'Water Bottle', 'A bottle of plain water', u.color(43,90,162))
sorcery.register_potion('holy_water', 'Holy Water','A bottle of consecrated water',u.color(94,138,206),'sparkle',6)
local create_infusion_recipe = function(id,potion,default_basis,proto)
if potion.infusion then
sorcery.data.register.infusion {
infuse = potion.infusion;
into = potion.basis or default_basis;
output = 'sorcery:' .. id;
_proto = proto;
}
end
end
for n,v in pairs(sorcery.data.potions) do
local color = u.color(v.color)
local kind = v.style
local glow = v.glow
local id = 'potion_' .. string.lower(n)
local desc = 'A ' .. ((glow and 'glowing ') or '') ..
'bottle of ' .. string.lower(n) ..
((kind == 'sparkle' and ', fiercely bubbling') or '') ..
................................................................................
_proto = v;
groups = {
sorcery_potion = 1;
sorcery_magical = 1;
};
})
create_infusion_recipe(id,v,'sorcery:potion_serene',{data=v,name=fullname})
end
for n,potion in pairs(sorcery.data.draughts) do
local name = 'draught_' .. n
local behavior = {
_proto = potion;
groups = {
sorcery_potion = 2;
sorcery_draught = 1;
sorcery_magical = 1;
................................................................................
sorcery_usable_magic = 1;
};
on_use = function(stack, user, pointat)
local pproto = stack:get_definition()._proto
if potion.effect(stack, user, pproto) == false then return nil end
local meta = stack:get_meta()
local force = meta:get_int('force');
minetest.add_particlespawner {
amount = 200 + (30 * force);
time = pproto:duration(meta);
minpos = { x = -0.1; y = 0; z = -0.1; };
maxpos = { x = 0.1; y = 2; z = 0.1; };
minvel = { x = -0.1; y = 0; z = -0.1; };
maxvel = { x = 0.1; y = 0; z = 0.1; };
minacc = { x = 0; y = 0.1; z = 0; };
maxacc = { x = 0; y = 1; z = 0; };
minexptime = 1;
................................................................................
sorcery.register_potion(name, fullname,
potion.desc,
u.color(potion.color),
potion.style or 'dull',
potion.glow or 0,
behavior)
create_infusion_recipe(name,potion,'sorcery:potion_luminous',{data=potion,name=fullname})
end
for n,elixir in pairs(sorcery.data.elixirs) do
local color = u.color(elixir.color)
local id = 'elixir_' .. string.lower(n)
local fullname = 'Elixir of ' .. n
sorcery.register_potion(id, fullname, nil, color, 'dull', false, {
_proto = elixir;
groups = {
sorcery_elixir = 1;
sorcery_magical = 1;
};
})
create_infusion_recipe(id,elixir,'sorcery:potion_misty',{data=elixir,name=fullname})
end
for n,v in pairs(sorcery.data.oils) do
local color = u.color(v.color)
local kind = v.style
local id = 'oil_' .. n
n = v.name or u.str.capitalize(n)
sorcery.register_oil(id, n .. ' Oil', nil, color, kind, {
groups = { sorcery_oil = 1 };
})
end
for n,v in pairs(sorcery.data.greases) do
local color = u.color(v.color)
local kind = v.style
sorcery.register_oil('grease_' .. n, u.str.capitalize(n) .. ' Grease', nil, color, kind, {
groups = { sorcery_grease = 1 }
})
end
for n,v in pairs(sorcery.data.philters) do
local color = u.color(v.color)
local id = 'philter_' .. n
local name = v.name or u.str.capitalize(n)
local fullname = name .. ' Philter'
sorcery.register_potion(id, fullname, v.desc, color, 'sparkle',v.glow or 4, {
_proto = v;
_protoname = n;
groups = {
sorcery_magical = 1;
sorcery_philter = 1;
};
})
create_infusion_recipe(id,v,'sorcery:potion_viscous',{data=v,name=fullname})
end
for n,v in pairs(sorcery.data.extracts) do
local item = v[1]
local color = u.color(v[2])
local name = 'extract_' .. n
sorcery.register_potion(name, u.str.capitalize(n) .. ' Extract', nil, color, 'sparkle', false, {
groups = {
sorcery_extracts = 1;
};
})
local add_alcohol = function(booze)
minetest.register_craft {
type = "shapeless";
recipe = {
................................................................................
};
}
end
-- need a relatively pure alcohol for this, tho other alcohols can be used
-- for potionmaking in other ways
add_alcohol('farming:bottle_ethanol')
add_alcohol('wine:glass_vodka')
end
|
|
|
|
|
|
|
>
|
|
>
>
<
>
|
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
..
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
...
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
...
228
229
230
231
232
233
234
235
|
local u = sorcery.lib
sorcery.registry.mk('infusions',false)
sorcery.registry.mk('residue',false)
sorcery.register_potion = function(name,label,desc,color,imgvariant,glow,extra)
local image = 'sorcery_liquid_'..(imgvariant or 'dull')..'.png' ..
'^[multiply:'..tostring(color)..
'^vessels_glass_bottle.png'
sorcery.register.residue.link('sorcery:' .. name, 'vessels:glass_bottle')
local node = {
description = color:darken(0.8):bg(
sorcery.lib.ui.tooltip {
title = label;
desc = desc;
color = color:readable();
}
................................................................................
node.groups.vessel = 1;
node.groups.not_in_creative_inventory = 1;
minetest.register_node("sorcery:"..name, node)
end
sorcery.register_oil = function(name,label,desc,color,imgvariant,extra)
local image = 'xdecor_bowl.png^(sorcery_oil_' .. (imgvariant or 'dull') .. '.png^[colorize:'..tostring(color)..':140)'
sorcery.register.residue.link('sorcery:' .. name, 'xdecor:bowl')
extra.description = label;
extra.inventory_image = image;
if not extra.groups then extra.groups = {} end
minetest.register_craftitem('sorcery:' .. name, extra)
end
sorcery.register_potion('blood', 'Blood', 'A bottle of sacrificial blood, imbued\nwith stolen life force', u.color(219,19,14))
sorcery.register_potion('potion_water', 'Water Bottle', 'A bottle of plain water', u.color(43,90,162))
sorcery.register_potion('holy_water', 'Holy Water','A bottle of consecrated water',u.color(94,138,206),'sparkle',6)
local create_infusion_recipe = function(id,potion,default_basis,proto)
if potion.infusion then
sorcery.register.infusions.link {
infuse = potion.infusion;
into = potion.basis or default_basis;
output = 'sorcery:' .. id;
_proto = proto;
}
end
end
-- for n,v in pairs(sorcery.data.potions) do
sorcery.register.potions.foreach('sorcery:mknodes',{},function(n,v)
local color = u.color(v.color)
local kind = v.style
local glow = v.glow
local id = 'potion_' .. string.lower(n)
local desc = 'A ' .. ((glow and 'glowing ') or '') ..
'bottle of ' .. string.lower(n) ..
((kind == 'sparkle' and ', fiercely bubbling') or '') ..
................................................................................
_proto = v;
groups = {
sorcery_potion = 1;
sorcery_magical = 1;
};
})
create_infusion_recipe(id,v,'sorcery:potion_serene',{data=v,name=fullname})
end)
-- for n,potion in pairs(sorcery.data.draughts) do
sorcery.register.draughts.foreach('sorcery:mknodes',{},function(n,potion)
local name = 'draught_' .. n
local behavior = {
_proto = potion;
groups = {
sorcery_potion = 2;
sorcery_draught = 1;
sorcery_magical = 1;
................................................................................
sorcery_usable_magic = 1;
};
on_use = function(stack, user, pointat)
local pproto = stack:get_definition()._proto
if potion.effect(stack, user, pproto) == false then return nil end
local meta = stack:get_meta()
local force = meta:get_int('force');
local duration = pproto:duration(meta);
minetest.add_particlespawner {
amount = (7 + (10 * force)) * duration;
time = duration;
minpos = { x = -0.1; y = 0; z = -0.1; };
maxpos = { x = 0.1; y = 2; z = 0.1; };
minvel = { x = -0.1; y = 0; z = -0.1; };
maxvel = { x = 0.1; y = 0; z = 0.1; };
minacc = { x = 0; y = 0.1; z = 0; };
maxacc = { x = 0; y = 1; z = 0; };
minexptime = 1;
................................................................................
sorcery.register_potion(name, fullname,
potion.desc,
u.color(potion.color),
potion.style or 'dull',
potion.glow or 0,
behavior)
create_infusion_recipe(name,potion,'sorcery:potion_luminous',{data=potion,name=fullname})
end)
-- for n,elixir in pairs(sorcery.data.elixirs) do
sorcery.register.elixirs.foreach('sorcery:mknodes',{},function(n,elixir)
local color = u.color(elixir.color)
local id = 'elixir_' .. string.lower(n)
local fullname = 'Elixir of ' .. n
sorcery.register_potion(id, fullname, nil, color, 'dull', false, {
_proto = elixir;
groups = {
sorcery_elixir = 1;
sorcery_magical = 1;
};
})
create_infusion_recipe(id,elixir,'sorcery:potion_misty',{data=elixir,name=fullname})
end)
-- for n,v in pairs(sorcery.data.oils) do
sorcery.register.oils.foreach('sorcery:mknodes',{},function(n,v)
local color = u.color(v.color)
local kind = v.style
local id = 'oil_' .. n
n = v.name or u.str.capitalize(n)
sorcery.register_oil(id, n .. ' Oil', nil, color, kind, {
groups = { sorcery_oil = 1 };
})
end)
-- for n,v in pairs(sorcery.data.greases) do
sorcery.register.greases.foreach('sorcery:mknodes',{},function(n,v)
local color = u.color(v.color)
local kind = v.style
sorcery.register_oil('grease_' .. n, u.str.capitalize(n) .. ' Grease', nil, color, kind, {
groups = { sorcery_grease = 1 }
})
end)
-- for n,v in pairs(sorcery.data.philters) do
sorcery.register.philters.foreach('sorcery:mknodes',{},function(n,v)
local color = u.color(v.color)
local id = 'philter_' .. n
local name = v.name or u.str.capitalize(n)
local fullname = name .. ' Philter'
sorcery.register_potion(id, fullname, v.desc, color, 'sparkle',v.glow or 4, {
_proto = v;
_protoname = n;
groups = {
sorcery_magical = 1;
sorcery_philter = 1;
};
})
create_infusion_recipe(id,v,'sorcery:potion_viscous',{data=v,name=fullname})
end)
-- for n,v in pairs(sorcery.data.extracts) do
sorcery.register.extracts.foreach('sorcery:mknodes',{},function(n,v)
local item = v[1]
local color = u.color(v[2])
local name = 'extract_' .. n
sorcery.register_potion(name, u.str.capitalize(n) .. ' Extract', nil, color, 'sparkle', false, {
groups = {
sorcery_extract = 1;
};
})
local add_alcohol = function(booze)
minetest.register_craft {
type = "shapeless";
recipe = {
................................................................................
};
}
end
-- need a relatively pure alcohol for this, tho other alcohols can be used
-- for potionmaking in other ways
add_alcohol('farming:bottle_ethanol')
add_alcohol('wine:glass_vodka')
end)
|