Guest User

Minetest error

a guest
May 30th, 2019
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --overrides the default swords to remove attack cooldown.
  2. --Some code I might use later: on_secondary_use = function(itemstack, user)
  3. local my_players = {}
  4.  
  5. minetest.override_item("default:sword_diamond", {
  6. description = "Diamond Sword",
  7. inventory_image = "default_tool_diamondsword.png",
  8. tool_capabilities = {
  9. full_punch_interval = 0.1,
  10. max_drop_level=1,
  11. groupcaps={
  12. snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3},
  13. },
  14. damage_groups = {fleshy=8},
  15. },
  16. sound = {breaks = "default_tool_breaks"},
  17. on_secondary_use = function(itemstack, clicker, user)
  18. minetest.chat_send_all(math.random())
  19. itemstack:take_item(); return ("default:sword_mese")
  20. end,
  21. })
  22.  
  23. minetest.override_item("default:sword_mese", {
  24. description = "Mese Sword",
  25. inventory_image = "default_tool_mesesword.png",
  26. tool_capabilities = {
  27. full_punch_interval = 0.1,
  28. max_drop_level=1,
  29. groupcaps={
  30. snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
  31. },
  32. damage_groups = {fleshy=7},
  33. },
  34. sound = {breaks = "default_tool_breaks"},
  35. on_place = function(itemstack, placer, pointed_thing)
  36. my_players[placer:get_player_name()] = true
  37. end
  38. minetest.register_globalstep(function(dtime)
  39. for name, what in pairs(my_players) do
  40. local player = minetest.get_player_by_name(name)
  41. if player then
  42. my_players[name] = false -- player left
  43. else
  44. if !player:get_player_control().RMB then
  45. minetest.chat_send_all(math.random())
  46. my_players[name] = false
  47. end
  48. end
  49. end
  50. end)
  51. })
  52.  
  53. minetest.override_item("default:sword_steel", {
  54. description = "Steel Sword",
  55. inventory_image = "default_tool_steelsword.png",
  56. tool_capabilities = {
  57. full_punch_interval = 0.1,
  58. max_drop_level=1,
  59. groupcaps={
  60. snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2},
  61. },
  62. damage_groups = {fleshy=6},
  63. },
  64. sound = {breaks = "default_tool_breaks"},
  65. })
  66.  
  67. minetest.override_item("default:sword_bronze", {
  68. description = "Bronze Sword",
  69. inventory_image = "default_tool_bronzesword.png",
  70. tool_capabilities = {
  71. full_punch_interval = 0.1,
  72. max_drop_level=1,
  73. groupcaps={
  74. snappy={times={[1]=2.75, [2]=1.30, [3]=0.375}, uses=25, maxlevel=2},
  75. },
  76. damage_groups = {fleshy=6},
  77. },
  78. sound = {breaks = "default_tool_breaks"},
  79. })
  80.  
  81. minetest.override_item("default:sword_stone", {
  82. description = "Stone Sword",
  83. inventory_image = "default_tool_stonesword.png",
  84. tool_capabilities = {
  85. full_punch_interval = 0.1,
  86. max_drop_level=0,
  87. groupcaps={
  88. snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
  89. },
  90. damage_groups = {fleshy=4},
  91. },
  92. sound = {breaks = "default_tool_breaks"},
  93. })
  94.  
  95. minetest.override_item("default:sword_wood", {
  96. description = "Wooden Sword",
  97. inventory_image = "default_tool_woodsword.png",
  98. tool_capabilities = {
  99. full_punch_interval = 0.1,
  100. max_drop_level=0,
  101. groupcaps={
  102. snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
  103. },
  104. damage_groups = {fleshy=2},
  105. },
  106. groups = {flammable = 2},
  107. sound = {breaks = "default_tool_breaks"},
  108. })
RAW Paste Data