1 --this is where mobs are defined
3 --this is going to be used to set an active mob limit
6 local path = minetest.get_modpath(minetest.get_current_modname())
8 dofile(path.."/spawning.lua")
9 dofile(path.."/api/api_hook.lua")
10 dofile(path.."/items.lua")
11 dofile(path.."/chatcommands.lua")
18 collide_with_objects = false,
19 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
21 visual_size = {x = 3, y = 3},
24 --blank out the first two to create adult pig
28 --these are used to anchor a point to the head position
33 debug_head_pos = false,
34 head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
35 head_height_offset = 0.8, --added to the base y position
36 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
37 head_position_correction = vector.new(0,3,-0.5),
38 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
39 head_coord = "horizontal",
44 automatic_face_movement_dir = 0,
45 automatic_face_movement_max_rotation_per_sec = 300,
46 makes_footstep_sound = false,
48 gravity = {x = 0, y = -9.81, z = 0},
49 movement_type = "walk",
54 item_drop = "mob:raw_porkchop",
55 standing_frame = {x=0,y=0},
56 moving_frame = {x=0,y=40},
57 animation_multiplier = 20,
63 die_sound = "pig_die",
67 attacked_hostile = false,
68 attack_type = "punch",
70 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
71 --explosion_power = 7, -- how big the explosion has to be
72 --explosion_time = 3, -- how long it takes for a mob to explode
80 collide_with_objects = false,
81 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
83 visual_size = {x = 3, y = 3},
86 "sheep_head_wool.png","sheep_wool.png","sheep.png"
87 --"sheep_head_shaved.png","nothing.png","sheep.png"
90 --these are used to anchor a point to the head position
95 debug_head_pos = false,
96 head_directional_offset = 0.571, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
97 head_height_offset = 1.15, --added to the base y position
98 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
99 head_position_correction = vector.new(0,4.1,-0.86),
100 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
101 head_coord = "horizontal",
106 automatic_face_movement_dir = 0,
107 automatic_face_movement_max_rotation_per_sec = 300,
108 makes_footstep_sound = false,
110 gravity = {x = 0, y = -9.81, z = 0},
111 movement_type = "walk",
116 item_drop = "mob:raw_porkchop",
117 standing_frame = {x=0,y=0},
118 moving_frame = {x=0,y=40},
119 animation_multiplier = 20,
122 death_rotation = "x",
124 hurt_sound = "sheep",
129 attacked_hostile = false,
130 attack_type = "punch",
133 c_mob_data = {sheared = false},
135 custom_on_activate = function(self)
136 --print(dump(self.c_mob_data))
137 if self.c_mob_data.sheared == true then
138 self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
142 custom_on_punch = function(self)
143 if self.c_mob_data.sheared == false then
144 self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
145 self.c_mob_data = {sheared=true}
146 local pos = self.object:get_pos()
148 minetest.throw_item(pos,{name="weather:snow_block"})
158 collide_with_objects = false,
159 collisionbox = {-0.225, 0, -0.225, 0.225, 0.675, 0.225},
161 visual_size = {x = 3, y = 3},
162 mesh = "chicken.b3d",
164 --blank out the first two to create adult pig
168 --these are used to anchor a point to the head position
173 debug_head_pos = false,
174 rotational_correction = -math.pi/2,
175 head_directional_offset = 0.2, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
176 head_height_offset = 0.82, --added to the base y position
177 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
178 head_position_correction = vector.new(0,1.8,-0.89),
179 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
180 head_coord = "vertical",
186 automatic_face_movement_dir = 90,
187 automatic_face_movement_max_rotation_per_sec = 300,
188 makes_footstep_sound = false,
190 gravity = {x = 0, y = -9.81, z = 0},
191 movement_type = "walk",
196 item_drop = {"mob:egg","mob:feather"},
197 standing_frame = {x=20,y=20},
198 moving_frame = {x=0,y=20},
199 animation_multiplier = 15,
202 death_rotation = "z",
204 hurt_sound = "chicken_hurt",
205 die_sound = "chicken_die",
209 attacked_hostile = false,
210 attack_type = "punch",
212 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
213 --explosion_power = 7, -- how big the explosion has to be
214 --explosion_time = 3, -- how long it takes for a mob to explode
222 collide_with_objects = false,
223 collisionbox = {-0.37, 0, -0.37, 0.37, 1.75, 0.37},
225 visual_size = {x = 3, y = 3},
226 mesh = "snowman.b3d",
228 "snowman.png","snowman.png","snowman.png","snowman.png","snowman.png","snowman.png",
231 --these are used to anchor a point to the head position
235 --head_bone = "Bone",
236 debug_head_pos = false,
237 head_directional_offset = 0, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
238 head_height_offset = 1.625, --added to the base y position
239 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
240 head_position_correction = vector.new(0,4.6,0),
241 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
242 head_coord = "vertical",
243 --rotational_correction = math.pi/2,
248 automatic_face_movement_dir = -90,
249 automatic_face_movement_max_rotation_per_sec = 300,
250 makes_footstep_sound = false,
252 gravity = {x = 0, y = -9.81, z = 0},
253 movement_type = "walk",
258 item_drop = {"weather:snowball","main:coal","mob:carrot","main:stick"},
259 standing_frame = {x=0,y=0},
260 moving_frame = {x=0,y=0},
261 animation_multiplier = 10,
264 death_rotation = "z",
271 attack_type = "projectile",
272 projectile_type = "weather:snowball",
273 projectile_timer_cooldown = 1,
275 custom_function = function(self,dtime,moveresult)
276 if moveresult and moveresult.touching_ground then
277 local pos = vector.floor(vector.add(self.object:get_pos(),0.5))
279 if self.custom_old_pos and not vector.equals(pos,self.custom_old_pos) then
280 if minetest.get_nodedef(minetest.get_node(pos).name,"buildable_to") == true and minetest.get_nodedef(minetest.get_node(vector.new(pos.x,pos.y-1,pos.z)).name,"buildable_to") == false then
281 minetest.set_node(pos,{name="weather:snow"})
284 self.custom_old_pos = pos
289 custom_timer_function = function(self,dtime)
290 if weather_type and weather_type ~= 1 then
291 self.object:punch(self.object, 2,
293 full_punch_interval=1.5,
294 damage_groups = {damage=2},
305 collide_with_objects = false,
306 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
308 visual_size = {x = 3, y = 3},
311 --blank out the first two to create adult pig
312 "phyg.png","wings.png"
315 --these are used to anchor a point to the head position
320 debug_head_pos = false,
321 head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
322 head_height_offset = 0.8, --added to the base y position
323 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
324 head_position_correction = vector.new(0,3,-0.5),
325 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
326 head_coord = "horizontal",
331 automatic_face_movement_dir = 0,
332 automatic_face_movement_max_rotation_per_sec = 300,
333 makes_footstep_sound = false,
334 takes_fall_damage = false,
335 make_jump_noise = false,
337 gravity = {x = 0, y = -1, z = 0},
338 movement_type = "walk",
343 item_drop = "main:gold",
347 standing_frame = {x=0,y=0},
348 moving_frame = {x=0,y=40},
349 animation_multiplier = 20,
352 death_rotation = "x",
355 die_sound = "pig_die",
359 attacked_hostile = false,
360 attack_type = "punch",
362 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
363 --explosion_power = 7, -- how big the explosion has to be
364 --explosion_time = 3, -- how long it takes for a mob to explode
371 mobname = "big_slime",
373 collide_with_objects = false,
374 collisionbox = {-1.25, 0, -1.25, 1.25, 2.5, 1.25},
376 visual_size = {x = 15, y = 15},
381 collision_boundary = 2.5,
384 automatic_face_movement_dir = 90,
385 automatic_face_movement_max_rotation_per_sec = 300,
386 makes_footstep_sound = false,
388 gravity = {x = 0, y = -9.81, z = 0},
389 movement_type = "jump",
390 make_jump_noise = true,
395 death_rotation = "z",
396 hurt_sound = "slime_die",
397 die_sound = "slime_die",
398 attack_type = "punch",
400 custom_on_death = function(self)
401 local pos = self.object:get_pos()
403 minetest.add_entity(pos,"mob:medium_slime")
411 mobname = "medium_slime",
413 collide_with_objects = false,
414 collisionbox = {-0.625, 0, -0.625, 0.625, 1.25, 0.625},
416 visual_size = {x = 7.5, y = 7.5},
423 automatic_face_movement_dir = 90,
424 automatic_face_movement_max_rotation_per_sec = 300,
425 makes_footstep_sound = false,
427 gravity = {x = 0, y = -9.81, z = 0},
428 movement_type = "jump",
429 make_jump_noise = true,
434 death_rotation = "z",
435 hurt_sound = "slime_die",
436 die_sound = "slime_die",
438 attack_type = "punch",
439 custom_on_death = function(self)
440 local pos = self.object:get_pos()
443 minetest.add_entity(pos,"mob:small_slime")
451 mobname = "small_slime",
453 collide_with_objects = false,
454 collisionbox = {-0.3, 0, -0.3, 0.3, 0.6, 0.3},
456 visual_size = {x = 3.7, y = 3.7},
463 automatic_face_movement_dir = 90,
464 automatic_face_movement_max_rotation_per_sec = 300,
465 makes_footstep_sound = false,
467 gravity = {x = 0, y = -9.81, z = 0},
468 movement_type = "jump",
469 make_jump_noise = true,
474 death_rotation = "z",
475 hurt_sound = "slime_die",
476 die_sound = "slime_die",
478 attack_type = "punch",
479 item_drop = "mob:slimeball"
490 collide_with_objects = false,
491 collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
493 visual_size = {x = 3, y = 3},
496 "creepig_body.png","creepig_leg.png","creepig_leg.png","creepig_leg.png","creepig_leg.png"
500 automatic_face_movement_dir = -90.0,
501 automatic_face_movement_max_rotation_per_sec = 300,
502 makes_footstep_sound = false,
504 gravity = {x = 0, y = -9.81, z = 0},
505 movement_type = "walk",
510 item_drop = "mob:cooked_porkchop",
512 standing_frame = {x=0,y=0},
513 moving_frame = {x=5,y=15},
514 animation_multiplier = 5,
517 has_head = true, --remove this when mesh based head rotation is implemented
518 head_visual = "mesh",
519 head_visual_size = {x = 1.1, y = 1.1},
520 head_mesh = "pig_head.x",
521 head_textures ={"creepig_head.png","creepig_nose.png"},
522 head_mount = vector.new(0,1.2,1.9),
524 death_rotation = "z",
527 die_sound = "pig_die",
529 attack_type = "explode",
530 --projectile_timer_cooldown = 5,
531 --projectile_type = "tnt:tnt",
533 explosion_radius = 2, -- how far away the mob has to be to initialize the explosion
534 explosion_power = 7, -- how big the explosion has to be
535 explosion_time = 5, -- how long it takes for a mob to explode
538 die_in_light_level = 12,
548 collide_with_objects = false,
549 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
551 visual_size = {x = 3.2, y = 3.2},
552 mesh = "creeper.b3d",
558 automatic_face_movement_max_rotation_per_sec = 300,
559 makes_footstep_sound = false,
561 gravity = {x = 0, y = -9.81, z = 0},
562 movement_type = "walk",
565 hostile_cooldown = false,
568 item_drop = "mob:gunpowder",
570 standing_frame = {x=0,y=0},
571 moving_frame = {x=0,y=40},
572 animation_multiplier = 20,
576 --these are used to anchor a point to the head position
578 automatic_face_movement_dir = 0,
580 debug_head_pos = false,
581 --this always has to be slightly positive
582 head_directional_offset = 0.01,
583 head_height_offset = 1.45, --added to the base y position
584 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
585 head_position_correction = vector.new(0,2.4,0),
586 head_coord = "vertical",
590 death_rotation = "x",
592 hurt_sound = "creeper_hurt",
593 die_sound = "creeper_hurt",
595 attack_type = "explode",
596 --projectile_timer_cooldown = 5,
597 --projectile_type = "tnt:tnt",
599 explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
600 explosion_power = 4, -- how big the explosion has to be
601 explosion_time = 3, -- how long it takes for a mob to explode
603 die_in_light = false,
604 --die_in_light_level = 12,
612 collide_with_objects = false,
613 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
615 visual_size = {x = 3.2, y = 3.2},
616 mesh = "creeper.b3d",
622 automatic_face_movement_max_rotation_per_sec = 300,
623 makes_footstep_sound = false,
625 gravity = {x = 0, y = -9.81, z = 0},
626 movement_type = "walk",
629 hostile_cooldown = false,
632 item_drop = "mob:gunpowder",
634 standing_frame = {x=0,y=0},
635 moving_frame = {x=0,y=40},
636 animation_multiplier = 20,
640 --these are used to anchor a point to the head position
642 automatic_face_movement_dir = 0,
644 debug_head_pos = false,
645 --this always has to be slightly positive
646 head_directional_offset = 0.01,
647 head_height_offset = 1.45, --added to the base y position
648 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
649 head_position_correction = vector.new(0,2.4,0),
650 head_coord = "vertical",
653 damage_color = "blue",
655 death_rotation = "x",
657 hurt_sound = "creeper_hurt",
658 die_sound = "creeper_hurt",
660 attack_type = "explode",
661 explosion_type = "weather:snow_block",
662 --projectile_timer_cooldown = 5,
663 --projectile_type = "tnt:tnt",
665 explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
666 explosion_power = 4, -- how big the explosion has to be
667 explosion_time = 3, -- how long it takes for a mob to explode
669 die_in_light = false,
670 --die_in_light_level = 12,
677 mobname = "nitro_creeper",
679 collide_with_objects = false,
680 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
682 visual_size = {x = 3.2, y = 3.2},
683 mesh = "creeper.b3d",
689 automatic_face_movement_max_rotation_per_sec = 300,
690 makes_footstep_sound = false,
692 gravity = {x = 0, y = -9.81, z = 0},
693 movement_type = "walk",
696 hostile_cooldown = false,
699 item_drop = "mob:gunpowder",
701 damage_color = "blue",
703 standing_frame = {x=0,y=0},
704 moving_frame = {x=0,y=40},
705 animation_multiplier = 20,
709 --these are used to anchor a point to the head position
711 automatic_face_movement_dir = 0,
713 debug_head_pos = false,
714 --this always has to be slightly positive
715 head_directional_offset = 0.01,
716 head_height_offset = 1.45, --added to the base y position
717 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
718 head_position_correction = vector.new(0,2.4,0),
719 head_coord = "vertical",
723 death_rotation = "x",
725 hurt_sound = "creeper_hurt",
726 die_sound = "creeper_hurt",
728 attack_type = "explode",
729 --projectile_timer_cooldown = 5,
730 --projectile_type = "tnt:tnt",
732 explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
733 explosion_power = 14, -- how big the explosion is (radius)
734 explosion_time = 3, -- how long it takes for a mob to explode
735 explosion_blink_timer = 0.1, -- how fast the blinking happens
737 die_in_light = false,
738 --die_in_light_level = 12,
742 local spider_eyes = {}
744 spider_eyes.initial_properties = {
746 mesh = "spider_eyes.b3d",
747 textures = {"spider_eyes.png"},
749 collisionbox = {0, 0, 0, 0, 0, 0}
751 spider_eyes.glow = -1
752 spider_eyes.on_step = function(self)
753 if not self.owner or not self.owner:get_luaentity() then
756 local owner_head_bone = self.owner:get_luaentity().head_bone
757 local position,rotation = self.owner:get_bone_position(owner_head_bone)
758 self.object:set_attach(self.owner, owner_head_bone, vector.new(0,0,0), rotation)
761 minetest.register_entity("mob:spider_eyes",spider_eyes)
767 collide_with_objects = false,
768 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
770 visual_size = {x = 3, y = 3},
776 --these are used to anchor a point to the head position
778 head_bone = "body.head",
779 debug_head_pos = false,
780 rotational_correction = -math.pi/2,
781 head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
782 head_height_offset = 0.63, --added to the base y position
783 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
784 head_position_correction = vector.new(0,1.24,0),
785 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
786 head_coord = "horizontal",
791 automatic_face_movement_dir = 90,
792 automatic_face_movement_max_rotation_per_sec = 300,
793 makes_footstep_sound = false,
795 gravity = {x = 0, y = -9.81, z = 0},
796 movement_type = "walk",
801 item_drop = "mob:string",
802 standing_frame = {x=21,y=21},
803 moving_frame = {x=0,y=20},
804 animation_multiplier = 20,
807 death_rotation = "z",
809 hurt_sound = "spider",
810 die_sound = "spider_die",
816 friendly_in_daylight = true,
817 attacked_hostile = true,
819 attack_type = "punch",
822 custom_on_activate = function(self)
823 local eyes = minetest.add_entity(self.object:get_pos(), "mob:spider_eyes")
824 eyes:set_attach(self.object, "body.head", vector.new(0,0,0), vector.new(0,0,0))
825 eyes:get_luaentity().owner = self.object
826 if math.random() > 0.998 then
827 local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
828 local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
829 local obj3 = minetest.add_entity(self.object:get_pos(),"boat:boat")
831 obj2:get_luaentity().timer = 7
832 obj2:get_luaentity().radius = 7
834 obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
835 obj2:set_attach(obj,"",vector.new(0,4.5,0),vector.new(0,90,0))
836 obj3:set_attach(obj2,"",vector.new(0,6.5,0),vector.new(0,0,0))
838 obj:set_properties({visual_size={x=1,y=1}})
839 obj2:set_properties({visual_size={x=1/3,y=1/3}})
842 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
843 --explosion_power = 7, -- how big the explosion has to be
844 --explosion_time = 3, -- how long it takes for a mob to explode
852 collide_with_objects = false,
853 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
855 visual_size = {x = 3, y = 3},
861 --these are used to anchor a point to the head position
863 head_bone = "body.head",
864 debug_head_pos = false,
865 rotational_correction = -math.pi/2,
866 head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
867 head_height_offset = 0.63, --added to the base y position
868 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
869 head_position_correction = vector.new(0,1.24,0),
870 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
871 head_coord = "horizontal",
876 automatic_face_movement_dir = 90,
877 automatic_face_movement_max_rotation_per_sec = 300,
878 makes_footstep_sound = false,
880 gravity = {x = 0, y = -9.81, z = 0},
881 movement_type = "walk",
886 item_drop = "mob:string",
887 standing_frame = {x=21,y=21},
888 moving_frame = {x=0,y=20},
889 animation_multiplier = 20,
892 death_rotation = "z",
894 hurt_sound = "spider",
895 die_sound = "spider_die",
901 friendly_in_daylight = true,
902 attacked_hostile = true,
904 attack_type = "punch",
907 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
908 --explosion_power = 7, -- how big the explosion has to be
909 --explosion_time = 3, -- how long it takes for a mob to explode