sorcery  Check-in [a66c0f02c7]

Overview
Comment:bug fixes, improve disc texture, improve recipes, you can now pour blood directly into a trough when you draw it with a consecrated dagger
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a66c0f02c796155d2e577f316ae1cc0198a09a21e5e278e91a7d7d9d851a1aa2
User & Date: lexi on 2021-07-08 14:32:53
Other Links: manifest | tags
Context
2021-07-08
17:06
bug fixes, add disc textures, get lathe fully operational finally check-in: efb9d9d1b9 user: lexi tags: trunk
14:32
bug fixes, improve disc texture, improve recipes, you can now pour blood directly into a trough when you draw it with a consecrated dagger check-in: a66c0f02c7 user: lexi tags: trunk
13:41
commit missing texture check-in: aece454800 user: lexi tags: trunk
Changes

Modified enchanter.lua from [569b7fff67] to [c83bd974f4].

171
172
173
174
175
176
177
178


179
180
181
182
183
184
185
	sorcery.enchant.strength = function(stack,id)
		-- this functions should be used whenever you need to
		-- determine the power of a particular enchantment on
		-- an enchanted item.
		local e = sorcery.enchant.get(stack)
		local p = 0.0
		local ct = 0
		local slots = sorcery.matreg.lookup[stack:get_name()].data.slots


		-- TODO handle strength-boosting spells!
		for _,s in pairs(e.spells) do
			if s.id == id then
				p = p + ((s.boost * slots[s.slot].confluence)/10)
				ct = ct + 1
			end
		end







|
>
>







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
	sorcery.enchant.strength = function(stack,id)
		-- this functions should be used whenever you need to
		-- determine the power of a particular enchantment on
		-- an enchanted item.
		local e = sorcery.enchant.get(stack)
		local p = 0.0
		local ct = 0
		local slots = sorcery.matreg.lookup[stack:get_name()]
		if not (slots and slots.data and slots.data.slots) then return p, ct end
		slots = slots.data.slots
		-- TODO handle strength-boosting spells!
		for _,s in pairs(e.spells) do
			if s.id == id then
				p = p + ((s.boost * slots[s.slot].confluence)/10)
				ct = ct + 1
			end
		end

Modified lathe.lua from [1310436767] to [f27b9cba36].



1
2
3
4
5
6
7
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51


sorcery.lathe = {
	techs = {
		cut = {dmg = true};
		intaglio = {consume = true};
	};
	tools = {
		sword = 'cut', knife = 'cut', blade = 'cut';
................................................................................
	local rec = R[wkpc:get_name()][tech][idx]
	local outn = ItemStack(rec.output):get_count()
	local ntimes = math.floor(howmany / (rec.mass or 1))
	return {
		tool = tool, wkpc = wkpc;
		cost = rec.cost * ntimes;
		ntimes = ntimes;
		tqty = math.floor(howmany / outn), outn = outn;
		gqty = ntimes * outn;
		tech = tech;
		rec = rec;
		inv = inv;
	}
end

>
>







 







|







1
2
3
4
5
6
7
8
9
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- the math basically needs to be rewritten from scratch by someone who isn't
-- dyscalculic but 
sorcery.lathe = {
	techs = {
		cut = {dmg = true};
		intaglio = {consume = true};
	};
	tools = {
		sword = 'cut', knife = 'cut', blade = 'cut';
................................................................................
	local rec = R[wkpc:get_name()][tech][idx]
	local outn = ItemStack(rec.output):get_count()
	local ntimes = math.floor(howmany / (rec.mass or 1))
	return {
		tool = tool, wkpc = wkpc;
		cost = rec.cost * ntimes;
		ntimes = ntimes;
		tqty = math.floor(howmany / outn) * (rec.mass or 1), outn = outn;
		gqty = ntimes * outn;
		tech = tech;
		rec = rec;
		inv = inv;
	}
end

Modified liquid.lua from [1c87060d5d] to [1f34837a06].

105
106
107
108
109
110
111
112


113
114
115
116
117
118
119
120
121
...
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
	for i = 1*f,M*f do
		local top = L.image('sorcery_trough_top_overlay.png')
		if liq then top = top:blit( 
			L.image('sorcery_node_liquid.png'):multiply(L.color(liq.color))
		) else top=top:blit(
			L.image('sorcery_trough_bottom.png')
		) end
		local ttlc = function(liq,i) return


			liq and string.format('%s Trough', L.str.capitalize(liq.name)),
			liq and string.format('%s of %s', liq.measure(i * Q), liq.name)
		end
		local trough_title, trough_content = ttlc(liq,i)
		local function trough_caption(pos,i,l) 
			local trough_title, trough_content = ttlc(l or liq,i)
			minetest.get_meta(pos):set_string('infotext', i > 0 and string.format(
				'%s\n(%s)', trough_title, trough_content
			) or 'Empty Trough')
................................................................................
					type = 'bucket';
					hold = 'liquid';
					has = liq and liq.id;
					charge = liq and Q * i;
					empty = 'sorcery:trough';
					max = constants.bottles_per_trough * Q;
					set_node_vol = liq and function(pos, vol)

						vol = math.min(M, math.max(0, math.floor(vol / Q)))
						minetest.swap_node(pos, {name = lid(vol)})
						trough_caption(pos, vol)

					end;
					set_node_liq = function(pos, liq, vol)
						log.act('adding', vol, 'to trough at', liq)

						vol = vol or Q * i
						local idx = math.min(M, math.floor(vol/Q))
						minetest.swap_node(pos, {name = trough_mkid(liq, idx)})
						trough_caption(pos, idx, liq)

					end
				}
			};
		})
	end
end
sorcery.liquid.mktrough()

















sorcery.liquid.measure_default = sorcery.liquid.units.dram

sorcery.liquid.container = function(liq, ctr)
	return liq.containers[({
		bottle = 'vessels:glass_bottle';
		glass = 'vessels:drinking_glass';







|
>
>
|
|







 







>



>


<
>




>







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







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
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
	for i = 1*f,M*f do
		local top = L.image('sorcery_trough_top_overlay.png')
		if liq then top = top:blit( 
			L.image('sorcery_node_liquid.png'):multiply(L.color(liq.color))
		) else top=top:blit(
			L.image('sorcery_trough_bottom.png')
		) end
		local ttlc = function(liq,i) 
			if type(liq) == 'string' then liq = sorcery.register.liquid.db[liq] end
			return
				liq and string.format('%s Trough', L.str.capitalize(liq.name)),
				liq and string.format('%s of %s', liq.measure(i * Q), liq.name)
		end
		local trough_title, trough_content = ttlc(liq,i)
		local function trough_caption(pos,i,l) 
			local trough_title, trough_content = ttlc(l or liq,i)
			minetest.get_meta(pos):set_string('infotext', i > 0 and string.format(
				'%s\n(%s)', trough_title, trough_content
			) or 'Empty Trough')
................................................................................
					type = 'bucket';
					hold = 'liquid';
					has = liq and liq.id;
					charge = liq and Q * i;
					empty = 'sorcery:trough';
					max = constants.bottles_per_trough * Q;
					set_node_vol = liq and function(pos, vol)
						log.act('putting', vol, liq, 'in trough at', pos)
						vol = math.min(M, math.max(0, math.floor(vol / Q)))
						minetest.swap_node(pos, {name = lid(vol)})
						trough_caption(pos, vol)
						return vol * Q
					end;
					set_node_liq = function(pos, liq, vol)

						log.act('putting', vol, liq, 'in trough at', pos)
						vol = vol or Q * i
						local idx = math.min(M, math.floor(vol/Q))
						minetest.swap_node(pos, {name = trough_mkid(liq, idx)})
						trough_caption(pos, idx, liq)
						return idx * Q
					end
				}
			};
		})
	end
end
sorcery.liquid.mktrough()

sorcery.liquid.setctr = function(pos, liq, vol, sameliq)
	local n = sorcery.lib.node.force(pos)
	if minetest.get_item_group(n.name, 'sorcery_container') ~= 2 then return false end
	local def = minetest.registered_items[n.name]._sorcery
	if not (def and def.container and def.container.set_node_liq) then
		log.err('node',n.name,'marked as liquid container but is missing container.set_node_liq callback')
		return false
	end
	if sameliq then
		if def.container.has ~= nil and def.container.has ~= liq then
			return false
		end
	end
	return def.container.set_node_liq(pos, liq, vol)
end

sorcery.liquid.measure_default = sorcery.liquid.units.dram

sorcery.liquid.container = function(liq, ctr)
	return liq.containers[({
		bottle = 'vessels:glass_bottle';
		glass = 'vessels:drinking_glass';

Modified recipes.lua from [3fef19dac9] to [3da7013b08].

159
160
161
162
163
164
165


166
167








168
169
170
171
172
173
174
175
176
177
...
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
		{'sorcery:gem_amethyst', 'sorcery:gem_amethyst', 'sorcery:gem_amethyst'};
	};
}

minetest.register_craft {
	output = 'sorcery:tuning_disc';
	recipe = {


		{'sorcery:inverter_coil',ingot('silver'),''};
		{'sorcery:leyline_stabilizer','sorcery:silver_ingot','sorcery:gem_emerald'};








		{'sorcery:inverter_coil',ingot('silver'),''};
	};
}

minetest.register_craft {
	output = 'sorcery:farcaster';
	recipe = {
		{ingot('gold'),ingot('iridium'),ingot('gold')};
		{'sorcery:core_mandatic','default:diamondblock','sorcery:tuning_disc'};
		{ingot('gold'),ingot('iridium'),ingot('gold')};
................................................................................
},1,{
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
})

regtech('conduction_plate', 'Conduction Plate', {metal = 1}, {
	{'','default:copper_ingot',''};
	{'','stairs:slab_stone',''};
	{'basic_materials:copper_wire','basic_materials:steel_bar','basic_materials:copper_wire'};
}, 1, {
	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
})








>
>
|
<
>
>
>
>
>
>
>
>
|

|







 







|







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
...
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
		{'sorcery:gem_amethyst', 'sorcery:gem_amethyst', 'sorcery:gem_amethyst'};
	};
}

minetest.register_craft {
	output = 'sorcery:tuning_disc';
	recipe = {
		{'','sorcery:gem_emerald',''};
		{'',mtlp('silver','disc'),''};
		{'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'};

	};
}

print(dump{
	output = 'sorcery:tuning_disc';
	recipe = {
		{'','sorcery_gem:emerald',''};
		{'',mtlp('silver','disc'),''};
		{'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'};
	};
})

minetest.register_craft {
	output = 'sorcery:farcaster';
	recipe = {
		{ingot('gold'),ingot('iridium'),ingot('gold')};
		{'sorcery:core_mandatic','default:diamondblock','sorcery:tuning_disc'};
		{ingot('gold'),ingot('iridium'),ingot('gold')};
................................................................................
},1,{
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
})

regtech('conduction_plate', 'Conduction Plate', {metal = 1}, {
	{'','sorcery:disc_copper',''};
	{'','stairs:slab_stone',''};
	{'basic_materials:copper_wire','basic_materials:steel_bar','basic_materials:copper_wire'};
}, 1, {
	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
})

Modified textures/sorcery_disc.png from [7f739faf4d] to [3f68afb16e].

cannot compute difference between binary files

Modified tools.lua from [951d8532f1] to [950babc45d].

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
100
101
102
103
104
105
106

107
108
109
110
111
112
113
114
115
116
117
118

local dagger_usefn = function(selfharm)
	return function(stack,user,pointat)
		if (not minetest.is_player(pointat)) and
				selfharm == false then
			return nil
		end
		local trough = minetest.find_node_near(user:get_position(), 2.5, 'group:sorcery_trough', true)
		if trough then
			local cnn = minetest.get_node(trough).name
			local ctr = minetest.registered_nodes[cnn]._sorcery
			if (not ctr) or not ctr.container then
				log.err('item',cnn,'is marked as a trough, but has no _sorcery.container table')
			else
				ctr = ctr.container
................................................................................
		stack:add_wear(wear)

		if not trough then
			inv:remove_item('main',btl)
			inv:add_item('main',blood)
		else
			local amt = selfharm and math.random(1,2) or 2
			minetest.set_node(trough.pos, {
				name = trough.def.make(def.res*amt+ctr.charge,1):get_name()
			})
		end

		target:punch(user, 1.0, caps, nil)
		sorcery.vfx.bloodburst(pos)

		if math.random(3 + sorcery.enchant.strength(stack,'sanctify') * 6) == 1 then
			-- we've used up the consecration
................................................................................
		end
	end
end


minetest.register_tool("sorcery:dagger_consecrated", {
	description = "Consecrated Dagger",

	inventory_image = "sorcery_dagger_consecrated.png",
	tool_capabilities = {
		full_punch_interval = 1.6,
		max_drop_level = 1,
		damage_groups = { fleshy = 6 },
	},
	sound = { breaks = "default_tool_breaks" },
	groups = { sorcery_sanctify = 2, sword = 1 },
	punch_attack_uses = 16,
	on_use = dagger_usefn(false),
	on_secondary_use = dagger_usefn(true),
})







|







 







|
<
<







 







>
|











15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
73
74
75
76
77
78
79
80


81
82
83
84
85
86
87
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

local dagger_usefn = function(selfharm)
	return function(stack,user,pointat)
		if (not minetest.is_player(pointat)) and
				selfharm == false then
			return nil
		end
		local trough = minetest.find_node_near(user:get_pos(), 2.5, 'group:sorcery_trough', true)
		if trough then
			local cnn = minetest.get_node(trough).name
			local ctr = minetest.registered_nodes[cnn]._sorcery
			if (not ctr) or not ctr.container then
				log.err('item',cnn,'is marked as a trough, but has no _sorcery.container table')
			else
				ctr = ctr.container
................................................................................
		stack:add_wear(wear)

		if not trough then
			inv:remove_item('main',btl)
			inv:add_item('main',blood)
		else
			local amt = selfharm and math.random(1,2) or 2
			sorcery.liquid.setctr(trough.pos, 'sorcery:blood', (trough.ctr.charge or 0) + (trough.def.res*amt), true)


		end

		target:punch(user, 1.0, caps, nil)
		sorcery.vfx.bloodburst(pos)

		if math.random(3 + sorcery.enchant.strength(stack,'sanctify') * 6) == 1 then
			-- we've used up the consecration
................................................................................
		end
	end
end


minetest.register_tool("sorcery:dagger_consecrated", {
	description = "Consecrated Dagger",
	inventory_image = "sorcery_dagger_consecrated.png^sorcery_dagger_glow.png",
	wield_image = "sorcery_dagger_consecrated.png",
	tool_capabilities = {
		full_punch_interval = 1.6,
		max_drop_level = 1,
		damage_groups = { fleshy = 6 },
	},
	sound = { breaks = "default_tool_breaks" },
	groups = { sorcery_sanctify = 2, sword = 1 },
	punch_attack_uses = 16,
	on_use = dagger_usefn(false),
	on_secondary_use = dagger_usefn(true),
})