2
0

init.lua 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. --
  2. -- Tool definitions
  3. --
  4. --[[ TOOLS SUMMARY:
  5. Tool types:
  6. * Hand: basic tool/weapon (special capabilities in creative mode)
  7. * Pickaxe: dig cracky
  8. * Axe: dig choppy
  9. * Shovel: dig crumbly
  10. * Shears: dig snappy
  11. * Sword: deal damage
  12. * Dagger: deal damage, but faster
  13. Tool materials:
  14. * Dirt: dig nodes of rating 3, one use only
  15. * Wood: dig nodes of rating 3
  16. * Stone: dig nodes of rating 3 or 2
  17. * Steel: dig nodes of rating 3, 2 or 1
  18. * Mese: dig "everything" instantly
  19. ]]
  20. -- The hand
  21. if minetest.settings:get_bool("creative_mode") then
  22. local digtime = 42
  23. local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
  24. minetest.register_item(":", {
  25. type = "none",
  26. wield_image = "wieldhand.png",
  27. wield_scale = {x = 1, y = 1, z = 2.5},
  28. range = 10,
  29. tool_capabilities = {
  30. full_punch_interval = 0.5,
  31. max_drop_level = 3,
  32. groupcaps = {
  33. crumbly = caps,
  34. cracky = caps,
  35. snappy = caps,
  36. choppy = caps,
  37. oddly_breakable_by_hand = caps,
  38. -- dig_immediate group doesn't use value 1. Value 3 is instant dig
  39. dig_immediate =
  40. {times = {[2] = digtime, [3] = 0}, uses = 0, maxlevel = 256},
  41. },
  42. damage_groups = {fleshy = 10},
  43. }
  44. })
  45. else
  46. minetest.register_item(":", {
  47. type = "none",
  48. wield_image = "wieldhand.png",
  49. wield_scale = {x = 1, y = 1, z = 2.5},
  50. tool_capabilities = {
  51. full_punch_interval = 0.9,
  52. max_drop_level = 0,
  53. groupcaps = {
  54. crumbly = {times = {[2] = 3.00, [3] = 0.70}, uses = 0, maxlevel = 1},
  55. snappy = {times = {[3] = 0.40}, uses = 0, maxlevel = 1},
  56. oddly_breakable_by_hand =
  57. {times = {[1] = 3.50, [2] = 2.00, [3] = 0.70}, uses = 0}
  58. },
  59. damage_groups = {fleshy = 1},
  60. }
  61. })
  62. end
  63. -- Mese Pickaxe: special tool that digs "everything" instantly
  64. minetest.register_tool("basetools:pick_mese", {
  65. description = "Mese Pickaxe".."\n"..
  66. "Digs diggable nodes instantly",
  67. inventory_image = "basetools_mesepick.png",
  68. tool_capabilities = {
  69. full_punch_interval = 1.0,
  70. max_drop_level=3,
  71. groupcaps={
  72. cracky={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
  73. crumbly={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
  74. snappy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
  75. choppy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
  76. dig_immediate={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255},
  77. },
  78. damage_groups = {fleshy=100},
  79. },
  80. })
  81. --
  82. -- Pickaxes: Dig cracky
  83. --
  84. -- This should break after only 1 use
  85. minetest.register_tool("basetools:pick_dirt", {
  86. description = "Dirt Pickaxe".."\n"..
  87. "Digs cracky=3".."\n"..
  88. "1 use only",
  89. inventory_image = "basetools_dirtpick.png",
  90. tool_capabilities = {
  91. max_drop_level=0,
  92. groupcaps={
  93. cracky={times={[3]=2.00}, uses=1, maxlevel=0}
  94. },
  95. },
  96. })
  97. minetest.register_tool("basetools:pick_wood", {
  98. description = "Wooden Pickaxe".."\n"..
  99. "Digs cracky=3",
  100. inventory_image = "basetools_woodpick.png",
  101. tool_capabilities = {
  102. max_drop_level=0,
  103. groupcaps={
  104. cracky={times={[3]=2.00}, uses=30, maxlevel=0}
  105. },
  106. },
  107. })
  108. minetest.register_tool("basetools:pick_stone", {
  109. description = "Stone Pickaxe".."\n"..
  110. "Digs cracky=2..3",
  111. inventory_image = "basetools_stonepick.png",
  112. tool_capabilities = {
  113. max_drop_level=0,
  114. groupcaps={
  115. cracky={times={[2]=1.20, [3]=0.80}, uses=60, maxlevel=0}
  116. },
  117. },
  118. })
  119. minetest.register_tool("basetools:pick_steel", {
  120. description = "Steel Pickaxe".."\n"..
  121. "Digs cracky=1..3",
  122. inventory_image = "basetools_steelpick.png",
  123. tool_capabilities = {
  124. max_drop_level=1,
  125. groupcaps={
  126. cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=0}
  127. },
  128. },
  129. })
  130. minetest.register_tool("basetools:pick_steel_l1", {
  131. description = "Steel Pickaxe Level 1".."\n"..
  132. "Digs cracky=1..3".."\n"..
  133. "maxlevel=1",
  134. inventory_image = "basetools_steelpick_l1.png",
  135. tool_capabilities = {
  136. max_drop_level=1,
  137. groupcaps={
  138. cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=1}
  139. },
  140. },
  141. })
  142. minetest.register_tool("basetools:pick_steel_l2", {
  143. description = "Steel Pickaxe Level 2".."\n"..
  144. "Digs cracky=1..3".."\n"..
  145. "maxlevel=2",
  146. inventory_image = "basetools_steelpick_l2.png",
  147. tool_capabilities = {
  148. max_drop_level=1,
  149. groupcaps={
  150. cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=2}
  151. },
  152. },
  153. })
  154. --
  155. -- Shovels (dig crumbly)
  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. -- Axes (dig choppy)
  192. --
  193. minetest.register_tool("basetools:axe_wood", {
  194. description = "Wooden Axe".."\n"..
  195. "Digs choppy=3",
  196. inventory_image = "basetools_woodaxe.png",
  197. tool_capabilities = {
  198. max_drop_level=0,
  199. groupcaps={
  200. choppy={times={[3]=0.80}, uses=30, maxlevel=0},
  201. },
  202. },
  203. })
  204. minetest.register_tool("basetools:axe_stone", {
  205. description = "Stone Axe".."\n"..
  206. "Digs choppy=2..3",
  207. inventory_image = "basetools_stoneaxe.png",
  208. tool_capabilities = {
  209. max_drop_level=0,
  210. groupcaps={
  211. choppy={times={[2]=1.00, [3]=0.60}, uses=60, maxlevel=0},
  212. },
  213. },
  214. })
  215. minetest.register_tool("basetools:axe_steel", {
  216. description = "Steel Axe".."\n"..
  217. "Digs choppy=1..3",
  218. inventory_image = "basetools_steelaxe.png",
  219. tool_capabilities = {
  220. max_drop_level=1,
  221. groupcaps={
  222. choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=90, maxlevel=0},
  223. },
  224. },
  225. })
  226. --
  227. -- Shears (dig snappy)
  228. --
  229. minetest.register_tool("basetools:shears_wood", {
  230. description = "Wooden Shears".."\n"..
  231. "Digs snappy=3",
  232. inventory_image = "basetools_woodshears.png",
  233. tool_capabilities = {
  234. max_drop_level=0,
  235. groupcaps={
  236. snappy={times={[3]=1.00}, uses=30, maxlevel=0},
  237. },
  238. },
  239. })
  240. minetest.register_tool("basetools:shears_stone", {
  241. description = "Stone Shears".."\n"..
  242. "Digs snappy=2..3",
  243. inventory_image = "basetools_stoneshears.png",
  244. tool_capabilities = {
  245. max_drop_level=0,
  246. groupcaps={
  247. snappy={times={[2]=1.00, [3]=0.50}, uses=60, maxlevel=0},
  248. },
  249. },
  250. })
  251. minetest.register_tool("basetools:shears_steel", {
  252. description = "Steel Shears".."\n"..
  253. "Digs snappy=1..3",
  254. inventory_image = "basetools_steelshears.png",
  255. tool_capabilities = {
  256. max_drop_level=1,
  257. groupcaps={
  258. snappy={times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=90, maxlevel=0},
  259. },
  260. },
  261. })
  262. --
  263. -- Swords (deal damage)
  264. --
  265. minetest.register_tool("basetools:sword_wood", {
  266. description = "Wooden Sword".."\n"..
  267. "Damage: fleshy=2",
  268. inventory_image = "basetools_woodsword.png",
  269. tool_capabilities = {
  270. full_punch_interval = 1.0,
  271. damage_groups = {fleshy=2},
  272. }
  273. })
  274. minetest.register_tool("basetools:sword_stone", {
  275. description = "Stone Sword".."\n"..
  276. "Damage: fleshy=4",
  277. inventory_image = "basetools_stonesword.png",
  278. tool_capabilities = {
  279. full_punch_interval = 1.0,
  280. max_drop_level=0,
  281. damage_groups = {fleshy=4},
  282. }
  283. })
  284. minetest.register_tool("basetools:sword_steel", {
  285. description = "Steel Sword".."\n"..
  286. "Damage: fleshy=6",
  287. inventory_image = "basetools_steelsword.png",
  288. tool_capabilities = {
  289. full_punch_interval = 1.0,
  290. max_drop_level=1,
  291. damage_groups = {fleshy=6},
  292. }
  293. })
  294. -- Fire/Ice sword: Deal damage to non-fleshy damage groups
  295. minetest.register_tool("basetools:sword_fire", {
  296. description = "Fire Sword".."\n"..
  297. "Damage: icy=6",
  298. inventory_image = "basetools_firesword.png",
  299. tool_capabilities = {
  300. full_punch_interval = 1.0,
  301. max_drop_level=0,
  302. damage_groups = {icy=6},
  303. }
  304. })
  305. minetest.register_tool("basetools:sword_ice", {
  306. description = "Ice Sword".."\n"..
  307. "Damage: fiery=6",
  308. inventory_image = "basetools_icesword.png",
  309. tool_capabilities = {
  310. full_punch_interval = 1.0,
  311. max_drop_level=0,
  312. damage_groups = {fiery=6},
  313. }
  314. })
  315. --
  316. -- Dagger: Low damage, fast punch interval
  317. --
  318. minetest.register_tool("basetools:dagger_steel", {
  319. description = "Steel Dagger".."\n"..
  320. "Damage: fleshy=2".."\n"..
  321. "Full Punch Interval: 0.5s",
  322. inventory_image = "basetools_steeldagger.png",
  323. tool_capabilities = {
  324. full_punch_interval = 0.5,
  325. max_drop_level=0,
  326. damage_groups = {fleshy=2},
  327. }
  328. })