sorcery  Diff

Differences From Artifact [5131b0247b]:

To Artifact [5366481e82]:

  • File disassembly.lua — part of check-in [72eebac4bc] at 2020-09-26 18:49:51 on branch trunk — add writing stand for editing codexes; add scissors, ink, erasure fluid, pens; touch up codex UI; add many recipe notes; add craft divination type for crafttools; defuckulate fucktarded crafttool impl; enhance table library with missing features like lua's table.unpack; many bug fixes and enhancements; blood for the blood god (user: lexi, size: 4258) [annotate] [blame] [check-ins using]

43
44
45
46
47
48
49





50
51
52
53
54
55
56
..
63
64
65
66
67
68
69

70
71
72

73
74
75
76
77
78
79
80
81
82
83







84





85







86
87
88
89
90
91
92
	tiles = {
		'default_copper_block.png';
		'default_wood.png';
		'default_steel_block.png';
		'default_stone.png';
		'default_gold_block.png';
		'default_coal_block.png';





	};
	after_dig_node = sorcery.lib.node.purge_container;
	on_construct = function(pos)
		local m = minetest.get_meta(pos)
		local i = m:get_inventory()
		i:set_size('item',1)
		i:set_size('paper',1)
................................................................................
			list[current_player;main;0.25,2;8,4]

			list[context;item;0.25,0.5;1,1;]
			list[context;paper;2.25,0.5;1,1;]
			list[context;ink;4.25,0.5;3,1;]
			list[context;output;9,0.5;1,1;]


			listring[current_player;main] listring[context;item]
			listring[current_player;main] listring[context;paper]
			listring[current_player;main] listring[context;ink]

		]])
	end;
	on_metadata_inventory_put = update_disassembler;
	on_metadata_inventory_take = function(pos,list,idx,stack,user)
		local m = minetest.get_meta(pos)
		local i = m:get_inventory()
		local paper = i:get_stack('paper',1)
		local item = i:get_stack('item',1)

		if list == 'output' then
			local count = stack:get_count()







			item:take_item(count)





			i:set_stack('item',1,item)







			for j=1,i:get_size('ink') do
				local ink = i:get_stack('ink',j)
				ink:take_item(count)
				i:set_stack('ink',j,ink)
			end
		end








>
>
>
>
>







 







>
|
|
|
>











>
>
>
>
>
>
>

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







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	tiles = {
		'default_copper_block.png';
		'default_wood.png';
		'default_steel_block.png';
		'default_stone.png';
		'default_gold_block.png';
		'default_coal_block.png';
	};
	_sorcery = {
		recipe = {
			note = 'Destroy a device or object to learn how it is crafted';
		};
	};
	after_dig_node = sorcery.lib.node.purge_container;
	on_construct = function(pos)
		local m = minetest.get_meta(pos)
		local i = m:get_inventory()
		i:set_size('item',1)
		i:set_size('paper',1)
................................................................................
			list[current_player;main;0.25,2;8,4]

			list[context;item;0.25,0.5;1,1;]
			list[context;paper;2.25,0.5;1,1;]
			list[context;ink;4.25,0.5;3,1;]
			list[context;output;9,0.5;1,1;]

			listring[context;output]
			listring[current_player;main] listring[context;paper]
			listring[current_player;main] listring[context;ink]
			listring[current_player;main] listring[context;item]
			listring[current_player;main]
		]])
	end;
	on_metadata_inventory_put = update_disassembler;
	on_metadata_inventory_take = function(pos,list,idx,stack,user)
		local m = minetest.get_meta(pos)
		local i = m:get_inventory()
		local paper = i:get_stack('paper',1)
		local item = i:get_stack('item',1)

		if list == 'output' then
			local count = stack:get_count()
			local leftover = sorcery.data.infusion_leftovers[item:get_name()]
			local lstack if leftover then
				lstack = ItemStack(leftover)
				lstack:set_count(lstack:get_count() * count)
				-- this slightly idiosyncratic code is used to ensure that
				-- itemstrings can be used in the infusion leftovers table
			end
			item:take_item(count)
			if item:get_count() > 0 then
				if leftover then
					lstack = user:get_inventory():add_item(lstack)
					if lstack:get_count() > 0 then minetest.add_item(pos,lstack) end
				end
				i:set_stack('item',1,item)
			else
				if leftover then
					i:set_stack('item',1,lstack)
				else
					i:set_stack('item',1,ItemStack())
				end
			end
			for j=1,i:get_size('ink') do
				local ink = i:get_stack('ink',j)
				ink:take_item(count)
				i:set_stack('ink',j,ink)
			end
		end