sorcery  Check-in [e408b8d0e0]

Overview
Comment:enable kegs to store (non-drinkable) potions, add keg crafting recipe
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e408b8d0e018c5d0fcad0cc3930dee280e971c18e75897e98c10a80bd81cf328
User & Date: lexi on 2021-06-24 16:36:14
Other Links: manifest | tags
Context
2021-06-28
15:38
more work on kegs and liquid, add taps and troughs for tapping trees and obtaining sap, add tree lore, add infuser module system, various tweaks, fix up bugged itemclass logic, add scaffold for crafting extension mechanism check-in: 01f4ba8ddc user: lexi tags: trunk
2021-06-24
16:36
enable kegs to store (non-drinkable) potions, add keg crafting recipe check-in: e408b8d0e0 user: lexi tags: trunk
07:15
add basic keg impl check-in: 9b8118877e user: lexi tags: trunk
Changes

Modified keg.lua from [1db75c4003] to [64df297e83].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
80
81
...
189
190
191
192
193
194
195












		local liq = sorcery.register.liquid.db[liqid]
		if not liq then log.err('missing entry for liquid',liqid) return end
		local measure = liq.measure or function(u)
			return string.format('%s drams', u*63.9)
		end

		return {
			title = string.format('Keg of %s', liq.name);
			color = sorcery.lib.color(liq.color);
			props = {
				{title = 'Contains', desc = measure(m:get_int('charge'))};
			}
		};
	else return { title = 'Empty Keg', props = {} } end
end
local log = sorcery.logger('keg')
minetest.register_node('sorcery:keg', {
	description = 'Keg';
	drawtype = 'mesh';
................................................................................
		m:set_string('infotext', 'Empty Keg')
	end;
	on_rightclick = function(pos, node, user, stack)
		local m = minetest.get_meta(pos)
		local update = function()
			local c = kegcaption(m)
			local str = c.title

			for _,p in pairs(c.props) do
				str = str .. string.format('\n(%s: %s)', p.title, p.desc)
			end
			m:set_string('infotext', str)
		end
		local noise = function(amt)
			minetest.sound_play('default_water_footstep', {
				gain = 0.5 + amt / 9.0;
				pitch = 1.3 - amt / 12.0;
				pos = pos;
................................................................................
					}
				end
			end

		end
	end;
})



















|

<
|
<







 







>
|

|







 







>
>
>
>
>
>
>
>
>
>
>
>
11
12
13
14
15
16
17
18
19

20

21
22
23
24
25
26
27
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
...
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
		local liq = sorcery.register.liquid.db[liqid]
		if not liq then log.err('missing entry for liquid',liqid) return end
		local measure = liq.measure or function(u)
			return string.format('%s drams', u*63.9)
		end

		return {
			title = string.format('%s Keg', sorcery.lib.str.capitalize(liq.name));
			color = sorcery.lib.color(liq.color);

			desc = string.format('%s of %s', measure(m:get_int('charge')), liq.name);

		};
	else return { title = 'Empty Keg', props = {} } end
end
local log = sorcery.logger('keg')
minetest.register_node('sorcery:keg', {
	description = 'Keg';
	drawtype = 'mesh';
................................................................................
		m:set_string('infotext', 'Empty Keg')
	end;
	on_rightclick = function(pos, node, user, stack)
		local m = minetest.get_meta(pos)
		local update = function()
			local c = kegcaption(m)
			local str = c.title
			if c.desc then str = str .. '\n(' .. c.desc .. ')' end
			if c.props then for _,p in pairs(c.props) do -- future-proofing
				str = str .. string.format('\n(%s: %s)', p.title, p.desc)
			end end
			m:set_string('infotext', str)
		end
		local noise = function(amt)
			minetest.sound_play('default_water_footstep', {
				gain = 0.5 + amt / 9.0;
				pitch = 1.3 - amt / 12.0;
				pos = pos;
................................................................................
					}
				end
			end

		end
	end;
})

minetest.register_craft {
	output = "sorcery:keg";
	recipe = {
		{'', 'basic_materials:steel_bar', 'screwdriver:screwdriver'};
		{'sorcery:screw_bronze', 'default:bronze_ingot', 'sorcery:screw_bronze'};
		{'', 'xdecor:barrel', ''};
	};
	replacements = {
		{'screwdriver:screwdriver', 'screwdriver:screwdriver'};
	};
}

Modified liquid.lua from [951f6052a6] to [a02ac21c24].

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
31
32
33
34
35
36
37
38
39
40
41
-- liquid.lua
-- the liquid registry is used to keep track of abstract liquids,
-- their properties, and their representation in-game.

sorcery.registry.mk('liquid', false)


-- pre-register liquids used in Sorcery and common ones sorcery depends on

sorcery.register.liquid.link('default:water', {
	name = 'Water';
	kind = 'default:drink';
	color = {10,85,255};
	proto = nil;
	src = 'default:water_source';
	containers = {
		['vessels:glass_bottle'] = 'sorcery:potion_water';
		['bucket:bucket_empty'] = 'bucket:bucket_water';
	};
})

sorcery.register.liquid.link('farming:ethanol', {
	name = 'Ethanol';
	kind = 'default:fuel';
	color = {175,185,130};
	proto = nil;
	measure = function(u) return string.format('%s pints', u * 5) end;
	containers = {
		['vessels:glass_bottle'] = 'farming:ethanol_bottle';
	};
})

sorcery.register.liquid.link('sorcery:blood', {
	name = 'Blood';
	kind = 'sorcery:reagent';
	color = {255,10,30};
	proto = nil;
	measure = function(u) return string.format('%s cc', u * 236.5) end;
	containers = {
		['vessels:glass_bottle'] = 'sorcery:blood';
	};
})





>

|


|











|










|








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
31
32
33
34
35
36
37
38
39
40
41
42
-- liquid.lua
-- the liquid registry is used to keep track of abstract liquids,
-- their properties, and their representation in-game.

sorcery.registry.mk('liquid', false)
sorcery.liquid = {}

-- pre-register basic liquids used in Sorcery and common ones sorcery depends on

sorcery.register.liquid.link('default:water', {
	name = 'water';
	kind = 'default:drink';
	color = {10,85,255};
	proto = nil;
	src = 'default:water_source';
	containers = {
		['vessels:glass_bottle'] = 'sorcery:potion_water';
		['bucket:bucket_empty'] = 'bucket:bucket_water';
	};
})

sorcery.register.liquid.link('farming:ethanol', {
	name = 'ethanol';
	kind = 'default:fuel';
	color = {175,185,130};
	proto = nil;
	measure = function(u) return string.format('%s pints', u * 5) end;
	containers = {
		['vessels:glass_bottle'] = 'farming:ethanol_bottle';
	};
})

sorcery.register.liquid.link('sorcery:blood', {
	name = 'blood';
	kind = 'sorcery:reagent';
	color = {255,10,30};
	proto = nil;
	measure = function(u) return string.format('%s cc', u * 236.5) end;
	containers = {
		['vessels:glass_bottle'] = 'sorcery:blood';
	};
})

Modified potions.lua from [a284aef5fe] to [1d78d17f17].

113
114
115
116
117
118
119
120


121







122
123
124










125
126
127
128
129
130
131
	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 '') ..
		' liquid'
	local fullname = n .. ' Potion'
	sorcery.register_potion(id, fullname, desc, color, kind, glow, {


		_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)







|
>
>
|
>
>
>
>
>
>
>



>
>
>
>
>
>
>
>
>
>







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
138
139
140
141
142
143
144
145
146
147
148
149
150
	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 '') ..
		' liquid'
	local fullname = n .. ' Potion'
	sorcery.register.liquid.link('sorcery:'..id, {
		name = 'Serene Potion';
		color = v.color;
		proto = v;
		kind = 'sorcery:potion';
		measure = function(amt) return string.format('%s draughts', amt / 3) end;
		containers = {
			['vessels:glass_bottle'] = 'sorcery:' .. id;
		};
	})
	sorcery.register_potion(id, fullname, desc, color, kind, glow, {
		groups = {
			sorcery_potion = 1;
			sorcery_magical = 1;
		};
		_proto = v;
		_sorcery = {
			container = {
				type = 'vessel';
				hold = 'liquid';
				has = 'sorcery:' .. id;
				empty = 'vessels:glass_bottle';
				charge = 3;
			};
		};
	})
	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)