sorcery  Diff

Differences From Artifact [9824222a51]:

To Artifact [e98976a563]:


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
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
}
local log = sorcery.logger('tree')
local L = sorcery.lib

sorcery.register.trees.foreach('sorcery:treesetup', {}, function(id, t)
	-- generates sap and hooks handlers appropriately
	if t.node then



		local def = minetest.registered_nodes[t.node]

		local nextfn = def.on_place
		minetest.override_item(t.node, { on_place = function(stack, who, pointed, ...)
			if nextfn then nextfn(stack, who, pointed, ...) end
			if who ~= nil and pointed.type == 'node' then
				-- local pos = pointed.above
				-- local _, counts = minetest.find_nodes_in_area(
				-- 	vector.offset(pos, -1,-1,-1),
				-- 	vector.offset(pos,  1, 1, 1),
				-- 	t.leaves or 'group:leaves', false)
				-- if counts[next(counts)] > 0 then
				local n = minetest.get_node(pointed.above)
				n.param1 = 1
				minetest.swap_node(pointed.above, n)
				-- end
			end
		end })


	end

	if t.sap == false then return end
	if not t.sapliq then
		t.sapliq = string.format('sorcery:sap_%s', id)
		local sapdesc = t.sap or (t.desc .. ' Tree Sap')
		sorcery.liquid.register {
................................................................................
		name = what
	else
		pos = what
		name = sorcery.lib.node.force(what).name
	end
	
	for tn, def in pairs(sorcery.data.trees) do
		if def.node == name then
			return {
				tree = tn;
				def = def;
				pos = pos;
				node = name;
			}
		end







>
>
>
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>







 







|







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
..
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
}
local log = sorcery.logger('tree')
local L = sorcery.lib

sorcery.register.trees.foreach('sorcery:treesetup', {}, function(id, t)
	-- generates sap and hooks handlers appropriately
	if t.node then
		local nodes = t.node
		if type(nodes) == 'string' then nodes = {nodes} end
		for _, node in pairs(nodes) do
			local def = minetest.registered_nodes[node]
			if def then
				local nextfn = def.on_place
				minetest.override_item(node, { on_place = function(stack, who, pointed, ...)
					if nextfn then nextfn(stack, who, pointed, ...) end
					if who ~= nil and pointed.type == 'node' then
						-- local pos = pointed.above
						-- local _, counts = minetest.find_nodes_in_area(
						-- 	vector.offset(pos, -1,-1,-1),
						-- 	vector.offset(pos,  1, 1, 1),
						-- 	t.leaves or 'group:leaves', false)
						-- if counts[next(counts)] > 0 then
						local n = minetest.get_node(pointed.above)
						n.param1 = 1
						minetest.swap_node(pointed.above, n)
						-- end
					end
				end })
			end
		end
	end

	if t.sap == false then return end
	if not t.sapliq then
		t.sapliq = string.format('sorcery:sap_%s', id)
		local sapdesc = t.sap or (t.desc .. ' Tree Sap')
		sorcery.liquid.register {
................................................................................
		name = what
	else
		pos = what
		name = sorcery.lib.node.force(what).name
	end
	
	for tn, def in pairs(sorcery.data.trees) do
		if L.tbl.strmatch(def.node, name) then
			return {
				tree = tn;
				def = def;
				pos = pos;
				node = name;
			}
		end