sorcery  Diff

Differences From Artifact [7144dd8474]:

To Artifact [b1f018643d]:

  • File lib/node.lua — part of check-in [96c5289a2a] at 2020-10-21 03:35:35 on branch trunk — add rune forges, runes, amulet frames, write sacrifice spell, touch up amulet graphics, enable enchantment of amulets (though spells cannot yet be cast), defuckulate syncresis core icon, unfuckitize sneaky leycalc bug that's probably been the cause of some long-standing wackiness, add item classes, add some more textures, disbungle various other asstastrophes, remove sneaky old debug code, improve library code, add utility for uploading merge requests (user: lexi, size: 4220) [annotate] [blame] [check-ins using]

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
65
66
67
68
69
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
		{x =  0, y =  0, z = -1};
	};
}

ofs.adjoining = sorcery.lib.tbl.append(sorcery.lib.tbl.append(
	ofs.neighbors,ofs.planecorners),ofs.cubecorners)

return {
	offsets = ofs;
	purge_container = function(pos,node,meta,user)
		local offset = function(pos,range)
			local r = function(min,max)
				return (math.random() * (max - min)) + min
			end
			return {
				x = pos.x + r(0 - range, range);
				y = pos.y;
				z = pos.z + r(0 - range, range);
			}
		end
		for name, inv in pairs(meta.inventory) do

			for _, item in pairs(inv) do
				if not item:is_empty() then
					minetest.add_item(offset(pos,0.4), item)
				end
			end

		end






	end;


	amass = function(startpoint,names,directions)
		if not directions then directions = ofs.neighbors end
		local nodes, positions, checked = {},{},{}
		local checkedp = function(pos)
			for _,v in pairs(checked) do
				if vector.equals(pos,v) then return true end
................................................................................
		minetest.load_area(pos)
		return minetest.get_node(pos)
	end;

	-- when items have already been removed; notify cannot be relied on
	-- to reach the entire network; this function accounts for the gap
	notifyneighbors = function(pos)
		sorcery.lib.node.forneighbor(pos, sorcery.ley.txofs, function(pos,node)
			if minetest.get_item_group(node.name,'sorcery_ley_device') ~= 0 then
				sorcery.ley.notify(sum)
			end
		end)
	end;

	blockpos = function(pos)







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







 







|







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
65
66
67
68
69
70
71
72
73
74
75
76
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
		{x =  0, y =  0, z = -1};
	};
}

ofs.adjoining = sorcery.lib.tbl.append(sorcery.lib.tbl.append(
	ofs.neighbors,ofs.planecorners),ofs.cubecorners)



local purge_container = function(only, pos,node,meta,user)
	local offset = function(pos,range)
		local r = function(min,max)
			return (math.random() * (max - min)) + min
		end
		return {
			x = pos.x + r(0 - range, range);
			y = pos.y;
			z = pos.z + r(0 - range, range);
		}
	end
	for name, inv in pairs(meta.inventory) do
		if only and not sorcery.lib.tbl.has(only,name) then goto skip end
		for _, item in pairs(inv) do
			if not item:is_empty() then
				minetest.add_item(offset(pos,0.4), item)
			end
		end
	::skip::end
end;
return {
	offsets = ofs;
	purge_container = function(...) return purge_container(nil, ...) end;
	purge_only = function(lst)
		return function(...)
			return purge_container(lst, ...)
		end
	end; 

	amass = function(startpoint,names,directions)
		if not directions then directions = ofs.neighbors end
		local nodes, positions, checked = {},{},{}
		local checkedp = function(pos)
			for _,v in pairs(checked) do
				if vector.equals(pos,v) then return true end
................................................................................
		minetest.load_area(pos)
		return minetest.get_node(pos)
	end;

	-- when items have already been removed; notify cannot be relied on
	-- to reach the entire network; this function accounts for the gap
	notifyneighbors = function(pos)
		sorcery.lib.node.forneighbor(pos, sorcery.ley.txofs, function(sum,node)
			if minetest.get_item_group(node.name,'sorcery_ley_device') ~= 0 then
				sorcery.ley.notify(sum)
			end
		end)
	end;

	blockpos = function(pos)