]> git.lizzy.rs Git - minetest.git/blob - games/devtest/mods/basetools/init.lua
DevTest: Explain purpose of most items in tooltips (#12833)
[minetest.git] / games / devtest / mods / basetools / init.lua
1 --
2 -- Tool definitions
3 --
4
5 --[[ TOOLS SUMMARY:
6
7 Tool types:
8
9 * Hand: basic tool/weapon (special capabilities in creative mode)
10 * Pickaxe: dig cracky
11 * Axe: dig choppy
12 * Shovel: dig crumbly
13 * Shears: dig snappy
14 * Sword: deal damage
15 * Dagger: deal damage, but faster
16
17 Tool materials:
18
19 * Wood: dig nodes of rating 3
20 * Stone: dig nodes of rating 3 or 2
21 * Steel: dig nodes of rating 3, 2 or 1
22 * Mese: dig "everything" instantly
23 * n-Uses: can be used n times before breaking
24 ]]
25
26 -- The hand
27 if minetest.settings:get_bool("creative_mode") then
28         local digtime = 42
29         local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
30
31         minetest.register_item(":", {
32                 type = "none",
33                 wield_image = "wieldhand.png",
34                 wield_scale = {x = 1, y = 1, z = 2.5},
35                 range = 10,
36                 tool_capabilities = {
37                         full_punch_interval = 0.5,
38                         max_drop_level = 3,
39                         groupcaps = {
40                                 crumbly = caps,
41                                 cracky  = caps,
42                                 snappy  = caps,
43                                 choppy  = caps,
44                                 oddly_breakable_by_hand = caps,
45                                 -- dig_immediate group doesn't use value 1. Value 3 is instant dig
46                                 dig_immediate =
47                                         {times = {[2] = digtime, [3] = 0}, uses = 0, maxlevel = 256},
48                         },
49                         damage_groups = {fleshy = 10},
50                 }
51         })
52 else
53         minetest.register_item(":", {
54                 type = "none",
55                 wield_image = "wieldhand.png",
56                 wield_scale = {x = 1, y = 1, z = 2.5},
57                 tool_capabilities = {
58                         full_punch_interval = 0.9,
59                         max_drop_level = 0,
60                         groupcaps = {
61                                 crumbly = {times = {[2] = 3.00, [3] = 0.70}, uses = 0, maxlevel = 1},
62                                 snappy = {times = {[3] = 0.40}, uses = 0, maxlevel = 1},
63                                 oddly_breakable_by_hand =
64                                         {times = {[1] = 3.50, [2] = 2.00, [3] = 0.70}, uses = 0}
65                         },
66                         damage_groups = {fleshy = 1},
67                 }
68         })
69 end
70
71 -- Mese Pickaxe: special tool that digs "everything" instantly
72 minetest.register_tool("basetools:pick_mese", {
73         description = "Mese Pickaxe".."\n"..
74                         "Digs diggable nodes instantly",
75         inventory_image = "basetools_mesepick.png",
76         tool_capabilities = {
77                 full_punch_interval = 1.0,
78                 max_drop_level=3,
79                 groupcaps={
80                         cracky={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
81                         crumbly={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
82                         snappy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
83                         choppy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
84                         dig_immediate={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
85                 },
86                 damage_groups = {fleshy=100},
87         },
88 })
89
90
91 --
92 -- Pickaxes: Dig cracky
93 --
94
95 minetest.register_tool("basetools:pick_wood", {
96         description = "Wooden Pickaxe".."\n"..
97                 "Digs cracky=3",
98         inventory_image = "basetools_woodpick.png",
99         tool_capabilities = {
100                 max_drop_level=0,
101                 groupcaps={
102                         cracky={times={[3]=2.00}, uses=30, maxlevel=0}
103                 },
104         },
105 })
106 minetest.register_tool("basetools:pick_stone", {
107         description = "Stone Pickaxe".."\n"..
108                 "Digs cracky=2..3",
109         inventory_image = "basetools_stonepick.png",
110         tool_capabilities = {
111                 max_drop_level=0,
112                 groupcaps={
113                         cracky={times={[2]=1.20, [3]=0.80}, uses=60, maxlevel=0}
114                 },
115         },
116 })
117 minetest.register_tool("basetools:pick_steel", {
118         description = "Steel Pickaxe".."\n"..
119                 "Digs cracky=1..3",
120         inventory_image = "basetools_steelpick.png",
121         tool_capabilities = {
122                 max_drop_level=1,
123                 groupcaps={
124                         cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=0}
125                 },
126         },
127 })
128 minetest.register_tool("basetools:pick_steel_l1", {
129         description = "Steel Pickaxe Level 1".."\n"..
130                 "Digs cracky=1..3".."\n"..
131                 "maxlevel=1",
132         inventory_image = "basetools_steelpick_l1.png",
133         tool_capabilities = {
134                 max_drop_level=1,
135                 groupcaps={
136                         cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=1}
137                 },
138         },
139 })
140 minetest.register_tool("basetools:pick_steel_l2", {
141         description = "Steel Pickaxe Level 2".."\n"..
142                 "Digs cracky=1..3".."\n"..
143                 "maxlevel=2",
144         inventory_image = "basetools_steelpick_l2.png",
145         tool_capabilities = {
146                 max_drop_level=1,
147                 groupcaps={
148                         cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=2}
149                 },
150         },
151 })
152
153 --
154 -- Shovels (dig crumbly)
155 --
156
157 minetest.register_tool("basetools:shovel_wood", {
158         description = "Wooden Shovel".."\n"..
159                 "Digs crumbly=3",
160         inventory_image = "basetools_woodshovel.png",
161         tool_capabilities = {
162                 max_drop_level=0,
163                 groupcaps={
164                         crumbly={times={[3]=0.50}, uses=30, maxlevel=0}
165                 },
166         },
167 })
168 minetest.register_tool("basetools:shovel_stone", {
169         description = "Stone Shovel".."\n"..
170                 "Digs crumbly=2..3",
171         inventory_image = "basetools_stoneshovel.png",
172         tool_capabilities = {
173                 max_drop_level=0,
174                 groupcaps={
175                         crumbly={times={[2]=0.50, [3]=0.30}, uses=60, maxlevel=0}
176                 },
177         },
178 })
179 minetest.register_tool("basetools:shovel_steel", {
180         description = "Steel Shovel".."\n"..
181                 "Digs crumbly=1..3",
182         inventory_image = "basetools_steelshovel.png",
183         tool_capabilities = {
184                 max_drop_level=1,
185                 groupcaps={
186                         crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=90, maxlevel=0}
187                 },
188         },
189 })
190
191 --
192 -- Axes (dig choppy)
193 --
194
195 minetest.register_tool("basetools:axe_wood", {
196         description = "Wooden Axe".."\n"..
197                 "Digs choppy=3",
198         inventory_image = "basetools_woodaxe.png",
199         tool_capabilities = {
200                 max_drop_level=0,
201                 groupcaps={
202                         choppy={times={[3]=0.80}, uses=30, maxlevel=0},
203                 },
204         },
205 })
206 minetest.register_tool("basetools:axe_stone", {
207         description = "Stone Axe".."\n"..
208                 "Digs choppy=2..3",
209         inventory_image = "basetools_stoneaxe.png",
210         tool_capabilities = {
211                 max_drop_level=0,
212                 groupcaps={
213                         choppy={times={[2]=1.00, [3]=0.60}, uses=60, maxlevel=0},
214                 },
215         },
216 })
217 minetest.register_tool("basetools:axe_steel", {
218         description = "Steel Axe".."\n"..
219                 "Digs choppy=1..3",
220         inventory_image = "basetools_steelaxe.png",
221         tool_capabilities = {
222                 max_drop_level=1,
223                 groupcaps={
224                         choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=90, maxlevel=0},
225                 },
226         },
227 })
228
229 --
230 -- Shears (dig snappy)
231 --
232
233 minetest.register_tool("basetools:shears_wood", {
234         description = "Wooden Shears".."\n"..
235                 "Digs snappy=3",
236         inventory_image = "basetools_woodshears.png",
237         tool_capabilities = {
238                 max_drop_level=0,
239                 groupcaps={
240                         snappy={times={[3]=1.00}, uses=30, maxlevel=0},
241                 },
242         },
243 })
244 minetest.register_tool("basetools:shears_stone", {
245         description = "Stone Shears".."\n"..
246                 "Digs snappy=2..3",
247         inventory_image = "basetools_stoneshears.png",
248         tool_capabilities = {
249                 max_drop_level=0,
250                 groupcaps={
251                         snappy={times={[2]=1.00, [3]=0.50}, uses=60, maxlevel=0},
252                 },
253         },
254 })
255 minetest.register_tool("basetools:shears_steel", {
256         description = "Steel Shears".."\n"..
257                 "Digs snappy=1..3",
258         inventory_image = "basetools_steelshears.png",
259         tool_capabilities = {
260                 max_drop_level=1,
261                 groupcaps={
262                         snappy={times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=90, maxlevel=0},
263                 },
264         },
265 })
266
267 --
268 -- Swords (deal damage)
269 --
270
271 minetest.register_tool("basetools:sword_wood", {
272         description = "Wooden Sword".."\n"..
273                 "Damage: fleshy=2",
274         inventory_image = "basetools_woodsword.png",
275         tool_capabilities = {
276                 full_punch_interval = 1.0,
277                 damage_groups = {fleshy=2},
278         }
279 })
280 minetest.register_tool("basetools:sword_stone", {
281         description = "Stone Sword".."\n"..
282                 "Damage: fleshy=5",
283         inventory_image = "basetools_stonesword.png",
284         tool_capabilities = {
285                 full_punch_interval = 1.0,
286                 max_drop_level=0,
287                 damage_groups = {fleshy=5},
288         }
289 })
290 minetest.register_tool("basetools:sword_steel", {
291         description = "Steel Sword".."\n"..
292                 "Damage: fleshy=10",
293         inventory_image = "basetools_steelsword.png",
294         tool_capabilities = {
295                 full_punch_interval = 1.0,
296                 max_drop_level=1,
297                 damage_groups = {fleshy=10},
298         }
299 })
300 minetest.register_tool("basetools:sword_titanium", {
301         description = "Titanium Sword".."\n"..
302                 "Damage: fleshy=100",
303         inventory_image = "basetools_titaniumsword.png",
304         tool_capabilities = {
305                 full_punch_interval = 1.0,
306                 max_drop_level=1,
307                 damage_groups = {fleshy=100},
308         }
309 })
310 minetest.register_tool("basetools:sword_blood", {
311         description = "Blood Sword".."\n"..
312                 "Damage: fleshy=1000",
313         inventory_image = "basetools_bloodsword.png",
314         tool_capabilities = {
315                 full_punch_interval = 1.0,
316                 max_drop_level=1,
317                 damage_groups = {fleshy=1000},
318         }
319 })
320
321 -- Max. damage sword
322 minetest.register_tool("basetools:sword_mese", {
323         description = "Mese Sword".."\n"..
324                 "Damage: fleshy=32767, fiery=32767, icy=32767".."\n"..
325                 "Full Punch Interval: 0.0s",
326         inventory_image = "basetools_mesesword.png",
327         tool_capabilities = {
328                 full_punch_interval = 0.0,
329                 max_drop_level=1,
330                 damage_groups = {fleshy=32767, fiery=32767, icy=32767},
331         }
332 })
333
334 -- Fire/Ice sword: Deal damage to non-fleshy damage groups
335 minetest.register_tool("basetools:sword_fire", {
336         description = "Fire Sword".."\n"..
337                 "Damage: icy=10",
338         inventory_image = "basetools_firesword.png",
339         tool_capabilities = {
340                 full_punch_interval = 1.0,
341                 max_drop_level=0,
342                 damage_groups = {icy=10},
343         }
344 })
345 minetest.register_tool("basetools:sword_ice", {
346         description = "Ice Sword".."\n"..
347                 "Damage: fiery=10",
348         inventory_image = "basetools_icesword.png",
349         tool_capabilities = {
350                 full_punch_interval = 1.0,
351                 max_drop_level=0,
352                 damage_groups = {fiery=10},
353         }
354 })
355 minetest.register_tool("basetools:sword_elemental", {
356         description = "Elemental Sword".."\n"..
357                 "Damage: fiery=10, icy=10",
358         inventory_image = "basetools_elementalsword.png",
359         tool_capabilities = {
360                 full_punch_interval = 1.0,
361                 max_drop_level=0,
362                 damage_groups = {fiery=10, icy=10},
363         }
364 })
365
366 -- Healing weapons: heal HP
367 minetest.register_tool("basetools:dagger_heal", {
368         description = "Healing Dagger".."\n"..
369                 "Heal: fleshy=1".."\n"..
370                 "Full Punch Interval: 0.5s",
371         inventory_image = "basetools_healdagger.png",
372         tool_capabilities = {
373                 full_punch_interval = 0.5,
374                 damage_groups = {fleshy=-1},
375         }
376 })
377 minetest.register_tool("basetools:sword_heal", {
378         description = "Healing Sword".."\n"..
379                 "Heal: fleshy=10",
380         inventory_image = "basetools_healsword.png",
381         tool_capabilities = {
382                 full_punch_interval = 1.0,
383                 damage_groups = {fleshy=-10},
384         }
385 })
386 minetest.register_tool("basetools:sword_heal_super", {
387         description = "Super Healing Sword".."\n"..
388                 "Heal: fleshy=32768, fiery=32768, icy=32768",
389         inventory_image = "basetools_superhealsword.png",
390         tool_capabilities = {
391                 full_punch_interval = 1.0,
392                 damage_groups = {fleshy=-32768, fiery=-32768, icy=-32768},
393         }
394 })
395
396
397 --
398 -- Dagger: Low damage, fast punch interval
399 --
400 minetest.register_tool("basetools:dagger_wood", {
401         description = "Wooden Dagger".."\n"..
402                 "Damage: fleshy=1".."\n"..
403                 "Full Punch Interval: 0.5s",
404         inventory_image = "basetools_wooddagger.png",
405         tool_capabilities = {
406                 full_punch_interval = 0.5,
407                 max_drop_level=0,
408                 damage_groups = {fleshy=1},
409         }
410 })
411 minetest.register_tool("basetools:dagger_steel", {
412         description = "Steel Dagger".."\n"..
413                 "Damage: fleshy=2".."\n"..
414                 "Full Punch Interval: 0.5s",
415         inventory_image = "basetools_steeldagger.png",
416         tool_capabilities = {
417                 full_punch_interval = 0.5,
418                 max_drop_level=0,
419                 damage_groups = {fleshy=2},
420         }
421 })
422
423 -- Test tool uses and punch_attack_uses
424 local uses = { 1, 2, 3, 5, 10, 50, 100, 1000, 10000, 65535 }
425 for i=1, #uses do
426         local u = uses[i]
427         local ustring
428         if i == 1 then
429                 ustring = u.."-Use"
430         else
431                 ustring = u.."-Uses"
432         end
433         local color = string.format("#FF00%02X", math.floor(((i-1)/#uses) * 255))
434         minetest.register_tool("basetools:pick_uses_"..string.format("%05d", u), {
435                 description = ustring.." Pickaxe".."\n"..
436                         "Digs cracky=3",
437                 inventory_image = "basetools_usespick.png^[colorize:"..color..":127",
438                 tool_capabilities = {
439                         max_drop_level=0,
440                         groupcaps={
441                                 cracky={times={[3]=0.1, [2]=0.2, [1]=0.3}, uses=u, maxlevel=0}
442                         },
443                 },
444         })
445
446         minetest.register_tool("basetools:sword_uses_"..string.format("%05d", u), {
447                 description = ustring.." Sword".."\n"..
448                         "Damage: fleshy=1",
449                 inventory_image = "basetools_usessword.png^[colorize:"..color..":127",
450                 tool_capabilities = {
451                         damage_groups = {fleshy=1},
452                         punch_attack_uses = u,
453                 },
454         })
455 end