sorcery  Diff

Differences From Artifact [569141ccf4]:

To Artifact [68741b438c]:

  • File crafttools.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: 1100) [annotate] [blame] [check-ins using]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22

23
24
25
26




27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
minetest.register_on_craft(function(stack,crafter,recipe,grid)
	local ctoolclass = {
		[1] = 200;
		[2] = 100;
		[3] = 50;
		[4] = 10;
		[5] = 5;
	}
	for i=1,grid:get_size('craft') do
		local s = grid:get_stack('craft',i)
		local v = minetest.get_item_group(s:get_name(),'crafttool')
		if v ~= 0 then
			local dmg = 65536 / ctoolclass[v]
			local tool = recipe[i] 
			tool:add_wear(dmg)
			grid:set_stack('craft',i,tool)
		end
	end
	return nil
end)


if minetest.get_modpath('xdecor') then

	local og = minetest.registered_tools['xdecor:hammer'].groups
	og.crafttool = 2
	minetest.override_item('xdecor:hammer', {groups = og})
end





minetest.register_tool('sorcery:vice', {
	description = 'Vice';
	inventory_image = 'sorcery_vice.png';
	group = { crafttool = 3; }
})
minetest.register_craft {
	output = 'sorcery:vice';
	recipe = {
		{'default:steel_ingot','sorcery:screw_steel','default:steel_ingot'};
		{'default:bronze_ingot','sorcery:screw_steel','default:bronze_ingot'};
		{'default:tin_ingot','default:tin_ingot','default:tin_ingot'};
	};
}
-- chisel

<
<
<
<
<
<
<




|








>
|
>
|
|
|
|
>
>
>
>




|










1







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
minetest.register_on_craft(function(stack,crafter,recipe,grid)







	for i=1,grid:get_size('craft') do
		local s = grid:get_stack('craft',i)
		local v = minetest.get_item_group(s:get_name(),'crafttool')
		if v ~= 0 then
			local dmg = 65536 / v
			local tool = recipe[i] 
			tool:add_wear(dmg)
			grid:set_stack('craft',i,tool)
		end
	end
	return nil
end)

local mod_override = function(mod,name,val)
	if minetest.get_modpath(mod) then
		local id = mod..':'..name
		local og = minetest.registered_tools[id].groups
		og.crafttool = val
		minetest.override_item(id, {groups = og})
	end
end

mod_override('xdecor',     'hammer',     70)
mod_override('screwdriver','screwdriver',40)

minetest.register_tool('sorcery:vice', {
	description = 'Vice';
	inventory_image = 'sorcery_vice.png';
	group = { crafttool = 100; }
})
minetest.register_craft {
	output = 'sorcery:vice';
	recipe = {
		{'default:steel_ingot','sorcery:screw_steel','default:steel_ingot'};
		{'default:bronze_ingot','sorcery:screw_steel','default:bronze_ingot'};
		{'default:tin_ingot','default:tin_ingot','default:tin_ingot'};
	};
}
-- chisel