1 -- mods/default/tools.lua
3 -- support for MT game translation.
4 local S = default.get_translator
7 minetest.register_item(":", {
9 wield_image = "wieldhand.png",
10 wield_scale = {x=1,y=1,z=2.5},
12 full_punch_interval = 0.9,
15 crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
16 snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
17 oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}
19 damage_groups = {fleshy=1},
27 minetest.register_tool("default:pick_wood", {
28 description = S("Wooden Pickaxe"),
29 inventory_image = "default_tool_woodpick.png",
31 full_punch_interval = 1.2,
34 cracky = {times={[3]=1.60}, uses=10, maxlevel=1},
36 damage_groups = {fleshy=2},
38 sound = {breaks = "default_tool_breaks"},
39 groups = {pickaxe = 1, flammable = 2}
42 minetest.register_tool("default:pick_stone", {
43 description = S("Stone Pickaxe"),
44 inventory_image = "default_tool_stonepick.png",
46 full_punch_interval = 1.3,
49 cracky = {times={[2]=2.0, [3]=1.00}, uses=20, maxlevel=1},
51 damage_groups = {fleshy=3},
53 sound = {breaks = "default_tool_breaks"},
54 groups = {pickaxe = 1}
57 minetest.register_tool("default:pick_bronze", {
58 description = S("Bronze Pickaxe"),
59 inventory_image = "default_tool_bronzepick.png",
61 full_punch_interval = 1.0,
64 cracky = {times={[1]=4.50, [2]=1.80, [3]=0.90}, uses=20, maxlevel=2},
66 damage_groups = {fleshy=4},
68 sound = {breaks = "default_tool_breaks"},
69 groups = {pickaxe = 1}
72 minetest.register_tool("default:pick_steel", {
73 description = S("Steel Pickaxe"),
74 inventory_image = "default_tool_steelpick.png",
76 full_punch_interval = 1.0,
79 cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
81 damage_groups = {fleshy=4},
83 sound = {breaks = "default_tool_breaks"},
84 groups = {pickaxe = 1}
87 minetest.register_tool("default:pick_mese", {
88 description = S("Mese Pickaxe"),
89 inventory_image = "default_tool_mesepick.png",
91 full_punch_interval = 0.9,
94 cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3},
96 damage_groups = {fleshy=5},
98 sound = {breaks = "default_tool_breaks"},
99 groups = {pickaxe = 1}
102 minetest.register_tool("default:pick_diamond", {
103 description = S("Diamond Pickaxe"),
104 inventory_image = "default_tool_diamondpick.png",
105 tool_capabilities = {
106 full_punch_interval = 0.9,
109 cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3},
111 damage_groups = {fleshy=5},
113 sound = {breaks = "default_tool_breaks"},
114 groups = {pickaxe = 1}
121 minetest.register_tool("default:shovel_wood", {
122 description = S("Wooden Shovel"),
123 inventory_image = "default_tool_woodshovel.png",
124 wield_image = "default_tool_woodshovel.png^[transformR90",
125 tool_capabilities = {
126 full_punch_interval = 1.2,
129 crumbly = {times={[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1},
131 damage_groups = {fleshy=2},
133 sound = {breaks = "default_tool_breaks"},
134 groups = {shovel = 1, flammable = 2}
137 minetest.register_tool("default:shovel_stone", {
138 description = S("Stone Shovel"),
139 inventory_image = "default_tool_stoneshovel.png",
140 wield_image = "default_tool_stoneshovel.png^[transformR90",
141 tool_capabilities = {
142 full_punch_interval = 1.4,
145 crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1},
147 damage_groups = {fleshy=2},
149 sound = {breaks = "default_tool_breaks"},
150 groups = {shovel = 1}
153 minetest.register_tool("default:shovel_bronze", {
154 description = S("Bronze Shovel"),
155 inventory_image = "default_tool_bronzeshovel.png",
156 wield_image = "default_tool_bronzeshovel.png^[transformR90",
157 tool_capabilities = {
158 full_punch_interval = 1.1,
161 crumbly = {times={[1]=1.65, [2]=1.05, [3]=0.45}, uses=25, maxlevel=2},
163 damage_groups = {fleshy=3},
165 sound = {breaks = "default_tool_breaks"},
166 groups = {shovel = 1}
169 minetest.register_tool("default:shovel_steel", {
170 description = S("Steel Shovel"),
171 inventory_image = "default_tool_steelshovel.png",
172 wield_image = "default_tool_steelshovel.png^[transformR90",
173 tool_capabilities = {
174 full_punch_interval = 1.1,
177 crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=2},
179 damage_groups = {fleshy=3},
181 sound = {breaks = "default_tool_breaks"},
182 groups = {shovel = 1}
185 minetest.register_tool("default:shovel_mese", {
186 description = S("Mese Shovel"),
187 inventory_image = "default_tool_meseshovel.png",
188 wield_image = "default_tool_meseshovel.png^[transformR90",
189 tool_capabilities = {
190 full_punch_interval = 1.0,
193 crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3},
195 damage_groups = {fleshy=4},
197 sound = {breaks = "default_tool_breaks"},
198 groups = {shovel = 1}
201 minetest.register_tool("default:shovel_diamond", {
202 description = S("Diamond Shovel"),
203 inventory_image = "default_tool_diamondshovel.png",
204 wield_image = "default_tool_diamondshovel.png^[transformR90",
205 tool_capabilities = {
206 full_punch_interval = 1.0,
209 crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3},
211 damage_groups = {fleshy=4},
213 sound = {breaks = "default_tool_breaks"},
214 groups = {shovel = 1}
221 minetest.register_tool("default:axe_wood", {
222 description = S("Wooden Axe"),
223 inventory_image = "default_tool_woodaxe.png",
224 tool_capabilities = {
225 full_punch_interval = 1.0,
228 choppy = {times={[2]=3.00, [3]=1.60}, uses=10, maxlevel=1},
230 damage_groups = {fleshy=2},
232 sound = {breaks = "default_tool_breaks"},
233 groups = {axe = 1, flammable = 2}
236 minetest.register_tool("default:axe_stone", {
237 description = S("Stone Axe"),
238 inventory_image = "default_tool_stoneaxe.png",
239 tool_capabilities = {
240 full_punch_interval = 1.2,
243 choppy={times={[1]=3.00, [2]=2.00, [3]=1.30}, uses=20, maxlevel=1},
245 damage_groups = {fleshy=3},
247 sound = {breaks = "default_tool_breaks"},
251 minetest.register_tool("default:axe_bronze", {
252 description = S("Bronze Axe"),
253 inventory_image = "default_tool_bronzeaxe.png",
254 tool_capabilities = {
255 full_punch_interval = 1.0,
258 choppy={times={[1]=2.75, [2]=1.70, [3]=1.15}, uses=20, maxlevel=2},
260 damage_groups = {fleshy=4},
262 sound = {breaks = "default_tool_breaks"},
266 minetest.register_tool("default:axe_steel", {
267 description = S("Steel Axe"),
268 inventory_image = "default_tool_steelaxe.png",
269 tool_capabilities = {
270 full_punch_interval = 1.0,
273 choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=20, maxlevel=2},
275 damage_groups = {fleshy=4},
277 sound = {breaks = "default_tool_breaks"},
281 minetest.register_tool("default:axe_mese", {
282 description = S("Mese Axe"),
283 inventory_image = "default_tool_meseaxe.png",
284 tool_capabilities = {
285 full_punch_interval = 0.9,
288 choppy={times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=20, maxlevel=3},
290 damage_groups = {fleshy=6},
292 sound = {breaks = "default_tool_breaks"},
296 minetest.register_tool("default:axe_diamond", {
297 description = S("Diamond Axe"),
298 inventory_image = "default_tool_diamondaxe.png",
299 tool_capabilities = {
300 full_punch_interval = 0.9,
303 choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=3},
305 damage_groups = {fleshy=7},
307 sound = {breaks = "default_tool_breaks"},
315 minetest.register_tool("default:sword_wood", {
316 description = S("Wooden Sword"),
317 inventory_image = "default_tool_woodsword.png",
318 tool_capabilities = {
319 full_punch_interval = 1,
322 snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
324 damage_groups = {fleshy=2},
326 sound = {breaks = "default_tool_breaks"},
327 groups = {sword = 1, flammable = 2}
330 minetest.register_tool("default:sword_stone", {
331 description = S("Stone Sword"),
332 inventory_image = "default_tool_stonesword.png",
333 tool_capabilities = {
334 full_punch_interval = 1.2,
337 snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
339 damage_groups = {fleshy=4},
341 sound = {breaks = "default_tool_breaks"},
345 minetest.register_tool("default:sword_bronze", {
346 description = S("Bronze Sword"),
347 inventory_image = "default_tool_bronzesword.png",
348 tool_capabilities = {
349 full_punch_interval = 0.8,
352 snappy={times={[1]=2.75, [2]=1.30, [3]=0.375}, uses=25, maxlevel=2},
354 damage_groups = {fleshy=6},
356 sound = {breaks = "default_tool_breaks"},
360 minetest.register_tool("default:sword_steel", {
361 description = S("Steel Sword"),
362 inventory_image = "default_tool_steelsword.png",
363 tool_capabilities = {
364 full_punch_interval = 0.8,
367 snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2},
369 damage_groups = {fleshy=6},
371 sound = {breaks = "default_tool_breaks"},
375 minetest.register_tool("default:sword_mese", {
376 description = S("Mese Sword"),
377 inventory_image = "default_tool_mesesword.png",
378 tool_capabilities = {
379 full_punch_interval = 0.7,
382 snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
384 damage_groups = {fleshy=7},
386 sound = {breaks = "default_tool_breaks"},
390 minetest.register_tool("default:sword_diamond", {
391 description = S("Diamond Sword"),
392 inventory_image = "default_tool_diamondsword.png",
393 tool_capabilities = {
394 full_punch_interval = 0.7,
397 snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3},
399 damage_groups = {fleshy=8},
401 sound = {breaks = "default_tool_breaks"},
406 -- Register Craft Recipies
409 local craft_ingreds = {
411 stone = "group:stone",
412 steel = "default:steel_ingot",
413 bronze = "default:bronze_ingot",
414 mese = "default:mese_crystal",
415 diamond = "default:diamond"
418 for name, mat in pairs(craft_ingreds) do
419 minetest.register_craft({
420 output = "default:pick_".. name,
423 {"", "group:stick", ""},
424 {"", "group:stick", ""}
428 minetest.register_craft({
429 output = "default:shovel_".. name,
437 minetest.register_craft({
438 output = "default:axe_".. name,
441 {mat, "group:stick"},
446 minetest.register_craft({
447 output = "default:sword_".. name,
456 minetest.register_tool("default:key", {
457 description = S("Key"),
458 inventory_image = "default_key.png",
459 groups = {key = 1, not_in_creative_inventory = 1},
461 on_place = function(itemstack, placer, pointed_thing)
462 local under = pointed_thing.under
463 local node = minetest.get_node(under)
464 local def = minetest.registered_nodes[node.name]
465 if def and def.on_rightclick and
466 not (placer and placer:is_player() and
467 placer:get_player_control().sneak) then
468 return def.on_rightclick(under, node, placer, itemstack,
469 pointed_thing) or itemstack
471 if pointed_thing.type ~= "node" then
475 local pos = pointed_thing.under
476 node = minetest.get_node(pos)
478 if not node or node.name == "ignore" then
482 local ndef = minetest.registered_nodes[node.name]
487 local on_key_use = ndef.on_key_use
489 on_key_use(pos, placer)
496 minetest.register_craft({
498 recipe = "default:pick_wood",
502 minetest.register_craft({
504 recipe = "default:shovel_wood",
508 minetest.register_craft({
510 recipe = "default:axe_wood",
514 minetest.register_craft({
516 recipe = "default:sword_wood",