init.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. unicorn = {}
  2. dofile(minetest.get_modpath('unicorn')..'/functions.lua')
  3. dofile(minetest.get_modpath('unicorn')..'/items.lua')
  4. dofile(minetest.get_modpath('unicorn')..'/recipes.lua')
  5. minetest.register_entity('unicorn:unicorn', {
  6. type = 'unicorn',
  7. is_mountable = true,
  8. driver = nil,
  9. init_tamagochi_timer = true,
  10. is_pet = true,
  11. eat_hay = true,
  12. has_affinity = true,
  13. breed = true,
  14. is_wild = false,
  15. give_orders = true,
  16. can_be_brushed = true,
  17. capture_item = "lasso",
  18. terrain_type = 3,
  19. skin_colors = {'pink'},
  20. driver_scale = {x = 1, y = 1},
  21. driver_attach_at = {x = -0.0325, y = 12.5, z = -0.2},
  22. driver_eye_offset = {x = 0, y = 14, z = 0},
  23. pregnant_count = 5,
  24. physical = true,
  25. stepheight = 1,
  26. collide_with_objects = true,
  27. collisionbox = {-.75,0,-.75,.75,1.5,.75},
  28. visual = 'mesh',
  29. mesh = 'unicorn.b3d',
  30. textures = {'unicorn_pink.png'},
  31. visual_size = {x=1, y=1},
  32. timeout = 300,
  33. max_hp = 100,
  34. animation = {
  35. walk = {range={x=10,y=60}, speed=30, loop=true},
  36. gallop = {range={x=70,y=120}, speed=30, loop=true},
  37. stand = {range={x=140,y=460}, speed=30, loop=true},
  38. fly = {range={x=465,y=490}, speed=30, loop=true},
  39. },
  40. petz.settings.unicorn_follow,
  41. drops = {
  42. {name = 'unicorn:feather', chance = 10, min = 1, max = 4},
  43. {name = 'unicorn:horn', chance = 3, min = 1, max = 1}
  44. },
  45. rotate = 0,
  46. max_speed = 5,
  47. jump_height = 2,
  48. view_range = 10,
  49. static_save = true,
  50. springiness= 0,
  51. buoyancy = 0.5, -- portion of hitbox submerged
  52. max_speed = 2,
  53. jump_height = 1.5,
  54. view_range = 10,
  55. lung_capacity = 10, -- seconds
  56. max_hp = 15,
  57. makes_footstep_sound = true,
  58. max_height = 20,
  59. get_staticdata = mobkit.statfunc,
  60. logic = unicorn.brain,
  61. on_activate = function(self, staticdata, dtime_s) --on_activate, required
  62. mobkit.actfunc(self, staticdata, dtime_s)
  63. petz.set_initial_properties(self, staticdata, dtime_s)
  64. end,
  65. on_deactivate = function(self)
  66. petz.on_deactivate(self)
  67. end,
  68. on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
  69. petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
  70. end,
  71. on_rightclick = function(self, clicker)
  72. petz.on_rightclick(self, clicker)
  73. end,
  74. on_step = function(self, dtime)
  75. mobkit.stepfunc(self, dtime) -- required
  76. petz.on_step(self, dtime)
  77. end,
  78. on_detach_child = function(self, child)
  79. if self.wagon and not(child:is_player()) then
  80. local child_ent = child:get_luaentity()
  81. self.wagon:set_properties({
  82. visual_size = child_ent.visual_size
  83. })
  84. self.wagon = nil
  85. end
  86. end,
  87. })
  88. petz:register_egg('unicorn:unicorn', 'Unicorn', 'unicorn_spawn_egg.png', true)