sorcery  Check-in [aba5ad057a]

Overview
Comment:add mounted keg for shelving units, fix altar visuals
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aba5ad057aa371de3b3398edc83b2164ef38f22a984ef79f917418682da18267
User & Date: lexi on 2021-07-07 15:34:56
Other Links: manifest | tags
Context
2021-07-07
15:35
fix keg group check-in: a27bfa0fa7 user: lexi tags: trunk
15:34
add mounted keg for shelving units, fix altar visuals check-in: aba5ad057a user: lexi tags: trunk
13:08
fug bixes check-in: b9235d8bfa user: lexi tags: trunk
Changes

Modified altar.lua from [dfbf2cd360] to [f0ec80311e].

1
2
3
4
5
6
7
8
9
local altar_item_offset = {
	x = 0, y = -0.3, z = 0
}
local log = sorcery.logger('altar')
local L = sorcery.lib

local range = function(min, max)
	local span = max - min
	local val = math.random() * span

|







1
2
3
4
5
6
7
8
9
local altar_item_offset = {
	x = 0, y = -0.3, z = 0.13
}
local log = sorcery.logger('altar')
local L = sorcery.lib

local range = function(min, max)
	local span = max - min
	local val = math.random() * span

Modified keg.lua from [b24c7d1147] to [4b624880ad].

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
43
44
45
46
47
48
49
50
51
...
124
125
126
127
128
129
130
131
132
133


134
135
136


137
138
139
140
141
142
143
...
177
178
179
180
181
182
183

184
185
186
187
188
189
190
191
192
193
194
195




















local constants = {
	keg_volume = sorcery.liquid.constants.glasses_per_bottle * 600
}

local hitbox = {
	type = 'fixed';
	fixed = {
		-0.4, -0.5, -0.5;
		 0.4,  0.2,  0.5;
	};






}


local kegcaption = function(m)
	local liqid = m:get_string('liquid')
	if liqid ~= '' then
		local liq = sorcery.register.liquid.db[liqid]
		if not liq then log.err('missing entry for liquid',liqid) return 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', liq.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';
	mesh = 'sorcery-keg.obj';

	sunlight_propagates = true;
	paramtype = 'light';
	paramtype2 = 'facedir';
	groups = { choppy = 2; sorcery_container = 2 }; -- 2=liquid
	tiles = {
		'default_bronze_block.png';
		'default_wood.png';
		'default_steel_block.png';
	};
	selection_box = hitbox;
	collision_box = hitbox;
	drop = {
		-- preserve_metadata will not work without this!
		max_items = 1;
		items = {
			{ items = { 'sorcery:keg' } };
		};
	};
	preserve_metadata = function(pos,node,meta,drops)
		if meta.liquid and meta.liquid ~= '' then
			local m = drops[1]:get_meta()
			m:from_table({fields = meta})
			local cap = kegcaption(m)
................................................................................
				else m:set_int('charge', amtleft) end
				sorcery.liquid.sound_dip(chg,avail,pos)
				update()

				-- fancy visuals
				local color = sorcery.lib.color(liq.color or {255,255,255})
				local spritz = sorcery.lib.image('sorcery_droplet.png'):glow(color)
				local drop = sorcery.lib.image('sorcery_drop.png'):glow(color)
				local facing = minetest.facedir_to_dir(minetest.get_node(pos).param2)
				local noz = vector.add(pos, vector.rotate(


					vector.new(0.0,0,-0.48),
					vector.dir_to_rotation(facing)
				))


				local minnoz = vector.offset(noz, -0.03, -0.32, -0.03);
				local maxnoz = vector.offset(noz,  0.03, -0.32,  0.03);
				minetest.add_particlespawner {
					amount = 15 * chg, time = 0.1*chg;
					texture = spritz:render();
					minpos = minnoz, maxpos = maxnoz;
					minvel = vector.new(0,0,0);
................................................................................
				end)

				return filled
			end
		end
	end;
})


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
























|


|
|

>
>
>
>
>
>
|
>
>












>

>
>
>
>
|
|
|
<
>



|





|
|




|







 







|
|
|
>
>
|
|
<
>
>







 







>












>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150

151
152
153
154
155
156
157
158
159
...
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
220
221
222
223
224
225
226
227
228
229
230
231
232
local constants = {
	keg_volume = sorcery.liquid.constants.glasses_per_bottle * 600
}

local hitbox = function(yo) return {
	type = 'fixed';
	fixed = {
		-0.4, -0.5 + yo, -0.45;
		 0.4,  0.2 + yo,  0.5;
	};
} end
local mcbox = {
	type = 'fixed';
	fixed = {
		-0.5, -0.4, -0.5;
		 0.5,  0.3,  0.4;
	};
}

local kegcaption = function(m)
	local liqid = m:get_string('liquid')
	if liqid ~= '' then
		local liq = sorcery.register.liquid.db[liqid]
		if not liq then log.err('missing entry for liquid',liqid) return 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', liq.measure(m:get_int('charge')), liq.name);
		};
	else return { title = 'Empty Keg', props = {} } end
end

local log = sorcery.logger('keg')
for _, keg in pairs {
	{ name = 'Keg', id = 'sorcery:keg', model = 'sorcery-keg.obj', atch = 1 };
	{ name = 'Mounted Keg', id = 'sorcery:keg_stand', model = 'sorcery-keg-stand.obj', atch = 0, ofs = 0.1, cb = mcbox };
} do
	minetest.register_node(keg.id, {
		description = keg.name;
		drawtype = 'mesh';

		mesh = keg.model;
		sunlight_propagates = true;
		paramtype = 'light';
		paramtype2 = 'facedir';
		groups = { choppy = 2; sorcery_container = 2; attached_node = keg.atch }; -- 2=liquid
		tiles = {
			'default_bronze_block.png';
			'default_wood.png';
			'default_steel_block.png';
		};
		selection_box = hitbox(keg.ofs or 0);
		collision_box = keg.cb or hitbox(keg.ofs or 0);
		drop = {
			-- preserve_metadata will not work without this!
			max_items = 1;
			items = {
				{ items = { keg.id } };
			};
		};
		preserve_metadata = function(pos,node,meta,drops)
			if meta.liquid and meta.liquid ~= '' then
				local m = drops[1]:get_meta()
				m:from_table({fields = meta})
				local cap = kegcaption(m)
................................................................................
					else m:set_int('charge', amtleft) end
					sorcery.liquid.sound_dip(chg,avail,pos)
					update()

					-- fancy visuals
					local color = sorcery.lib.color(liq.color or {255,255,255})
					local spritz = sorcery.lib.image('sorcery_droplet.png'):glow(color)
					local drop = sorcery.lib.image('sorcery_drop.png'):multiply(color)
					local facing = minetest.facedir_to_dir(minetest.get_node(pos).param2)
					local noz = vector.add(
						vector.offset(pos,0,keg.ofs or 0,0),
						vector.rotate(
							vector.new(0.0,0,-0.48),
							vector.dir_to_rotation(facing)

						)
					)
					local minnoz = vector.offset(noz, -0.03, -0.32, -0.03);
					local maxnoz = vector.offset(noz,  0.03, -0.32,  0.03);
					minetest.add_particlespawner {
						amount = 15 * chg, time = 0.1*chg;
						texture = spritz:render();
						minpos = minnoz, maxpos = maxnoz;
						minvel = vector.new(0,0,0);
................................................................................
					end)

					return filled
				end
			end
		end;
	})
end

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

minetest.register_craft {
	output = "sorcery:keg_stand";
	recipe = {
		{'','sorcery:keg',''};
		{'sorcery:screw_steel','group:wood','sorcery:screw_steel'};
		{'sorcery:screw_steel','screwdriver:screwdriver','sorcery:screw_steel'};
	};
	replacements = {{'screwdriver:screwdriver', 'screwdriver:screwdriver'}};
}

minetest.register_craft {
	output = "sorcery:keg";
	type = 'shapeless';
	recipe = { 'sorcery:keg_stand', 'screwdriver:screwdriver' };
	replacements = {
		{'screwdriver:screwdriver', 'screwdriver:screwdriver'};
		{'sorcery:keg_stand', 'sorcery:screw_steel 4'};
	};
}