sorcery  Diff

Differences From Artifact [95c6839cbe]:

To Artifact [e171bc2182]:


16
17
18
19
20
21
22
23
24
25
26
27
28
29


30
31
32
33
34
35
36
37
	-- 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
					minetest.get_meta(pos):set_int('sorcery:trunk_node_role', 1)


				end
			end
		end })
	end

	if t.sap == false then return end
	if not t.sapliq then
		t.sapliq = string.format('sorcery:sap_%s', id)







|
|
|
|
|
|
|
>
>
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	-- 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)