sorcery  Diff

Differences From Artifact [b98b74d4f6]:

  • File tools.lua — part of check-in [ea6e475e44] at 2020-10-19 09:52:11 on branch trunk — continue dev on celestial mechanics, add melding+division spells (resonance), refine itemclasses, add keypunch and punchcards, add paper pulp, add a shitload of visuals, add convenience scripts for working with the wiki, make the flamebolt spell actually useful instead of just a pretty lightshow, add essences, inferno crystal, and other goodies; iterate on wands, lots of shit i can't remember, various bugfixes (user: lexi, size: 2259) [annotate] [blame] [check-ins using]

To Artifact [951d8532f1]:


     1      1   local dagger_uses = 16
     2         -
            2  +local log = sorcery.logger('tools')
     3      3   minetest.register_tool("sorcery:dagger", {
     4      4   	description = "Sacrificial Dagger",
     5      5   	inventory_image = "sorcery_dagger.png",
     6      6   	tool_capabilities = {
     7      7   		full_punch_interval = 1.6,
     8      8   		max_drop_level = 1,
     9      9   		damage_groups = { fleshy = 2 },
................................................................................
    14     14   })
    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  +		end
           22  +		local trough = minetest.find_node_near(user:get_position(), 2.5, 'group:sorcery_trough', true)
           23  +		if trough then
           24  +			local cnn = minetest.get_node(trough).name
           25  +			local ctr = minetest.registered_nodes[cnn]._sorcery
           26  +			if (not ctr) or not ctr.container then
           27  +				log.err('item',cnn,'is marked as a trough, but has no _sorcery.container table')
           28  +			else
           29  +				ctr = ctr.container
           30  +				if (ctr.has == 'sorcery:blood' or not ctr.has) and
           31  +					((not ctr.charge) or ctr.charge < (ctr.max or 1)) then
           32  +					trough = {
           33  +						pos = trough, ctr = ctr;
           34  +						def = sorcery.register.liquid.db['sorcery:blood'].containers[ctr.empty or cnn]
           35  +					}
           36  +				else
           37  +					trough = nil
           38  +				end
           39  +			end
    21     40   		end
    22     41   
    23     42   		local inv = user:get_inventory()
    24     43   		local btl = ItemStack('vessels:glass_bottle')
    25     44   		if not inv:contains_item('main', btl) then
    26     45   			return nil
    27     46   		end
................................................................................
    49     68   		end
    50     69   		local pos = target:get_pos()
    51     70   		pos.y = pos.y + 1.5
    52     71   
    53     72   		local wear = 65535 / dagger_uses
    54     73   		stack:add_wear(wear)
    55     74   
    56         -		inv:remove_item('main',btl)
    57         -		inv:add_item('main',blood)
           75  +		if not trough then
           76  +			inv:remove_item('main',btl)
           77  +			inv:add_item('main',blood)
           78  +		else
           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  +			})
           83  +		end
    58     84   
    59     85   		target:punch(user, 1.0, caps, nil)
    60     86   		sorcery.vfx.bloodburst(pos)
    61     87   
    62     88   		if math.random(3 + sorcery.enchant.strength(stack,'sanctify') * 6) == 1 then
    63     89   			-- we've used up the consecration
    64     90   			local unholy = ItemStack("sorcery:dagger")