init.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. if not minetest.global_exists("wizard") then wizard = {} end
  2. wizard.modpath = minetest.get_modpath("wizard")
  3. dofile(wizard.modpath .. "/node.lua")
  4. dofile(wizard.modpath .. "/banish.lua")
  5. dofile(wizard.modpath .. "/track.lua")
  6. dofile(wizard.modpath .. "/gag.lua")
  7. dofile(wizard.modpath .. "/punish.lua")
  8. dofile(wizard.modpath .. "/summon.lua")
  9. function wizard.damage_player(pname, amount)
  10. minetest.after(0, function()
  11. local pref = minetest.get_player_by_name(pname)
  12. if pref and pref:get_hp() > 0 then
  13. utility.damage_player(pref, "electrocute", amount * 500)
  14. end
  15. end)
  16. end
  17. function wizard.runeslab_particles(pos)
  18. local image = "nether_particle_anim3.png"
  19. local color = "darkgrey"
  20. local d = 0.5
  21. minetest.add_particlespawner({
  22. amount = 5,
  23. time = 1.1,
  24. minpos = {x=pos.x-d, y=pos.y-d, z=pos.z-d},
  25. maxpos = {x=pos.x+d, y=pos.y+d, z=pos.z+d},
  26. minvel = {x=0, y=-d, z=0},
  27. maxvel = {x=0, y=d, z=0},
  28. minacc = {x=0, y=0, z=0},
  29. maxacc = {x=0, y=0, z=0},
  30. minexptime = 1.5,
  31. maxexptime = 2.5,
  32. minsize = 1,
  33. maxsize = 1.5,
  34. collisiondetection = true,
  35. collision_removal = true,
  36. texture = image .. "^[colorize:" .. color .. ":alpha",
  37. vertical = false,
  38. animation = {
  39. type = "vertical_frames",
  40. aspect_w = 7,
  41. aspect_h = 7,
  42. -- Disabled for now due to causing older clients to hang.
  43. --length = -1,
  44. length = 1.0,
  45. },
  46. glow = 14,
  47. })
  48. end
  49. if not wizard.registered then
  50. wizard.registered = true
  51. minetest.register_node("wizard:stone", {
  52. description = "Wizard Stone (You Hacker)",
  53. tiles = {"default_obsidian.png"},
  54. on_rotate = function(...) return wizard.on_rotate(...) end,
  55. groups = utility.dig_groups("obsidian", {stone=1, immovable=1}),
  56. drop = "",
  57. sounds = default.node_sound_stone_defaults(),
  58. crushing_damage = 20*500,
  59. node_dig_prediction = "",
  60. on_construct = function(...) return wizard.on_construct(...) end,
  61. on_destruct = function(...) return wizard.on_destruct(...) end,
  62. on_blast = function(...) return wizard.on_blast(...) end,
  63. on_collapse_to_entity = function(...) return wizard.on_collapse_to_entity(...) end,
  64. on_finish_collapse = function(...) return wizard.on_finish_collapse(...) end,
  65. on_rightclick = function(...) return wizard.on_rightclick(...) end,
  66. allow_metadata_inventory_move = function(...) return wizard.allow_metadata_inventory_move(...) end,
  67. allow_metadata_inventory_put = function(...) return wizard.allow_metadata_inventory_put(...) end,
  68. allow_metadata_inventory_take = function(...) return wizard.allow_metadata_inventory_take(...) end,
  69. on_metadata_inventory_move = function(...) return wizard.on_metadata_inventory_move(...) end,
  70. on_metadata_inventory_put = function(...) return wizard.on_metadata_inventory_put(...) end,
  71. on_metadata_inventory_take = function(...) return wizard.on_metadata_inventory_take(...) end,
  72. after_place_node = function(...) return wizard.after_place_node(...) end,
  73. on_punch = function(...) return wizard.on_punch(...) end,
  74. on_timer = function(...) return wizard.on_timer(...) end,
  75. can_dig = function(...) return wizard.can_dig(...) end,
  76. _on_update_infotext = function(...) return wizard.update_infotext(...) end,
  77. _on_update_formspec = function(...) return wizard.update_formspec(...) end,
  78. _on_update_entity = function(...) return wizard.update_entity(...) end,
  79. _on_pre_fall = function(...) return wizard.on_pre_fall(...) end,
  80. })
  81. dofile(wizard.modpath .. "/staffs.lua")
  82. -- Register mod reloadable.
  83. local c = "wizard:core"
  84. local f = wizard.modpath .. "/init.lua"
  85. reload.register_file(c, f, false)
  86. end