sorcery  Check-in [56a2b90c1b]

Overview
Comment:add tree lathe recipes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 56a2b90c1b48667634abbd166e9b57964f6c0318ca0a88be1740f410a3322adc
User & Date: lexi on 2021-07-08 21:52:42
Other Links: manifest | tags
Context
2021-07-08
23:14
add lathe recipes, bugfixes check-in: 669078947d user: lexi tags: trunk
21:52
add tree lathe recipes check-in: 56a2b90c1b user: lexi tags: trunk
17:06
bug fixes, add disc textures, get lathe fully operational finally check-in: efb9d9d1b9 user: lexi tags: trunk
Changes

Modified data/gems.lua from [4d559c7735] to [bb2fee6e3c].

    21     21   		foreign = 'default:diamond';
    22     22   		tone = {137,240,255};
    23     23   		items = default_items('diamond');
    24     24   		tools = true, armor = true;
    25     25   		maxenergy = 2000;
    26     26   		hardness = 8;
    27     27   		randomfind = false;
           28  +		level = 1;
           29  +		maxlevel = 2;
    28     30   		wandprops = {
    29     31   			sturdiness = (1/3);
    30     32   		};
    31     33   		slots = {
    32     34   			{affinity = {'praxic','counterpraxic'}, confluence = 1};
    33     35   			{affinity = {'praxic','syncretic'}, confluence = 0.6};
    34     36   			{affinity = {'counterpraxic', 'entropic'}, confluence = 0.7};
................................................................................
    36     38   	};
    37     39   	mese = {
    38     40   		foreign = 'default:mese_crystal';
    39     41   		foreign_shard = 'default:mese_crystal_fragment';
    40     42   		tone = {255,253,94};
    41     43   		energysource = 5;
    42     44   		hardness = 6;
           45  +		level = 1;
    43     46   		maxenergy = 600;
    44     47   		items = default_items('mese');
    45     48   		tools = true, armor = true;
    46     49   		randomfind = false;
    47     50   		slots = {
    48     51   			{affinity = {'praxic'}, confluence = 1};
    49     52   			{affinity = {'praxic'}, confluence = 0.5};

Modified data/metals.lua from [81e12129e0] to [eba257a7d6].

    64     64   		items = default_items('bronze');
    65     65   		hardness = 4;
    66     66   		durability = 350;
    67     67   		maxenergy = 150;
    68     68   		sharpness = 1;
    69     69   		speed = 1.4;
    70     70   		level = 0;
           71  +		maxlevel = 1;
    71     72   		slots = {
    72     73   			{affinity = {'counterpraxic'}; confluence = 0.7};
    73     74   		};
    74     75   		mix = {
    75     76   			metals = {
    76     77   				copper = 4;
    77     78   				tin = 1;

Modified data/trees.lua from [33057bf9f3] to [1a5929f3d1].

     8      8   	apple = {
     9      9   		desc = 'Apple';
    10     10   		node = 'default:tree';
    11     11   		sapling = 'default:sapling';
    12     12   		leaves = 'default:leaves';
    13     13   		sap = 'Apple Syrup';
    14     14   		sapcolor = {218, 238, 66};
           15  +		lathe = {
           16  +			cut = {
           17  +				{'default:fence_wood', 5, 2};
           18  +				{'default:fence_rail_wood', 20, 2};
           19  +			};
           20  +		}
    15     21   	};
    16     22   	pine = {
    17     23   		desc = 'Pine';
    18     24   		node = 'default:pine_tree';
           25  +		plank = 'default:pine_wood';
    19     26   		sapling = 'default:pine_sapling';
    20     27   		leaves = 'default:pine_needles';
    21     28   		sap = 'Pine Resin';
    22     29   		color = {95, 64, 57};
           30  +		lathe = {
           31  +			cut = {
           32  +				{'default:fence_pine_wood', 5, 2};
           33  +				{'default:fence_rail_pine_wood', 20, 2};
           34  +			};
           35  +		};
    23     36   	};
    24     37   	aspen = {
    25     38   		desc = 'Aspen';
    26     39   		node = 'default:aspen_tree';
           40  +		plank = 'default:aspen_wood';
    27     41   		sapling = 'default:aspen_sapling';
    28     42   		sap = 'Aspen Sap';
    29     43   		leaves = 'default:aspen_leaves';
    30     44   		color = {255, 251, 172};
    31     45   		imgvariant = 'dull';
           46  +		lathe = {
           47  +			cut = {
           48  +				{'default:fence_aspen_wood', 5, 2};
           49  +				{'default:fence_rail_aspen_wood', 20, 2};
           50  +			};
           51  +		};
    32     52   	};
    33     53   	acacia = {
    34     54   		desc = 'Acacia';
    35     55   		node = 'default:acacia_tree';
           56  +		plank = 'default:acacia_wood';
    36     57   		sapling = 'default:acacia_sapling';
    37     58   		leaves = 'default:acacia_leaves';
    38     59   		sap = 'Acacia Sap';
    39     60   		color = {217, 51, 22};
    40     61   		sapglow = 7;
           62  +		lathe = {
           63  +			cut = {
           64  +				{'default:fence_acacia_wood', 5, 2};
           65  +				{'default:fence_rail_acacia_wood', 20, 2};
           66  +			};
           67  +		};
    41     68   	};
    42     69   	jungle = {
    43     70   		desc = 'Jungle';
    44     71   		node = {
    45     72   			'default:jungletree';
    46     73   			'moretrees:jungletree_trunk';
    47     74   		};
           75  +		plank = 'default:junglewood';
    48     76   		sapling = 'default:junglesapling';
    49     77   		leaves = 'default:jungleleaves';
    50     78   		sap = 'Tropical Syrup';
    51     79   		color = {86, 39, 71};
    52     80   		imgvariant = 'dull';
           81  +		lathe = {
           82  +			cut = {
           83  +				{'default:fence_junglewood', 5, 2};
           84  +				{'default:fence_rail_junglewood', 20, 2};
           85  +			};
           86  +		};
    53     87   	};
    54     88   }

Modified gems.lua from [68440cd05e] to [266c01e80c].

    48     48   							{'',itemname,''};
    49     49   						};
    50     50   					}
    51     51   				};
    52     52   			};
    53     53   		})
    54     54   	end
           55  +	gem.durability = gem.durability or (gem.hardness or 1) * 100
    55     56   	if not gem.foreign_amulet then
    56     57   		local img = sorcery.lib.image
    57     58   		local img_stone = img('sorcery_amulet.png'):multiply(sorcery.lib.color(gem.tone))
    58     59   		local img_sparkle = img('sorcery_amulet_sparkle.png')
    59     60   		local useamulet = function(stack,user,target)
    60     61   			local sp = sorcery.amulet.getspell(stack)
    61     62   			if not sp or not sp.cast then return nil end

Modified init.lua from [eeaa9926dc] to [7aae623fb9].

   164    164   	end
   165    165   	sorcery.registry.mk('residue',false)
   166    166   end
   167    167   
   168    168   sorcery.stage('startup',data)
   169    169   for _,u in pairs {
   170    170   	'global'; 'vfx'; 'context'; 'attunement'; 'itemclass'; 'craft'; 'spell';
   171         -	'liquid'; 'tree'; 'potions'; 'lathe'; 'metal', 'gems'; 'leylines';
          171  +	'liquid'; 'potions'; 'lathe'; 'tree'; 'metal', 'gems'; 'leylines';
   172    172   	'infuser'; 'altar'; 'wands'; 'tools', 'crafttools';
   173    173   	'enchanter'; 'harvester'; 'metallurgy-hot', 'metallurgy-cold';
   174    174   	'entities'; 'recipes'; 'coins'; 'interop';
   175    175   	'tnodes'; 'forcefield'; 'farcaster'; 'portal';
   176    176   	'cookbook', 'writing'; 'disassembly'; 'displacer';
   177    177   	'gravitator'; 'precipitator'; 'calendar', 'astrolabe';
   178    178   	'keypunch'; 'runeforge'; 'keg'; 'tap';
   179    179   
   180    180   	'privs', 'admin';
   181    181   } do sorcery.load(u) end
   182    182   sorcery.stage('finalize')
   183    183   
   184    184   sorcery.registry.defercheck()

Modified lathe.lua from [75f9e0d88f] to [525693d594].

    13     13   		local recipes = sorcery.lathe.recipes
    14     14   		if not recipes[def.input] then recipes[def.input] = {} end
    15     15   		local rs = recipes[def.input][def.tech]
    16     16   		if not rs
    17     17   			then recipes[def.input][def.tech] = { def }
    18     18   			else rs[#rs+1] = def
    19     19   		end
           20  +	end;
           21  +	register_metal = function(def)
           22  +		local parts = sorcery.data.metals[def.metal].parts
           23  +		local out = ItemStack(def.output)
           24  +		for _, ty in pairs {'ingot', 'block', 'fragment'} do
           25  +			local pt = parts[ty] 
           26  +			local ptc = sorcery.itemclass.get(pt, 'metal')
           27  +			if ptc and ptc.value then
           28  +				if def.mass <= ptc.value then
           29  +					local mass
           30  +					local vfc = ptc.value / def.mass
           31  +					if math.floor(vfc) ~= vfc then
           32  +						for i = 1, 50 do
           33  +							local v = vfc * i
           34  +							if math.floor(v) == v then
           35  +								mass = i
           36  +								vfc = v
           37  +								break
           38  +							end
           39  +						end
           40  +					else
           41  +						mass = 1
           42  +					end
           43  +					if not mass then
           44  +						log.err('tried to register a lathe metal recipe for',def.output,'but the mass ratio',vfc,'for part',ty,'has too many digits to the right of the decimal place')
           45  +						return false
           46  +					end
           47  +					sorcery.lathe.register {
           48  +						input = pt, mass = mass;
           49  +						tech = def.tech, cost = def.cost;
           50  +						output = {
           51  +							name = out:get_name();
           52  +							count = out:get_count() * vfc;
           53  +						};
           54  +						leftover = def.leftover;
           55  +					}
           56  +				end
           57  +			end
           58  +		end
    20     59   	end;
    21     60   	tooltech = function(tool)
    22     61   		if type(tool) ~= 'string' then tool = tool:get_name() end
    23     62   		for g,t in pairs(sorcery.lathe.tools) do
    24     63   			if minetest.get_item_group(tool, g) ~= 0 then
    25     64   				return t
    26     65   			end
................................................................................
    46     85   	local lfac = 1
    47     86   	if tmat then
    48     87   		local dur = tmat.data.durability or dur
    49     88   		lfac = (wmat and wmat.data.level or 1) /
    50     89   			(tmat.data.maxlevel or tmat.data.level or 1)
    51     90   	end
    52     91   	local ch = 65535 / dur
    53         -	local wear = 2 * (ch * rec.cost * ntimes * lfac);
           92  +	local wear = (ch * rec.cost * ntimes * lfac)
    54     93   	return {
    55     94   		tool = tool, wkpc = wkpc;
    56     95   		cost = rec.cost * ntimes;
    57     96   		wear = wear;
    58     97   		ntimes = ntimes;
    59     98   		tqty = ntimes * (rec.mass or 1), outn = outn;
    60     99   		tech = tech;
................................................................................
    81    120   	-- obey level restrictions. TODO honor Rend
    82    121   	if (wmat and wmat.data.level or 0) > (tmat and (tmat.data.maxlevel or tmat.data.level) or 0) then
    83    122   		return
    84    123   	end
    85    124   	
    86    125   	local tech = sorcery.lathe.tooltech(tool)
    87    126   	local rec = R[wkpc:get_name()][tech]
          127  +	if not rec then
          128  +		for g,v in pairs(s_wkpc:get_definition().groups) do
          129  +			local gs = R['group:'..g..'='..tostring(v)] 
          130  +			local gg = R['group:'..g] 
          131  +
          132  +			rec = (gs and gs[tech]) or (gg and gg[tech])
          133  +		end
          134  +	end
    88    135   	tech = sorcery.lathe.techs[tech]
    89    136   
    90    137   	-- fill in the preview slots
    91    138   	local j = 1
    92    139   	for i=1, inv:get_size 'preview'  do
    93    140   		local stk = ItemStack()
    94    141   		local os = rec[i] and ItemStack(rec[i].output)
................................................................................
   152    199   		local i = m:get_inventory()
   153    200   		i:set_size('workpiece', 1);
   154    201   		i:set_size('tool', 1);
   155    202   		i:set_size('preview', 8);
   156    203   		m:set_string('formspec', [[
   157    204   			formspec_version[3] size[10.25,8]
   158    205   			list[context;tool;1.25,1;1,1]
   159         -			list[context;workpiece;2.75,1;1,1]
          206  +			list[context;workpiece;3,1;1,1]
   160    207   			list[context;preview;5.25,0.25;4,2]
   161    208   			list[current_player;main;0.25,3;8,4]
   162    209   
   163    210   			listring[current_player;main] listring[context;workpiece]
   164    211   			listring[current_player;main] listring[context;tool]
   165    212   			listring[current_player;main] listring[context;preview]
   166    213   			listring[current_player;main]
................................................................................
   173    220   		if list == 'tool' then
   174    221   			local s_wkpc = inv:get_stack('workpiece', 1)
   175    222   			local tech = sorcery.lathe.tooltech(stack)
   176    223   			if tech and (s_wkpc:is_empty()
   177    224   			or (R[s_wkpc:get_name()]       ~= nil and
   178    225   				R[s_wkpc:get_name()][tech] ~= nil))
   179    226   					then return stack:get_count() end
          227  +			for g,v in pairs(s_wkpc:get_definition().groups) do
          228  +				local gs = R['group:'..g..'='..tostring(v)] 
          229  +				local gg = R['group:'..g] 
          230  +
          231  +				if (gs and gs[tech])
          232  +				or (gg and gg[tech]) then
          233  +					return stack:get_count()
          234  +				end
          235  +			end
   180    236   		elseif list == 'workpiece' then
   181    237   			local s_tool = inv:get_stack('tool', 1)
   182    238   			if R[stack:get_name()] then
   183    239   				if s_tool:is_empty()
   184    240   				or R[stack:get_name()][sorcery.lathe.tooltech(s_tool)]
   185    241   					then return stack:get_count() end
   186    242   			end

Modified recipes.lua from [f4ffdfcd69] to [7b05938d1e].

   370    370   regtech('valve','Valve', {metal = 1}, {
   371    371   	{'','default:bronze_ingot',''};
   372    372   	{'basic_materials:plastic_sheet','basic_materials:steel_bar','basic_materials:plastic_sheet'};
   373    373   	{'','default:bronze_ingot',''};
   374    374   },3,nil, mprop('bronze',2*4,1,2*4))
   375    375   regtech('pipe','Pipe', {metal = 1},nil, nil, nil, mprop('aluminum', 4))
   376    376   
   377         -sorcery.lathe.register {
   378         -	input = ingot('aluminum');
          377  +sorcery.lathe.register_metal {
          378  +	metal = 'aluminum';
   379    379   	output = 'sorcery:pipe';
   380    380   	tech = 'cut', cost = 8;
          381  +	mass = 4;
   381    382   }
   382    383   
   383    384   minetest.register_craft {
   384    385   	output = 'sorcery:trough';
   385    386   	recipe = {
   386         -		{ingot('aluminum'),'',ingot('aluminum')};
   387         -		{ingot('aluminum'),'',ingot('aluminum')};
   388         -		{ingot('aluminum'),ingot('aluminum'),ingot('aluminum')};
          387  +		{ingot 'aluminum','',ingot 'aluminum'};
          388  +		{ingot 'aluminum','',ingot 'aluminum'};
          389  +		{ingot 'aluminum',ingot 'aluminum',ingot 'aluminum'};
   389    390   	};
   390    391   }
   391    392   
   392    393   regtech('infuser_tube', 'Infusion Tube', {metal = 1}, {
   393    394   	{"basic_materials:copper_strip",'sorcery:infuser_concentrator', "basic_materials:copper_strip"};
   394    395   	{"", "basic_materials:copper_strip", "basic_materials:gold_wire"};
   395    396   	{"", "basic_materials:copper_strip", ""};
................................................................................
   788    789   for n,v in pairs(sorcery.data.greases) do
   789    790   	if (v.core and #v.core > 0) or (v.mix and #v.mix > 0) then
   790    791   		local id = 'sorcery:grease_' .. n
   791    792   		potion_auto_recipe(id,v,{'farming:mixing_bowl'},'xdecor:bowl')
   792    793   	end
   793    794   end
   794    795   
   795         -sorcery.lathe.register {
   796         -	output = 'basic_materials:steel_bar 2';
   797         -	input = 'default:steel_ingot';
          796  +sorcery.lathe.register_metal {
          797  +	metal = 'steel';
          798  +	output = 'basic_materials:steel_bar';
   798    799   	tech = 'cut', cost = 3;
   799         -}
   800         -sorcery.lathe.register {
   801         -	output = 'basic_materials:steel_bar 18';
   802         -	input = 'default:steelblock';
   803         -	tech = 'cut', cost = 3*9;
   804         -}
   805         -sorcery.lathe.register {
   806         -	output = 'basic_materials:steel_bar';
   807         -	input = 'default:steel_fragment', mass = 2;
   808         -	tech = 'cut', cost = 2;
          800  +	mass = 2;
   809    801   }

Modified sorcery.md from [9b54d0ccbf] to [1bb9279edd].

    44     44    * extracts can be crafted using crushed excess seeds and alcohol
    45     45    * oils, greases, and other substances can be crafted by mixing together various ingredients, including extracts
    46     46    * magical elixirs can be made by infusing oils and the like into bottles of water at an **Infuser**, and can be drunk to gain temporary powers
    47     47    * liquids can be carried around in buckets, bottles, and glasses, depending on the liquid.
    48     48    * kegs can store large volumes of liquid, making for easy retrieval when you, say, need a specific extract or potion to brew an elixir
    49     49    * troughs can be used to gather liquid from nature. set out under the open sky, for instance, they will slowly collect rainwater (depending on the biome). they have twice the volume of buckets.
    50     50    * taps can be attached to trees to extract saps, syrups, and resins from under the bark; these can be caught by placing a trough below. you can then fill bottles from the trough, or simply pick the whole trough up and bring it home to deposit the liquid in a keg for later use.
           51  + * you can build a lathe for complex metal- and woodworking, to build things like pipes, screws, discs, and fenceposts.
    51     52    * wands, made at an **Wandworking Station** out of a wood, gems, bands, and cores, can be enchanted by soaking them in philters, special potions used for imbuing wood with ley-force (though i'm trying to come up with a better mechanism). these fire off powerful spells with a flick of the wrist, but will break when they run out of power (unless you recharge them…)
    52         - * if you want to get into advanced arcanism, you can build an **Enchanter**. equipped with the proper wands, this powerful artifact can be used to imbue tools with useful supernatural properties, though what enchantments are available and how much ley-charge a tool can hold depend on what metal the tool is made of. but Enchanters can be used for more subtle purposes as well. with the right ingredients and a **Divination Wand**, you can conjure up recipes for delicacies or schematics for powerful magitech devices you never imagined were possible. **Melding Wands** can merge the mystic essences of items on an Enchanter to create something new, including some things that can't be made any other way, though the stars may need to be right (an **Astrolabe** can help you check) for certain recipes to work, and some may come down to plain old luck. **Division Wands** are very similar, but work the other way around.
           53  + * if you want to get into advanced arcanism, you can build an **Enchanter**. if you have the proper wands with the proper wands, this powerful artifact can be used to imbue tools with useful supernatural properties, though what enchantments are available and how much ley-charge a tool can hold depend on what metal the tool is made of. but Enchanters can be used for more subtle purposes as well. with the right ingredients and a **Divination Wand**, you can conjure up recipes for delicacies or schematics for powerful magitech devices you never imagined were possible. **Melding Wands** can merge the mystic essences of items on an Enchanter to create something new, including some things that can't be made any other way, though the stars may need to be right (an **Astrolabe** can help you check) for certain recipes to work, and some may come down to plain old luck. **Division Wands** are very similar, but work the other way around.
           54  + * if you do a wide variety of things with your enchanter, you may want to build a **Wand Rack** in your lab, otherwise a **Wand Stand** or two will probably be good enough.
    53     55    * you can also build a **Disassembly Kit**, which you can use with pen, ink, and paper to create schematics for any object you come across that you want to be able to craft yourself.
    54     56    * you can collect your assorted recipes into cookbooks, and you can build yourself a **Writing Stand** to insert, delete, re-order, or (if you have some Scissors handy) cut out parts of the book.
    55     57    * you can make a **Mill** for grinding up solid materials into powder or pulp. it makes flour from grain more efficiently than a mortar and pestle, can produce various metal powders of great utility, and can reduce books, paper, and punchcards down to a pulp, suitable for cleaning with **Erasure Fluid** and cooking back into clean paper. but you'll need some way to power it. a **Generator** will produce plenty of energy in a pinch, but it may be more rewarding to build yourself a real power grid, carrying current from place to place using cables (**Vidrium Cables** are sufficient for homes and studios, but industrial facilities may need **Iridium Cables** or the even more conductive **Conduit**). **Mese Blocks** always emit a small but constant amount of ley-current, but if you're near a strong leyline, building **Condenser**s to harvest its power will be much more efficient. (**Leyspark Wand**s are crucial tools for testing the source and affinity of the ambient leyscape.)
    56     58    * some new alloys can be made by sintering metal powders; others need to be melted down in a **Smelter**. these alloys have the most remarkable properties of any metal, and are especially valued by toolsmiths and enchanters, though they may be less broadly useful than the lesser metals.
    57     59    * if you need to travel quickly between two distant places, and you're wealthy enough to afford it, you can build yourself one of the most powerful and complex of magitech devices — the **Teleporter**. it's no mean feat: even the smallest teleporter requires a teleport pad with a reflector above it and a portal node connected to one or the other. the teleporter will then need to be connected to its destination with cables or conduits, and if where you're travelling is very far away, you'll have to build two separate ley nets and bridge them by using an **Attunement Wand** on a pair of **Raycasters** — or perhaps even **Farcasters**. the power required to operate all of these devices is not trivial, and while a Farcaster's signal can pierce through any substance and cross any distance to reach its destination, the farther away each is from the other, the more power each side will consume. and casters can't send current, they can only send signals, so you may need a sizable power plant on both sides of the portal.
    58     60    * if all you need to do is send small items, of course, a **Displacer** is much cheaper, and more flexible. if you're feeling particularly ambitious, you could use a Displacer net to connect your whole kingdom with instantaneous package service.
    59     61    * stop your foes in their tracks by flipping a switch to turn on your **Force Field Emitters**, generating an impenetrable barrier wherever they aim.

Modified tree.lua from [e98976a563] to [26f773677c].

    30     30   						n.param1 = 1
    31     31   						minetest.swap_node(pointed.above, n)
    32     32   						-- end
    33     33   					end
    34     34   				end })
    35     35   			end
    36     36   		end
           37  +
           38  +		sorcery.lathe.register {
           39  +			input = t.node;
           40  +			tech = 'cut';
           41  +			output = 'default:stick 18';
           42  +			cost = 1;
           43  +		}
           44  +
           45  +		if t.lathe then for tech, items in pairs(t.lathe) do
           46  +			for _, i in pairs(items) do
           47  +			for _, n in pairs(nodes) do
           48  +				if  minetest.registered_items[n]
           49  +				and minetest.registered_items[i[1]] then
           50  +					sorcery.lathe.register {
           51  +						input = n;
           52  +						tech = tech;
           53  +						output = {
           54  +							name = i[1];
           55  +							count = i[2];
           56  +						};
           57  +						cost = i[3];
           58  +					}
           59  +				end
           60  +			end end
           61  +		end end
    37     62   	end
    38     63   
    39     64   	if t.sap == false then return end
    40     65   	if not t.sapliq then
    41     66   		t.sapliq = string.format('sorcery:sap_%s', id)
    42     67   		local sapdesc = t.sap or (t.desc .. ' Tree Sap')
    43     68   		sorcery.liquid.register {