sorcery  Check-in [a66c0f02c7]

Overview
Comment:bug fixes, improve disc texture, improve recipes, you can now pour blood directly into a trough when you draw it with a consecrated dagger
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a66c0f02c796155d2e577f316ae1cc0198a09a21e5e278e91a7d7d9d851a1aa2
User & Date: lexi on 2021-07-08 14:32:53
Other Links: manifest | tags
Context
2021-07-08
17:06
bug fixes, add disc textures, get lathe fully operational finally check-in: efb9d9d1b9 user: lexi tags: trunk
14:32
bug fixes, improve disc texture, improve recipes, you can now pour blood directly into a trough when you draw it with a consecrated dagger check-in: a66c0f02c7 user: lexi tags: trunk
13:41
commit missing texture check-in: aece454800 user: lexi tags: trunk
Changes

Modified enchanter.lua from [569b7fff67] to [c83bd974f4].

   171    171   	sorcery.enchant.strength = function(stack,id)
   172    172   		-- this functions should be used whenever you need to
   173    173   		-- determine the power of a particular enchantment on
   174    174   		-- an enchanted item.
   175    175   		local e = sorcery.enchant.get(stack)
   176    176   		local p = 0.0
   177    177   		local ct = 0
   178         -		local slots = sorcery.matreg.lookup[stack:get_name()].data.slots
          178  +		local slots = sorcery.matreg.lookup[stack:get_name()]
          179  +		if not (slots and slots.data and slots.data.slots) then return p, ct end
          180  +		slots = slots.data.slots
   179    181   		-- TODO handle strength-boosting spells!
   180    182   		for _,s in pairs(e.spells) do
   181    183   			if s.id == id then
   182    184   				p = p + ((s.boost * slots[s.slot].confluence)/10)
   183    185   				ct = ct + 1
   184    186   			end
   185    187   		end

Modified lathe.lua from [1310436767] to [f27b9cba36].

            1  +-- the math basically needs to be rewritten from scratch by someone who isn't
            2  +-- dyscalculic but 
     1      3   sorcery.lathe = {
     2      4   	techs = {
     3      5   		cut = {dmg = true};
     4      6   		intaglio = {consume = true};
     5      7   	};
     6      8   	tools = {
     7      9   		sword = 'cut', knife = 'cut', blade = 'cut';
................................................................................
    37     39   	local rec = R[wkpc:get_name()][tech][idx]
    38     40   	local outn = ItemStack(rec.output):get_count()
    39     41   	local ntimes = math.floor(howmany / (rec.mass or 1))
    40     42   	return {
    41     43   		tool = tool, wkpc = wkpc;
    42     44   		cost = rec.cost * ntimes;
    43     45   		ntimes = ntimes;
    44         -		tqty = math.floor(howmany / outn), outn = outn;
           46  +		tqty = math.floor(howmany / outn) * (rec.mass or 1), outn = outn;
    45     47   		gqty = ntimes * outn;
    46     48   		tech = tech;
    47     49   		rec = rec;
    48     50   		inv = inv;
    49     51   	}
    50     52   end
    51     53   

Modified liquid.lua from [1c87060d5d] to [1f34837a06].

   105    105   	for i = 1*f,M*f do
   106    106   		local top = L.image('sorcery_trough_top_overlay.png')
   107    107   		if liq then top = top:blit( 
   108    108   			L.image('sorcery_node_liquid.png'):multiply(L.color(liq.color))
   109    109   		) else top=top:blit(
   110    110   			L.image('sorcery_trough_bottom.png')
   111    111   		) end
   112         -		local ttlc = function(liq,i) return
   113         -			liq and string.format('%s Trough', L.str.capitalize(liq.name)),
   114         -			liq and string.format('%s of %s', liq.measure(i * Q), liq.name)
          112  +		local ttlc = function(liq,i) 
          113  +			if type(liq) == 'string' then liq = sorcery.register.liquid.db[liq] end
          114  +			return
          115  +				liq and string.format('%s Trough', L.str.capitalize(liq.name)),
          116  +				liq and string.format('%s of %s', liq.measure(i * Q), liq.name)
   115    117   		end
   116    118   		local trough_title, trough_content = ttlc(liq,i)
   117    119   		local function trough_caption(pos,i,l) 
   118    120   			local trough_title, trough_content = ttlc(l or liq,i)
   119    121   			minetest.get_meta(pos):set_string('infotext', i > 0 and string.format(
   120    122   				'%s\n(%s)', trough_title, trough_content
   121    123   			) or 'Empty Trough')
................................................................................
   168    170   					type = 'bucket';
   169    171   					hold = 'liquid';
   170    172   					has = liq and liq.id;
   171    173   					charge = liq and Q * i;
   172    174   					empty = 'sorcery:trough';
   173    175   					max = constants.bottles_per_trough * Q;
   174    176   					set_node_vol = liq and function(pos, vol)
          177  +						log.act('putting', vol, liq, 'in trough at', pos)
   175    178   						vol = math.min(M, math.max(0, math.floor(vol / Q)))
   176    179   						minetest.swap_node(pos, {name = lid(vol)})
   177    180   						trough_caption(pos, vol)
          181  +						return vol * Q
   178    182   					end;
   179    183   					set_node_liq = function(pos, liq, vol)
   180         -						log.act('adding', vol, 'to trough at', liq)
          184  +						log.act('putting', vol, liq, 'in trough at', pos)
   181    185   						vol = vol or Q * i
   182    186   						local idx = math.min(M, math.floor(vol/Q))
   183    187   						minetest.swap_node(pos, {name = trough_mkid(liq, idx)})
   184    188   						trough_caption(pos, idx, liq)
          189  +						return idx * Q
   185    190   					end
   186    191   				}
   187    192   			};
   188    193   		})
   189    194   	end
   190    195   end
   191    196   sorcery.liquid.mktrough()
          197  +
          198  +sorcery.liquid.setctr = function(pos, liq, vol, sameliq)
          199  +	local n = sorcery.lib.node.force(pos)
          200  +	if minetest.get_item_group(n.name, 'sorcery_container') ~= 2 then return false end
          201  +	local def = minetest.registered_items[n.name]._sorcery
          202  +	if not (def and def.container and def.container.set_node_liq) then
          203  +		log.err('node',n.name,'marked as liquid container but is missing container.set_node_liq callback')
          204  +		return false
          205  +	end
          206  +	if sameliq then
          207  +		if def.container.has ~= nil and def.container.has ~= liq then
          208  +			return false
          209  +		end
          210  +	end
          211  +	return def.container.set_node_liq(pos, liq, vol)
          212  +end
   192    213   
   193    214   sorcery.liquid.measure_default = sorcery.liquid.units.dram
   194    215   
   195    216   sorcery.liquid.container = function(liq, ctr)
   196    217   	return liq.containers[({
   197    218   		bottle = 'vessels:glass_bottle';
   198    219   		glass = 'vessels:drinking_glass';

Modified recipes.lua from [3fef19dac9] to [3da7013b08].

   159    159   		{'sorcery:gem_amethyst', 'sorcery:gem_amethyst', 'sorcery:gem_amethyst'};
   160    160   	};
   161    161   }
   162    162   
   163    163   minetest.register_craft {
   164    164   	output = 'sorcery:tuning_disc';
   165    165   	recipe = {
   166         -		{'sorcery:inverter_coil',ingot('silver'),''};
   167         -		{'sorcery:leyline_stabilizer','sorcery:silver_ingot','sorcery:gem_emerald'};
   168         -		{'sorcery:inverter_coil',ingot('silver'),''};
          166  +		{'','sorcery:gem_emerald',''};
          167  +		{'',mtlp('silver','disc'),''};
          168  +		{'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'};
   169    169   	};
   170    170   }
          171  +
          172  +print(dump{
          173  +	output = 'sorcery:tuning_disc';
          174  +	recipe = {
          175  +		{'','sorcery_gem:emerald',''};
          176  +		{'',mtlp('silver','disc'),''};
          177  +		{'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'};
          178  +	};
          179  +})
   171    180   
   172    181   minetest.register_craft {
   173    182   	output = 'sorcery:farcaster';
   174    183   	recipe = {
   175    184   		{ingot('gold'),ingot('iridium'),ingot('gold')};
   176    185   		{'sorcery:core_mandatic','default:diamondblock','sorcery:tuning_disc'};
   177    186   		{ingot('gold'),ingot('iridium'),ingot('gold')};
................................................................................
   437    446   },1,{
   438    447   	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
   439    448   	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
   440    449   	{'basic_materials:silver_wire', 'basic_materials:empty_spool'};
   441    450   })
   442    451   
   443    452   regtech('conduction_plate', 'Conduction Plate', {metal = 1}, {
   444         -	{'','default:copper_ingot',''};
          453  +	{'','sorcery:disc_copper',''};
   445    454   	{'','stairs:slab_stone',''};
   446    455   	{'basic_materials:copper_wire','basic_materials:steel_bar','basic_materials:copper_wire'};
   447    456   }, 1, {
   448    457   	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
   449    458   	{'basic_materials:copper_wire', 'basic_materials:empty_spool'};
   450    459   })
   451    460   

Modified textures/sorcery_disc.png from [7f739faf4d] to [3f68afb16e].

cannot compute difference between binary files

Modified tools.lua from [951d8532f1] to [950babc45d].

    15     15   
    16     16   local dagger_usefn = function(selfharm)
    17     17   	return function(stack,user,pointat)
    18     18   		if (not minetest.is_player(pointat)) and
    19     19   				selfharm == false then
    20     20   			return nil
    21     21   		end
    22         -		local trough = minetest.find_node_near(user:get_position(), 2.5, 'group:sorcery_trough', true)
           22  +		local trough = minetest.find_node_near(user:get_pos(), 2.5, 'group:sorcery_trough', true)
    23     23   		if trough then
    24     24   			local cnn = minetest.get_node(trough).name
    25     25   			local ctr = minetest.registered_nodes[cnn]._sorcery
    26     26   			if (not ctr) or not ctr.container then
    27     27   				log.err('item',cnn,'is marked as a trough, but has no _sorcery.container table')
    28     28   			else
    29     29   				ctr = ctr.container
................................................................................
    73     73   		stack:add_wear(wear)
    74     74   
    75     75   		if not trough then
    76     76   			inv:remove_item('main',btl)
    77     77   			inv:add_item('main',blood)
    78     78   		else
    79     79   			local amt = selfharm and math.random(1,2) or 2
    80         -			minetest.set_node(trough.pos, {
    81         -				name = trough.def.make(def.res*amt+ctr.charge,1):get_name()
    82         -			})
           80  +			sorcery.liquid.setctr(trough.pos, 'sorcery:blood', (trough.ctr.charge or 0) + (trough.def.res*amt), true)
    83     81   		end
    84     82   
    85     83   		target:punch(user, 1.0, caps, nil)
    86     84   		sorcery.vfx.bloodburst(pos)
    87     85   
    88     86   		if math.random(3 + sorcery.enchant.strength(stack,'sanctify') * 6) == 1 then
    89     87   			-- we've used up the consecration
................................................................................
   100     98   		end
   101     99   	end
   102    100   end
   103    101   
   104    102   
   105    103   minetest.register_tool("sorcery:dagger_consecrated", {
   106    104   	description = "Consecrated Dagger",
   107         -	inventory_image = "sorcery_dagger_consecrated.png",
          105  +	inventory_image = "sorcery_dagger_consecrated.png^sorcery_dagger_glow.png",
          106  +	wield_image = "sorcery_dagger_consecrated.png",
   108    107   	tool_capabilities = {
   109    108   		full_punch_interval = 1.6,
   110    109   		max_drop_level = 1,
   111    110   		damage_groups = { fleshy = 6 },
   112    111   	},
   113    112   	sound = { breaks = "default_tool_breaks" },
   114    113   	groups = { sorcery_sanctify = 2, sword = 1 },
   115    114   	punch_attack_uses = 16,
   116    115   	on_use = dagger_usefn(false),
   117    116   	on_secondary_use = dagger_usefn(true),
   118    117   })