Fork du mod pmobs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

113 lines
2.8 KiB

  1. -- Yeti by TenPlus1
  2. mobs:register_mob("pmobs:yeti", {
  3. type = "monster",
  4. hp_min = 10,
  5. hp_max = 35,
  6. collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
  7. visual = "mesh",
  8. mesh = "character.b3d",
  9. textures = {
  10. {"mobs_yeti.png"},
  11. },
  12. visual_size = {x=1, y=1},
  13. makes_footstep_sound = true,
  14. sounds = {
  15. shoot_attack = "mobs_stonemonster_attack",
  16. death = "mobs_zombie_death",
  17. random = "mobs_stonemonster",
  18. },
  19. view_range = 15,
  20. walk_velocity = 1,
  21. run_velocity = 3,
  22. damage = 2,
  23. drops = {
  24. {name = "default:ice",
  25. chance = 1,
  26. min = 1,
  27. max = 3,},
  28. {name = "maptools:silver_coin",
  29. chance = 2, min = 1, max = 1,},
  30. },
  31. armor = 100,
  32. drawtype = "front",
  33. water_damage = 1,
  34. lava_damage = 5,
  35. light_damage = 1,
  36. on_rightclick = nil,
  37. attack_type = "shoot",
  38. shoot_interval = .7,
  39. arrow = "pmobs:snowball",
  40. shoot_offset = 2,
  41. animation = {
  42. speed_normal = 30, speed_run = 30,
  43. stand_start = 0, stand_end = 79,
  44. walk_start = 168, walk_end = 187,
  45. run_start = 168, run_end = 187,
  46. punch_start = 200, punch_end = 219,
  47. },
  48. jump = true,
  49. floats = 0,
  50. })
  51. mobs:register_spawn("pmobs:yeti", {"default:dirt_with_snow", "default:snowblock", "default:ice"}, 10, -1, 7000, 1, 31000)
  52. mobs:register_egg("pmobs:yeti", "Yeti", "default_snow.png", 1)
  53. mobs:register_arrow("pmobs:snowball", {
  54. visual = "sprite",
  55. visual_size = {x=.5, y=.5},
  56. textures = {"default_snowball.png"},
  57. velocity = 6,
  58. hit_player = function(self, player)
  59. player:punch(self.object, 1.0, {
  60. full_punch_interval=1.0,
  61. damage_groups = {fleshy=1},
  62. }, 0)
  63. end,
  64. hit_mob = function(self, player)
  65. player:punch(self.object, 1.0, {
  66. full_punch_interval=1.0,
  67. damage_groups = {fleshy=1},
  68. }, 0)
  69. end,
  70. hit_node = function(self, pos, node)
  71. end
  72. })
  73. -- snowball throwing item
  74. if not minetest.get_modpath("snow") then
  75. local snowball_GRAVITY=9
  76. local snowball_VELOCITY=19
  77. -- shoot snowball
  78. local mobs_shoot_snowball=function (item, player, pointed_thing)
  79. local playerpos=player:getpos()
  80. local obj=minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "pmobs:snowball")
  81. local dir=player:get_look_dir()
  82. obj:get_luaentity().velocity = snowball_VELOCITY -- needed for api internal timing
  83. obj:setvelocity({x=dir.x*snowball_VELOCITY, y=dir.y*snowball_VELOCITY, z=dir.z*snowball_VELOCITY})
  84. obj:setacceleration({x=dir.x*-3, y=-snowball_GRAVITY, z=dir.z*-3})
  85. item:take_item()
  86. return item
  87. end
  88. -- override default snow to shoot snowballs
  89. minetest.override_item("default:snow", {
  90. --Disable placement prediction for snow.
  91. node_placement_prediction = "",
  92. on_construct = function(pos)
  93. if minetest.get_item_group(minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name, "soil") > 0 then
  94. minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="default:dirt_with_snow"})
  95. end
  96. end,
  97. on_use = mobs_shoot_snowball
  98. })
  99. end
  100. mobs:alias_mob("mobs:yeti", "pmobs:yeti")