sorcery  Check-in [0c88d214a8]

Overview
Comment:amulets are now made via powder intaglio
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0c88d214a8730ff78ca6f418e0e632f9004ce275c20e9d1aae00205c9674e808
User & Date: lexi on 2021-07-22 20:26:49
Other Links: manifest | tags
Context
2021-07-23
19:33
add shelter spell check-in: 65ce625814 user: lexi tags: trunk
2021-07-22
20:26
amulets are now made via powder intaglio check-in: 0c88d214a8 user: lexi tags: trunk
2021-07-14
15:42
add displacer sound effects, tweak astrolabe recipe to use new crafting items check-in: 67cefa38df user: lexi tags: trunk
Changes

Modified data/gems.lua from [bb2fee6e3c] to [003de48cde].

    53     53   			{affinity = {'cognic'}, confluence = 1};
    54     54   			{affinity = {'syncretic'}, confluence = 0.9};
    55     55   		};
    56     56   	};
    57     57   	luxite = {
    58     58   		tone = {189,255,236};
    59     59   		rarity = 130;
           60  +		hardness = 3;
    60     61   	};
    61     62   	ruby = {
    62     63   		tone = {255,94,161};
           64  +		hardness = 5;
    63     65   		rarity = 150;
    64     66   	};
    65     67   	amethyst = {
    66     68   		tone = {234,94,255};
           69  +		hardness = 6;
    67     70   		rarity = 190;
    68     71   	};
    69     72   	sapphire = {
    70     73   		tone = {94,139,255};
    71     74   		rarity = 260;
           75  +		hardness = 7;
    72     76   		wandprops = {
    73     77   			sturdiness = 0.5;
    74     78   			power = 2;
    75     79   		};
    76     80   	};
    77     81   	emerald = {
           82  +		hardness = 7;
    78     83   		tone = {133,255,94};
    79     84   		rarity = 320;
    80     85   	};
    81     86   }

Modified gems.lua from [266c01e80c] to [7d79adb54e].

   133    133   				material = {
   134    134   					gem = true, id = name, data = gem;
   135    135   					value = (5 * shards_per_gem) + 4;
   136    136   				};
   137    137   				amulet = { base = name };
   138    138   			};
   139    139   		}) 
          140  +		sorcery.lathe.register {
          141  +			input = itemname;
          142  +			output = amuletname;
          143  +			tech = 'intaglio';
          144  +			cost = 1;
          145  +		}
   140    146   		sorcery.register.metals.foreach('sorcery:mk-amulet-frames-'..name,{'sorcery:generate'}, function(metalid,metal)
   141    147   			if not metal.amulet then return end
   142    148   			local framedid = string.format("%s_frame_%s", amuletname, metalid)
   143    149   			local img_frame = img(string.format('sorcery_amulet_frame_%s.png',metalid))
   144    150   			minetest.register_craftitem(framedid, {
   145    151   				description = string.format("%s-framed %s amulet",sorcery.lib.str.capitalize(metalid), name);
   146    152   				inventory_image = img_sparkle:blit(img_frame):blit(img_stone):render();
................................................................................
   147    153   				wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
   148    154   				groups = { sorcery_amulet = 1 };
   149    155   				on_use = useamulet;
   150    156   				_sorcery = {
   151    157   					amulet = { base = name, frame = metalid };
   152    158   				};
   153    159   			})
   154         -			local frag = metal.parts.fragment
          160  +			--local frag = metal.parts.fragment
          161  +			local disc = metal.parts.disc
   155    162   			minetest.register_craft {
   156    163   				output = framedid;
   157    164   				recipe = {
   158         -					{'',  frag,''};
   159         -					{frag,amuletname,frag};
   160         -					{'',  frag,''};
          165  +					{amuletname};
          166  +					{disc};
          167  +					-- {'',  frag,''};
          168  +					-- {frag,amuletname,frag};
          169  +					-- {'',  frag,''};
   161    170   				};
   162    171   			}
   163    172   		end)
   164    173   	end
   165    174   	minetest.register_craft {
   166    175   		type = 'shapeless';
   167    176   		recipe = (minetest.get_modpath('xdecor') and {
................................................................................
   177    186   		recipe = {
   178    187   			shardname, shardname, shardname;
   179    188   			shardname, shardname, shardname;
   180    189   			shardname, shardname, shardname;
   181    190   		};
   182    191   		output = itemname;
   183    192   	};
   184         -	minetest.register_craft {
   185         -		recipe = {
   186         -			{shardname,itemname,shardname};
   187         -			{itemname,itemname,itemname};
   188         -			{shardname,itemname,shardname};
   189         -		};
   190         -		output = amuletname;
   191         -	};
          193  +-- 	minetest.register_craft {
          194  +-- 		recipe = {
          195  +-- 			{shardname,itemname,shardname};
          196  +-- 			{itemname,itemname,itemname};
          197  +-- 			{shardname,itemname,shardname};
          198  +-- 		};
          199  +-- 		output = amuletname;
          200  +-- 	};
   192    201   
   193    202   	-- generate lenses and crafting recipes
   194    203   	for _, kind in pairs { 'amplifier','rectifier','concave','convex' } do
   195    204   		local id = 'sorcery:lens_' .. kind .. '_' .. name
   196    205   		minetest.register_tool(id, {
   197    206   			inventory_image = sorcery.lib.image('sorcery_lens_overlay_gold.png'):
   198    207   				blit(sorcery.lib.image('sorcery_lens_' .. kind .. '.png'):

Modified lathe.lua from [525693d594] to [2fbf5881b5].

     1      1   -- the math basically needs to be rewritten from scratch by someone who isn't
     2      2   -- dyscalculic but 
            3  +local L = sorcery.lib
            4  +local M = function(i) return sorcery.itemclass.get(i, 'material') end
     3      5   sorcery.lathe = {
     4      6   	techs = {
     5      7   		cut = {dmg = true};
     6         -		intaglio = {consume = true};
            8  +		intaglio = {
            9  +			consume = true;
           10  +			toolpred = function(tool)
           11  +				if minetest.get_item_group(tool, 'sorcery_powder') == 0 then return false end
           12  +				local cl = sorcery.itemclass.get(tool, 'metal')
           13  +				return cl.data.hardness >= 3
           14  +			end;
           15  +			validate = function(tool, wkpc)
           16  +				return M(tool).data.hardness >= M(wkpc).data.hardness
           17  +			end;
           18  +		};
     7     19   	};
     8     20   	tools = {
     9         -		sword = 'cut', knife = 'cut', blade = 'cut';
           21  +		['group:sword'] = 'cut', ['group:knife'] = 'cut', ['group:blade'] = 'cut';
           22  +		['group:sorcery_intaglio_powder'] = 'intaglio';
    10     23   	};
    11     24   	recipes = {};
    12     25   	register = function(def)
    13     26   		local recipes = sorcery.lathe.recipes
    14     27   		if not recipes[def.input] then recipes[def.input] = {} end
    15     28   		local rs = recipes[def.input][def.tech]
    16     29   		if not rs
................................................................................
    18     31   			else rs[#rs+1] = def
    19     32   		end
    20     33   	end;
    21     34   	register_metal = function(def)
    22     35   		local parts = sorcery.data.metals[def.metal].parts
    23     36   		local out = ItemStack(def.output)
    24     37   		for _, ty in pairs {'ingot', 'block', 'fragment'} do
    25         -			local pt = parts[ty] 
           38  +			local pt = parts[ty]
    26     39   			local ptc = sorcery.itemclass.get(pt, 'metal')
    27     40   			if ptc and ptc.value then
    28     41   				if def.mass <= ptc.value then
    29     42   					local mass
    30     43   					local vfc = ptc.value / def.mass
    31     44   					if math.floor(vfc) ~= vfc then
    32     45   						for i = 1, 50 do
................................................................................
    55     68   					}
    56     69   				end
    57     70   			end
    58     71   		end
    59     72   	end;
    60     73   	tooltech = function(tool)
    61     74   		if type(tool) ~= 'string' then tool = tool:get_name() end
    62         -		for g,t in pairs(sorcery.lathe.tools) do
    63         -			if minetest.get_item_group(tool, g) ~= 0 then
           75  +		local ts = sorcery.lathe.tools
           76  +		if ts[tool] then return ts[tool] end
           77  +
           78  +		for id,t in pairs(ts) do
           79  +			local q, g = L.str.beginswith(id, 'group:')
           80  +			if q and minetest.get_item_group(tool, g) ~= 0 then
    64     81   				return t
    65     82   			end
    66     83   		end
           84  +
           85  +		for tech, t in pairs(sorcery.lathe.techs) do
           86  +			if t.toolpred then
           87  +				if t.toolpred(tool) then return tech end
           88  +			end
           89  +		end
           90  +
           91  +		return nil
    67     92   	end;
    68     93   }
    69     94   
    70     95   local R = sorcery.lathe.recipes
    71     96   sorcery.lathe.get = function(pos,idx,howmany)
    72     97   	local inv = minetest.get_meta(pos):get_inventory()
    73     98   	local tool = inv:get_stack('tool',1)
................................................................................
   216    241   
   217    242   	allow_metadata_inventory_move = function() return 0 end;
   218    243   	allow_metadata_inventory_put = function(pos, list, idx, stack, user)
   219    244   		local inv = minetest.get_meta(pos):get_inventory()
   220    245   		if list == 'tool' then
   221    246   			local s_wkpc = inv:get_stack('workpiece', 1)
   222    247   			local tech = sorcery.lathe.tooltech(stack)
          248  +			if not tech then return 0 end
          249  +			local vdtr = sorcery.lathe.techs[tech].validate
   223    250   			if tech and (s_wkpc:is_empty()
   224         -			or (R[s_wkpc:get_name()]       ~= nil and
   225         -				R[s_wkpc:get_name()][tech] ~= nil))
          251  +						or (R[s_wkpc:get_name()]       ~= nil and
          252  +							R[s_wkpc:get_name()][tech] ~= nil and
          253  +							(vdtr == nil or vdtr(stack,s_wkpc) )))
   226    254   					then return stack:get_count() end
   227    255   			for g,v in pairs(s_wkpc:get_definition().groups) do
   228    256   				local gs = R['group:'..g..'='..tostring(v)] 
   229    257   				local gg = R['group:'..g] 
   230    258   
   231    259   				if (gs and gs[tech])
   232    260   				or (gg and gg[tech]) then
   233         -					return stack:get_count()
          261  +					if vdtr == nil or vdtr(stack, s_wkpc) then
          262  +						return stack:get_count()
          263  +					end
   234    264   				end
   235    265   			end
   236    266   		elseif list == 'workpiece' then
   237    267   			local s_tool = inv:get_stack('tool', 1)
   238    268   			if R[stack:get_name()] then
   239         -				if s_tool:is_empty()
   240         -				or R[stack:get_name()][sorcery.lathe.tooltech(s_tool)]
   241         -					then return stack:get_count() end
          269  +				if s_tool:is_empty() then return stack:get_count() end
          270  +
          271  +				local tech = sorcery.lathe.tooltech(s_tool)
          272  +				if tech and R[stack:get_name()][tech] then
          273  +					local vdtr = sorcery.lathe.techs[tech].validate
          274  +					if vdtr == nil or vdtr(s_tool, stack) then
          275  +						return stack:get_count()
          276  +					end
          277  +				end
   242    278   			end
   243    279   		end
   244    280   
   245    281   		return 0
   246    282   	end;
   247    283   	allow_metadata_inventory_take = function(pos, list, idx, stack, user)
   248    284   		if list == 'preview' then

Modified lib/str.lua from [345c990ba7] to [94cda47230].

    12     12   return {
    13     13   	capitalize = function(str)
    14     14   		return string.upper(string.sub(str, 1,1)) .. string.sub(str, 2)
    15     15   	end;
    16     16   
    17     17   	beginswith = function(str,pfx)
    18     18   		if #str < #pfx then return false end
    19         -		return string.sub(str,1,#pfx) == pfx
           19  +		if string.sub(str,1,#pfx) == pfx then
           20  +			return true, string.sub(str,1 + #pfx)
           21  +		end
    20     22   	end;
    21     23   
    22     24   	endswith = function(str,sfx)
    23     25   		if #str < #sfx then return false end
    24         -		return string.sub(str,#sfx) == sfx
           26  +		if string.sub(str,#sfx) == sfx then
           27  +			return true, string.sub(str,1,#sfx)
           28  +		end
    25     29   	end;
    26     30   
    27     31   	explode = function(str,delim,pat) -- this is messy as fuck but it works so im keeping it
    28     32   		local i = 1
    29     33   		local tbl = {}
    30     34   		if pat == nil then pat = false end
    31     35   		repeat

Modified metal.lua from [f2df9bf8e4] to [b8a7748341].

    68     68   	if not metal.no_armor then for a,c in pairs(armors) do
    69     69   		sorcery.matreg.lookup[(metal.items and metal.items[a]) or ('sorcery:' .. a .. '_' .. name)] = {
    70     70   			metal = true;
    71     71   			id = name; data = metal;
    72     72   			value = c.cost * fragments_per_ingot;
    73     73   		}
    74     74   	end end
    75         -	sorcery.data.metallookup[ingot] = {
    76         -		id = name; data = metal;
    77         -		value = fragments_per_ingot;
    78         -	}
    79         -	sorcery.data.metallookup[block] = {
    80         -		id = name; data = metal;
    81         -		value = fragments_per_ingot * 9;
    82         -	}
    83         -	sorcery.data.metallookup[fragment] = {
    84         -		id = name; data = metal;
    85         -		value = 1;
    86         -	}
    87         -	sorcery.data.metallookup[disc] = {
    88         -		id = name; data = metal;
    89         -		value = 8/3;
    90         -	}
           75  +	local install = function(part,amt)
           76  +			sorcery.data.metallookup[part] = { id = name, data = metal, value = amt }
           77  +	end
           78  +	install(ingot,    fragments_per_ingot)
           79  +	install(block,    fragments_per_ingot*9)
           80  +	install(fragment, 1)
           81  +	install(powder,   1)
           82  +	install(disc,     8/3)
           83  +
    91     84   	if not metal.no_craftables then
    92         -		sorcery.data.metallookup[screw] = {
    93         -			id = name; data = metal;
    94         -			value = 0.5;
    95         -		}
           85  +		install(screw, 0.5)
    96     86   		minetest.register_craftitem(screw, {
    97     87   			description = sorcery.lib.str.capitalize(name) .. ' Screw';
    98     88   			inventory_image = sorcery.lib.image('sorcery_screw.png'):multiply(sorcery.lib.color(metal.tone)):render();
    99     89   			groups = { metal = 1; sorcery_screw = 1; sorcery_tech_component = 1; };
   100     90   			_sorcery = {
   101     91   				material = {
   102     92   					id = name, data = metal;
................................................................................
   129    119   				grindcost = 3;
   130    120   				grindvalue = 2*4;
   131    121   				value = 4 * (2/3);
   132    122   			};
   133    123   		};
   134    124   	})
   135    125   
          126  +	sorcery.lathe.register {
          127  +		input = ingot;
          128  +		output = {name = fragment; count = fragments_per_ingot};
          129  +		tech = 'cut', cost = 2;
          130  +	}
          131  +	sorcery.lathe.register {
          132  +		input = block;
          133  +		output = {name = fragment; count = fragments_per_ingot*9};
          134  +		tech = 'cut', cost = 2*7;
          135  +	}
   136    136   	sorcery.lathe.register {
   137    137   		input = ingot, mass = 2;
   138    138   		output = {name = disc, count = 3};
   139    139   		tech = 'cut', cost = 5;
   140    140   	}
   141    141   	sorcery.lathe.register {
   142    142   		input = block;
................................................................................
   144    144   		leftover = ingot;
   145    145   		tech = 'cut', cost = 5*7;
   146    146   	}
   147    147   
   148    148   	minetest.register_craftitem(powder, {
   149    149   		description = sorcery.lib.str.capitalize(name) .. ' Powder';
   150    150   		inventory_image = 'sorcery_' .. name .. '_powder.png';
          151  +		groups = {sorcery_powder = 1; powder = 1};
   151    152   	})
   152    153   	if metal.dye then
   153    154   		minetest.register_craft {
   154    155   			output = 'dye:' .. metal.dye .. ' 4';
   155    156   			recipe = {
   156    157   				{'',     powder,                   ''};
   157    158   				{powder,'basic_materials:paraffin',powder};
................................................................................
   221    222   		type = 'cooking';
   222    223   		recipe = ingot;
   223    224   		cooktime = (metal.cooktime or 4) * 0.5;
   224    225   		output = fragment .. ' ' .. tostring(fragments_per_ingot);
   225    226   	}
   226    227   	do local rec = {}
   227    228   		for i=1,fragments_per_ingot do
   228         -			rec[#rec+1]=fragment 
          229  +			rec[#rec+1]=fragment
   229    230   		end
   230    231   		minetest.register_craft {
   231    232   			type = 'shapeless';
   232    233   			recipe = rec;
   233    234   			output = ingot;
   234    235   		}
   235    236   	end

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

   376    376   
   377    377   sorcery.lathe.register_metal {
   378    378   	metal = 'aluminum';
   379    379   	output = 'sorcery:pipe';
   380    380   	tech = 'cut', cost = 8;
   381    381   	mass = 4;
   382    382   }
          383  +
          384  +sorcery.lathe.register_metal {
          385  +	metal = 'steel';
          386  +	output = 'basic_materials:steel_strip';
          387  +	tech = 'cut', cost = 2;
          388  +	mass = 0.5;
          389  +}
          390  +sorcery.lathe.register_metal {
          391  +	metal = 'copper';
          392  +	output = 'basic_materials:copper_strip';
          393  +	tech = 'cut', cost = 1;
          394  +	mass = 0.5;
          395  +}
   383    396   
   384    397   minetest.register_craft {
   385    398   	output = 'sorcery:trough';
   386    399   	recipe = {
   387    400   		{ingot 'aluminum','',ingot 'aluminum'};
   388    401   		{ingot 'aluminum','',ingot 'aluminum'};
   389    402   		{ingot 'aluminum',ingot 'aluminum',ingot 'aluminum'};
   390    403   	};
   391    404   }
   392    405   
   393    406   regtech('infuser_tube', 'Infusion Tube', {metal = 1}, {
   394    407   	{"basic_materials:copper_strip",'sorcery:infuser_concentrator', "basic_materials:copper_strip"};
   395         -	{"", "basic_materials:copper_strip", "basic_materials:gold_wire"};
   396         -	{"", "basic_materials:copper_strip", ""};
          408  +	{"", mtlp('copper','disc'), "basic_materials:gold_wire"};
          409  +	{"", 'sorcery:pipe', ""};
   397    410   }, 1, {
   398    411   	{"basic_materials:gold_wire", "basic_materials:empty_spool"}
   399    412   })
   400    413   regtech('infuser_chamber', 'Infuser Chamber', nil, {
   401    414   	{'default:clay_brick','sorcery:grease_sealant','default:clay_brick'};
   402         -	{'default:clay_brick','stairs:slab_steelblock','default:clay_brick'};
          415  +	{'default:clay_brick',mtlp('steel','disc'),'default:clay_brick'};
   403    416   }, 1, {
   404    417   	{'sorcery:grease_sealant','xdecor:bowl'};
   405    418   })
   406    419   regtech('infuser_concentrator', 'Infuser Concentrator', nil, {
   407    420   	{'basic_materials:steel_wire'};
   408    421   	{'default:obsidian_shard'};
   409    422   	{'basic_materials:copper_wire'};
................................................................................
   422    435   	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
   423    436   	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
   424    437   	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
   425    438   	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
   426    439   	{'basic_materials:gold_wire', 'basic_materials:empty_spool'};
   427    440   })
   428    441   regtech('ley_puncture', 'Ley Puncture', {metal = 1}, {
   429         -	{'default:flint','sorcery:tungsten_ingot','group:sorcery_ley_cable'};
          442  +	{'default:flint',mtlp('tungsten','disc'),'group:sorcery_ley_cable'};
   430    443   	{'','group:sorcery_ley_cable',''};
   431         -	{'group:sorcery_ley_cable','sorcery:tungsten_ingot','default:flint'};
          444  +	{'group:sorcery_ley_cable',mtlp('tungsten','disc'),'default:flint'};
   432    445   })
   433    446   regtech('pulse_rectifier', 'Pulse Rectifier', {metal = 1})
   434    447   regtech('current_felicitator', 'Current Felicitator', {metal = 1}, {
   435    448   	{'basic_materials:silver_wire','basic_materials:silver_wire','basic_materials:silver_wire'};
   436    449   	{'sorcery:cobalt_ingot','sorcery:inversion_matrix','sorcery:cobalt_ingot'};
   437    450   	{'default:bronze_ingot','sorcery:platinum_ingot','default:bronze_ingot'};
   438    451   },1,{

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

    38     38   		sorcery.lathe.register {
    39     39   			input = t.node;
    40     40   			tech = 'cut';
    41     41   			output = 'default:stick 18';
    42     42   			cost = 1;
    43     43   		}
    44     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         -					}
           45  +		for _, n in pairs(nodes) do
           46  +			if minetest.registered_items[n] then
           47  +				sorcery.lathe.register {
           48  +					input = n, tech = 'cut';
           49  +					output = 'xdecor:table 2';
           50  +					cost = 2;
           51  +				}
           52  +				if t.lathe then
           53  +					for tech, items in pairs(t.lathe) do
           54  +					for _, i        in pairs(items)   do
           55  +						if minetest.registered_items[i[1]] then
           56  +							sorcery.lathe.register {
           57  +								input = n;
           58  +								tech = tech;
           59  +								output = {
           60  +									name = i[1];
           61  +									count = i[2];
           62  +								};
           63  +								cost = i[3];
           64  +							}
           65  +						end
           66  +					end end
    59     67   				end
    60         -			end end
    61         -		end end
           68  +			end
           69  +		end
    62     70   	end
    63     71   
    64     72   	if t.sap == false then return end
    65     73   	if not t.sapliq then
    66     74   		t.sapliq = string.format('sorcery:sap_%s', id)
    67     75   		local sapdesc = t.sap or (t.desc .. ' Tree Sap')
    68     76   		sorcery.liquid.register {