Guest User

Untitled

a guest
Nov 30th, 2019
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. minetest.register_entity("zombiestrd:zombie",{
  2. -- common props
  3. physical = true,
  4. stepheight = 0.1,
  5. collide_with_objects = true,
  6. collisionbox = {-0.25, -1, -0.25, 0.25, 0.75, 0.25},
  7. visual = "mesh",
  8. mesh = "zombie_normal.b3d",
  9. textures = {"mobs_zombie.png","mobs_zombi2.png"},
  10. visual_size = {x = 1, y = 1},
  11. static_save = true,
  12. timeout = 600,
  13. on_step = mobkit.stepfunc, -- required
  14. on_activate = mobkit.actfunc, -- required
  15. get_staticdata = mobkit.statfunc,
  16. --CUSTOM PROPERTIES BELOW
  17. head = "zombiestrd:zombie_head",
  18. springiness=0,
  19. buoyancy = 0.75, -- portion of hitbox submerged
  20. max_speed = 3,
  21. jump_height = 1.26,
  22. view_range = 24,
  23. lung_capacity = 10, -- seconds
  24. max_hp = 14,
  25. attack={range=0.3,damage_groups={fleshy=7}},
  26. animation = {
  27. walk={range={x=41,y=101},speed=40,loop=true},
  28. stand={range={x=0,y=40},speed=1,loop=true},
  29. },
  30.  
  31. sounds = {
  32. misc='zombie',
  33. attack='zombie_bite',
  34. warn = 'angrydog',
  35. headhit = 'splash_hit',
  36. bodyhit = 'body_hit',
  37. charge = 'zombie_charge',
  38. },
  39. armor_groups={immortal=100},
  40. brainfunc = zombie_brain,
  41.  
  42. ...
  43. })
  44.  
  45. function mobkit.actfunc(self, staticdata, dtime_s)
  46. self.logic = self.logic or self.brainfunc
  47. self.physics = self.physics or mobkit.physics
  48.  
  49. self.lqueue = {}
  50. self.hqueue = {}
  51. self.nearby_objects = {}
  52. self.nearby_players = {}
  53. self.pos_history = {}
  54. self.path_dir = 1
  55. self.time_total = 0
  56. self.water_drag = self.water_drag or 1
  57. local name = self.name
  58. local head = self.object:get_properties().head
  59. if head then -- Returns false as get_properties() returns a table without 'head' prop
  60. local rel_pos = minetest.registered_entities[head].pos
  61. local pos = self.object:get_pos()
  62. local real_pos = {x = pos.x+rel_pos.x, y=pos.y+rel_pos.y, z=pos.z+rel_pos.z}
  63. local head_obj = minetest.add_entity(rel_pos, head)
  64. local rot = self.object:get_rotation()
  65. head_obj:set_attach(self, "", rel_pos, {x=deg(rot.x), y=deg(rot.y), z=deg(rot.z)})
  66. end
Advertisement
Add Comment
Please, Sign In to add comment