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",
72 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
73 --explosion_power = 7, -- how big the explosion has to be
74 --explosion_time = 3, -- how long it takes for a mob to explode
76 visual_size = vector.new(1/3,2/3,1/3),
77 position = vector.new(0,3,0),
86 collide_with_objects = false,
87 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
89 visual_size = {x = 3, y = 3},
92 "sheep_head_wool.png","sheep_wool.png","sheep.png"
93 --"sheep_head_shaved.png","nothing.png","sheep.png"
96 --these are used to anchor a point to the head position
101 debug_head_pos = false,
102 head_directional_offset = 0.571, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
103 head_height_offset = 1.15, --added to the base y position
104 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
105 head_position_correction = vector.new(0,4.1,-0.86),
106 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
107 head_coord = "horizontal",
112 automatic_face_movement_dir = 0,
113 automatic_face_movement_max_rotation_per_sec = 300,
114 makes_footstep_sound = false,
116 gravity = {x = 0, y = -9.81, z = 0},
117 movement_type = "walk",
122 item_drop = "mob:raw_porkchop",
123 standing_frame = {x=0,y=0},
124 moving_frame = {x=0,y=40},
125 animation_multiplier = 20,
128 death_rotation = "x",
130 hurt_sound = "sheep",
135 attacked_hostile = false,
136 attack_type = "punch",
139 c_mob_data = {sheared = false},
141 custom_on_activate = function(self)
142 --print(dump(self.c_mob_data))
143 if self.c_mob_data.sheared == true then
144 self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
148 custom_on_punch = function(self)
149 if self.c_mob_data.sheared == false then
150 self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
151 self.c_mob_data = {sheared=true}
152 local pos = self.object:get_pos()
154 minetest.throw_item(pos,{name="weather:snow_block"})
158 visual_size = vector.new(1/3,2/3,1/3),
159 position = vector.new(0,3,0),
169 collide_with_objects = false,
170 collisionbox = {-0.225, 0, -0.225, 0.225, 0.675, 0.225},
172 visual_size = {x = 3, y = 3},
173 mesh = "chicken.b3d",
175 --blank out the first two to create adult pig
179 --these are used to anchor a point to the head position
184 debug_head_pos = false,
185 rotational_correction = -math.pi/2,
186 head_directional_offset = 0.2, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
187 head_height_offset = 0.82, --added to the base y position
188 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
189 head_position_correction = vector.new(0,1.8,-0.89),
190 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
191 head_coord = "vertical",
197 automatic_face_movement_dir = 90,
198 automatic_face_movement_max_rotation_per_sec = 300,
199 makes_footstep_sound = false,
201 gravity = {x = 0, y = -9.81, z = 0},
202 movement_type = "walk",
207 item_drop = {"mob:egg","mob:feather"},
208 standing_frame = {x=20,y=20},
209 moving_frame = {x=0,y=20},
210 animation_multiplier = 15,
213 death_rotation = "z",
215 hurt_sound = "chicken_hurt",
216 die_sound = "chicken_die",
220 attacked_hostile = false,
221 attack_type = "punch",
223 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
224 --explosion_power = 7, -- how big the explosion has to be
225 --explosion_time = 3, -- how long it takes for a mob to explode
227 visual_size = vector.new(1/6,1/2.2,1/6),
228 position = vector.new(0,2.3,0),
237 collide_with_objects = false,
238 collisionbox = {-0.37, 0, -0.37, 0.37, 1.75, 0.37},
240 visual_size = {x = 3, y = 3},
241 mesh = "snowman.b3d",
243 "snowman.png","snowman.png","snowman.png","snowman.png","snowman.png","snowman.png",
246 --these are used to anchor a point to the head position
250 --head_bone = "Bone",
251 debug_head_pos = false,
252 head_directional_offset = 0, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
253 head_height_offset = 1.625, --added to the base y position
254 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
255 head_position_correction = vector.new(0,4.6,0),
256 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
257 head_coord = "vertical",
258 --rotational_correction = math.pi/2,
263 automatic_face_movement_dir = -90,
264 automatic_face_movement_max_rotation_per_sec = 300,
265 makes_footstep_sound = false,
267 gravity = {x = 0, y = -9.81, z = 0},
268 movement_type = "walk",
273 item_drop = {"weather:snowball","main:coal","mob:carrot","main:stick"},
274 standing_frame = {x=0,y=0},
275 moving_frame = {x=0,y=0},
276 animation_multiplier = 10,
279 death_rotation = "z",
286 attack_type = "projectile",
287 projectile_type = "weather:snowball",
288 projectile_timer_cooldown = 1,
290 custom_function = function(self,dtime,moveresult)
291 if moveresult and moveresult.touching_ground then
292 local pos = vector.floor(vector.add(self.object:get_pos(),0.5))
294 if self.custom_old_pos and not vector.equals(pos,self.custom_old_pos) then
295 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
296 minetest.set_node(pos,{name="weather:snow"})
299 self.custom_old_pos = pos
304 custom_timer_function = function(self,dtime)
305 if weather_type and weather_type ~= 1 then
306 self.object:punch(self.object, 2,
308 full_punch_interval=1.5,
309 damage_groups = {damage=2},
314 visual_size = vector.new(1/4,2/3,1/4),
315 position = vector.new(0,3.3,0),
324 collide_with_objects = false,
325 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
327 visual_size = {x = 3, y = 3},
330 --blank out the first two to create adult pig
331 "phyg.png","wings.png"
334 --these are used to anchor a point to the head position
339 debug_head_pos = false,
340 head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
341 head_height_offset = 0.8, --added to the base y position
342 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
343 head_position_correction = vector.new(0,3,-0.5),
344 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
345 head_coord = "horizontal",
350 automatic_face_movement_dir = 0,
351 automatic_face_movement_max_rotation_per_sec = 300,
352 makes_footstep_sound = false,
353 takes_fall_damage = false,
354 make_jump_noise = false,
356 gravity = {x = 0, y = -1, z = 0},
357 movement_type = "walk",
362 item_drop = "main:gold",
366 standing_frame = {x=0,y=0},
367 moving_frame = {x=0,y=40},
368 animation_multiplier = 20,
371 death_rotation = "x",
374 die_sound = "pig_die",
378 attacked_hostile = false,
379 attack_type = "punch",
381 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
382 --explosion_power = 7, -- how big the explosion has to be
383 --explosion_time = 3, -- how long it takes for a mob to explode
385 visual_size = vector.new(1/3,2/3,1/3),
386 position = vector.new(0,3,0),
394 mobname = "big_slime",
396 collide_with_objects = false,
397 collisionbox = {-1.25, 0, -1.25, 1.25, 2.5, 1.25},
399 visual_size = {x = 15, y = 15},
404 collision_boundary = 2.5,
407 automatic_face_movement_dir = 90,
408 automatic_face_movement_max_rotation_per_sec = 300,
409 makes_footstep_sound = false,
411 gravity = {x = 0, y = -9.81, z = 0},
412 movement_type = "jump",
413 make_jump_noise = true,
418 death_rotation = "z",
419 hurt_sound = "slime_die",
420 die_sound = "slime_die",
421 attack_type = "punch",
423 custom_on_death = function(self)
424 local pos = self.object:get_pos()
426 local obj = minetest.add_entity(pos,"mob:medium_slime")
432 --this is used to properly position fire when the mob catches on fire
434 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
435 position = vector.new(0,1.5,0),
442 mobname = "medium_slime",
444 collide_with_objects = false,
445 collisionbox = {-0.625, 0, -0.625, 0.625, 1.25, 0.625},
447 visual_size = {x = 7.5, y = 7.5},
454 automatic_face_movement_dir = 90,
455 automatic_face_movement_max_rotation_per_sec = 300,
456 makes_footstep_sound = false,
458 gravity = {x = 0, y = -9.81, z = 0},
459 movement_type = "jump",
460 make_jump_noise = true,
465 death_rotation = "z",
466 hurt_sound = "slime_die",
467 die_sound = "slime_die",
469 attack_type = "punch",
470 custom_on_death = function(self)
471 local pos = self.object:get_pos()
474 local obj = minetest.add_entity(pos,"mob:small_slime")
481 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
482 position = vector.new(0,1.5,0),
489 mobname = "small_slime",
491 collide_with_objects = false,
492 collisionbox = {-0.3, 0, -0.3, 0.3, 0.6, 0.3},
494 visual_size = {x = 3.7, y = 3.7},
501 automatic_face_movement_dir = 90,
502 automatic_face_movement_max_rotation_per_sec = 300,
503 makes_footstep_sound = false,
505 gravity = {x = 0, y = -9.81, z = 0},
506 movement_type = "jump",
507 make_jump_noise = true,
512 death_rotation = "z",
513 hurt_sound = "slime_die",
514 die_sound = "slime_die",
516 attack_type = "punch",
517 item_drop = "mob:slimeball",
519 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
520 position = vector.new(0,1.5,0),
532 collide_with_objects = false,
533 collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
535 visual_size = {x = 3, y = 3},
538 "creepig_body.png","creepig_leg.png","creepig_leg.png","creepig_leg.png","creepig_leg.png"
542 automatic_face_movement_dir = -90.0,
543 automatic_face_movement_max_rotation_per_sec = 300,
544 makes_footstep_sound = false,
546 gravity = {x = 0, y = -9.81, z = 0},
547 movement_type = "walk",
552 item_drop = "mob:cooked_porkchop",
554 standing_frame = {x=0,y=0},
555 moving_frame = {x=5,y=15},
556 animation_multiplier = 5,
559 has_head = true, --remove this when mesh based head rotation is implemented
560 head_visual = "mesh",
561 head_visual_size = {x = 1.1, y = 1.1},
562 head_mesh = "pig_head.x",
563 head_textures ={"creepig_head.png","creepig_nose.png"},
564 head_mount = vector.new(0,1.2,1.9),
566 death_rotation = "z",
569 die_sound = "pig_die",
571 attack_type = "explode",
572 --projectile_timer_cooldown = 5,
573 --projectile_type = "tnt:tnt",
575 explosion_radius = 2, -- how far away the mob has to be to initialize the explosion
576 explosion_power = 7, -- how big the explosion has to be
577 explosion_time = 5, -- how long it takes for a mob to explode
580 die_in_light_level = 12,
590 collide_with_objects = false,
591 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
593 visual_size = {x = 3.2, y = 3.2},
594 mesh = "creeper.b3d",
600 automatic_face_movement_max_rotation_per_sec = 300,
601 makes_footstep_sound = false,
603 gravity = {x = 0, y = -9.81, z = 0},
604 movement_type = "walk",
607 hostile_cooldown = false,
610 item_drop = "mob:gunpowder",
612 standing_frame = {x=0,y=0},
613 moving_frame = {x=0,y=40},
614 animation_multiplier = 20,
618 --these are used to anchor a point to the head position
620 automatic_face_movement_dir = 0,
622 debug_head_pos = false,
623 --this always has to be slightly positive
624 head_directional_offset = 0.01,
625 head_height_offset = 1.45, --added to the base y position
626 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
627 head_position_correction = vector.new(0,2.4,0),
628 head_coord = "vertical",
632 death_rotation = "x",
634 hurt_sound = "creeper_hurt",
635 die_sound = "creeper_hurt",
637 attack_type = "explode",
638 --projectile_timer_cooldown = 5,
639 --projectile_type = "tnt:tnt",
641 explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
642 explosion_power = 4, -- how big the explosion has to be
643 explosion_time = 3, -- how long it takes for a mob to explode
645 die_in_light = false,
646 --die_in_light_level = 12,
648 visual_size = vector.new(1/4,2/3,1/4),
649 position = vector.new(0,3.3,0),
658 collide_with_objects = false,
659 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
661 visual_size = {x = 3.2, y = 3.2},
662 mesh = "creeper.b3d",
668 automatic_face_movement_max_rotation_per_sec = 300,
669 makes_footstep_sound = false,
671 gravity = {x = 0, y = -9.81, z = 0},
672 movement_type = "walk",
675 hostile_cooldown = false,
678 item_drop = "mob:gunpowder",
680 standing_frame = {x=0,y=0},
681 moving_frame = {x=0,y=40},
682 animation_multiplier = 20,
686 --these are used to anchor a point to the head position
688 automatic_face_movement_dir = 0,
690 debug_head_pos = false,
691 --this always has to be slightly positive
692 head_directional_offset = 0.01,
693 head_height_offset = 1.45, --added to the base y position
694 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
695 head_position_correction = vector.new(0,2.4,0),
696 head_coord = "vertical",
699 damage_color = "blue",
701 death_rotation = "x",
703 hurt_sound = "creeper_hurt",
704 die_sound = "creeper_hurt",
706 attack_type = "explode",
707 explosion_type = "weather:snow_block",
708 --projectile_timer_cooldown = 5,
709 --projectile_type = "tnt:tnt",
711 explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
712 explosion_power = 4, -- how big the explosion has to be
713 explosion_time = 3, -- how long it takes for a mob to explode
715 die_in_light = false,
716 --die_in_light_level = 12,
718 visual_size = vector.new(1/4,2/3,1/4),
719 position = vector.new(0,3.3,0),
727 mobname = "nitro_creeper",
729 collide_with_objects = false,
730 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
732 visual_size = {x = 3.2, y = 3.2},
733 mesh = "creeper.b3d",
739 automatic_face_movement_max_rotation_per_sec = 300,
740 makes_footstep_sound = false,
742 gravity = {x = 0, y = -9.81, z = 0},
743 movement_type = "walk",
746 hostile_cooldown = false,
749 item_drop = "mob:gunpowder",
751 damage_color = "blue",
753 standing_frame = {x=0,y=0},
754 moving_frame = {x=0,y=40},
755 animation_multiplier = 20,
759 --these are used to anchor a point to the head position
761 automatic_face_movement_dir = 0,
763 debug_head_pos = false,
764 --this always has to be slightly positive
765 head_directional_offset = 0.01,
766 head_height_offset = 1.45, --added to the base y position
767 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
768 head_position_correction = vector.new(0,2.4,0),
769 head_coord = "vertical",
773 death_rotation = "x",
775 hurt_sound = "creeper_hurt",
776 die_sound = "creeper_hurt",
778 attack_type = "explode",
779 --projectile_timer_cooldown = 5,
780 --projectile_type = "tnt:tnt",
782 explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
783 explosion_power = 14, -- how big the explosion is (radius)
784 explosion_time = 3, -- how long it takes for a mob to explode
785 explosion_blink_timer = 0.1, -- how fast the blinking happens
787 die_in_light = false,
788 --die_in_light_level = 12,
790 visual_size = vector.new(1/4,2/3,1/4),
791 position = vector.new(0,3.3,0),
796 local spider_eyes = {}
798 spider_eyes.initial_properties = {
800 mesh = "spider_eyes.b3d",
801 textures = {"spider_eyes.png"},
803 collisionbox = {0, 0, 0, 0, 0, 0}
805 spider_eyes.glow = -1
806 spider_eyes.on_step = function(self)
807 if not self.owner or not self.owner:get_luaentity() then
810 local owner_head_bone = self.owner:get_luaentity().head_bone
811 local position,rotation = self.owner:get_bone_position(owner_head_bone)
812 self.object:set_attach(self.owner, owner_head_bone, vector.new(0,0,0), rotation)
815 minetest.register_entity("mob:spider_eyes",spider_eyes)
821 collide_with_objects = false,
822 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
824 visual_size = {x = 3, y = 3},
830 --these are used to anchor a point to the head position
832 head_bone = "body.head",
833 debug_head_pos = false,
834 rotational_correction = -math.pi/2,
835 head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
836 head_height_offset = 0.63, --added to the base y position
837 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
838 head_position_correction = vector.new(0,1.24,0),
839 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
840 head_coord = "horizontal",
845 automatic_face_movement_dir = 90,
846 automatic_face_movement_max_rotation_per_sec = 300,
847 makes_footstep_sound = false,
849 gravity = {x = 0, y = -9.81, z = 0},
850 movement_type = "walk",
855 item_drop = "mob:string",
856 standing_frame = {x=21,y=21},
857 moving_frame = {x=0,y=20},
858 animation_multiplier = 20,
861 death_rotation = "z",
863 hurt_sound = "spider",
864 die_sound = "spider_die",
870 friendly_in_daylight = true,
871 attacked_hostile = true,
873 attack_type = "punch",
876 custom_on_activate = function(self)
877 local eyes = minetest.add_entity(self.object:get_pos(), "mob:spider_eyes")
878 eyes:set_attach(self.object, "body.head", vector.new(0,0,0), vector.new(0,0,0))
879 eyes:get_luaentity().owner = self.object
880 if math.random() > 0.998 then
881 local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
882 local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
883 local obj3 = minetest.add_entity(self.object:get_pos(),"boat:boat")
885 obj2:get_luaentity().timer = 7
886 obj2:get_luaentity().radius = 7
888 obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
889 obj2:set_attach(obj,"",vector.new(0,4.5,0),vector.new(0,90,0))
890 obj3:set_attach(obj2,"",vector.new(0,6.5,0),vector.new(0,0,0))
892 obj:set_properties({visual_size={x=1,y=1}})
893 obj2:set_properties({visual_size={x=1/3,y=1/3}})
896 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
897 --explosion_power = 7, -- how big the explosion has to be
898 --explosion_time = 3, -- how long it takes for a mob to explode
899 --this is used to properly position fire when the mob catches on fire
901 visual_size = vector.new(1.3/3,2/3,1.3/3),
902 position = vector.new(0,4,0),
911 collide_with_objects = false,
912 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
914 visual_size = {x = 3, y = 3},
920 --these are used to anchor a point to the head position
922 head_bone = "body.head",
923 debug_head_pos = false,
924 rotational_correction = -math.pi/2,
925 head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
926 head_height_offset = 0.63, --added to the base y position
927 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
928 head_position_correction = vector.new(0,1.24,0),
929 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
930 head_coord = "horizontal",
935 automatic_face_movement_dir = 90,
936 automatic_face_movement_max_rotation_per_sec = 300,
937 makes_footstep_sound = false,
939 gravity = {x = 0, y = -9.81, z = 0},
940 movement_type = "walk",
945 item_drop = "mob:string",
946 standing_frame = {x=21,y=21},
947 moving_frame = {x=0,y=20},
948 animation_multiplier = 20,
951 death_rotation = "z",
953 hurt_sound = "spider",
954 die_sound = "spider_die",
960 friendly_in_daylight = true,
961 attacked_hostile = true,
963 attack_type = "punch",
966 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
967 --explosion_power = 7, -- how big the explosion has to be
968 --explosion_time = 3, -- how long it takes for a mob to explode
970 visual_size = vector.new(1.3/3,2/3,1.3/3),
971 position = vector.new(0,4,0),