1 local minetest,math,vector = minetest,math,vector
2 --this is where mobs are defined
4 --this is going to be used to set an active mob limit
7 local path = minetest.get_modpath(minetest.get_current_modname())
9 dofile(path.."/spawning.lua")
10 dofile(path.."/api/api_hook.lua")
11 dofile(path.."/items.lua")
12 dofile(path.."/chatcommands.lua")
19 collide_with_objects = false,
20 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
22 visual_size = {x = 3, y = 3},
25 --blank out the first two to create adult pig
29 --these are used to anchor a point to the head position
34 debug_head_pos = false,
35 head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
36 head_height_offset = 0.8, --added to the base y position
37 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
38 head_position_correction = vector.new(0,3,-0.5),
39 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
40 head_coord = "horizontal",
45 automatic_face_movement_dir = 0,
46 automatic_face_movement_max_rotation_per_sec = 300,
47 makes_footstep_sound = false,
49 gravity = {x = 0, y = -9.81, z = 0},
50 movement_type = "walk",
55 item_drop = "mob:raw_porkchop",
56 standing_frame = {x=0,y=0},
57 moving_frame = {x=0,y=40},
58 animation_multiplier = 20,
64 die_sound = "pig_die",
68 attacked_hostile = false,
69 attack_type = "punch",
73 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
74 --explosion_power = 7, -- how big the explosion has to be
75 --explosion_time = 3, -- how long it takes for a mob to explode
77 visual_size = vector.new(1/3,2/3,1/3),
78 position = vector.new(0,3,0),
87 collide_with_objects = false,
88 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
90 visual_size = {x = 3, y = 3},
93 "sheep_head_wool.png","sheep_wool.png","sheep.png"
94 --"sheep_head_shaved.png","nothing.png","sheep.png"
97 --these are used to anchor a point to the head position
102 debug_head_pos = false,
103 head_directional_offset = 0.571, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
104 head_height_offset = 1.15, --added to the base y position
105 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
106 head_position_correction = vector.new(0,4.1,-0.86),
107 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
108 head_coord = "horizontal",
113 automatic_face_movement_dir = 0,
114 automatic_face_movement_max_rotation_per_sec = 300,
115 makes_footstep_sound = false,
117 gravity = {x = 0, y = -9.81, z = 0},
118 movement_type = "walk",
123 item_drop = "mob:raw_porkchop",
124 standing_frame = {x=0,y=0},
125 moving_frame = {x=0,y=40},
126 animation_multiplier = 20,
129 death_rotation = "x",
131 hurt_sound = "sheep",
136 attacked_hostile = false,
137 attack_type = "punch",
140 c_mob_data = {sheared = false},
142 custom_on_activate = function(self)
143 --print(dump(self.c_mob_data))
144 if self.c_mob_data.sheared == true then
145 self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
149 custom_on_punch = function(self)
150 if self.c_mob_data.sheared == false then
151 self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
152 self.c_mob_data = {sheared=true}
153 local pos = self.object:get_pos()
155 minetest.throw_item(pos,{name="weather:snow_block"})
159 visual_size = vector.new(1/3,2/3,1/3),
160 position = vector.new(0,3,0),
170 collide_with_objects = false,
171 collisionbox = {-0.225, 0, -0.225, 0.225, 0.675, 0.225},
173 visual_size = {x = 3, y = 3},
174 mesh = "chicken.b3d",
176 --blank out the first two to create adult pig
180 --these are used to anchor a point to the head position
185 debug_head_pos = false,
186 rotational_correction = -math.pi/2,
187 head_directional_offset = 0.2, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
188 head_height_offset = 0.82, --added to the base y position
189 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
190 head_position_correction = vector.new(0,1.8,-0.89),
191 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
192 head_coord = "vertical",
198 automatic_face_movement_dir = 90,
199 automatic_face_movement_max_rotation_per_sec = 300,
200 makes_footstep_sound = false,
202 gravity = {x = 0, y = -9.81, z = 0},
203 movement_type = "walk",
208 item_drop = {"mob:egg","mob:feather"},
209 standing_frame = {x=20,y=20},
210 moving_frame = {x=0,y=20},
211 animation_multiplier = 15,
214 death_rotation = "z",
216 hurt_sound = "chicken_hurt",
217 die_sound = "chicken_die",
221 attacked_hostile = false,
222 attack_type = "punch",
224 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
225 --explosion_power = 7, -- how big the explosion has to be
226 --explosion_time = 3, -- how long it takes for a mob to explode
228 visual_size = vector.new(1/6,1/2.2,1/6),
229 position = vector.new(0,2.3,0),
238 collide_with_objects = false,
239 collisionbox = {-0.37, 0, -0.37, 0.37, 1.75, 0.37},
241 visual_size = {x = 9, y = 9},
242 mesh = "snowman.b3d",
244 "snowman.png","snowman.png","snowman.png","snowman.png","snowman.png","snowman.png",
247 --these are used to anchor a point to the head position
252 debug_head_pos = false,
253 rotational_correction = math.pi/2,
254 head_directional_offset = 0.01, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
255 head_height_offset = 1.65, --added to the base y position
256 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
257 head_position_correction = vector.new(0,0.6,0),
258 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
259 head_coord = "vertical",
265 automatic_face_movement_dir = -90,
266 automatic_face_movement_max_rotation_per_sec = 300,
267 makes_footstep_sound = false,
269 gravity = {x = 0, y = -9.81, z = 0},
270 movement_type = "walk",
275 item_drop = {"weather:snowball","main:coal","mob:carrot","main:stick"},
276 standing_frame = {x=0,y=0},
277 moving_frame = {x=0,y=0},
278 animation_multiplier = 10,
281 death_rotation = "z",
288 attack_type = "projectile",
289 projectile_type = "weather:snowball",
290 projectile_timer_cooldown = 1,
292 custom_function = function(self,dtime,moveresult)
293 if moveresult and moveresult.touching_ground then
294 local pos = vector.floor(vector.add(self.object:get_pos(),0.5))
296 if self.custom_old_pos and not vector.equals(pos,self.custom_old_pos) then
297 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
298 minetest.set_node(pos,{name="weather:snow"})
301 self.custom_old_pos = pos
306 custom_timer_function = function(self,dtime)
307 if weather_type and weather_type ~= 1 then
308 self.object:punch(self.object, 2,
310 full_punch_interval=1.5,
311 damage_groups = {damage=2},
316 visual_size = vector.new(1/4,2/3,1/4),
317 position = vector.new(0,3.3,0),
326 collide_with_objects = false,
327 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
329 visual_size = {x = 3, y = 3},
332 --blank out the first two to create adult pig
333 "phyg.png","wings.png"
336 --these are used to anchor a point to the head position
341 debug_head_pos = false,
342 head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
343 head_height_offset = 0.8, --added to the base y position
344 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
345 head_position_correction = vector.new(0,3,-0.5),
346 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
347 head_coord = "horizontal",
352 automatic_face_movement_dir = 0,
353 automatic_face_movement_max_rotation_per_sec = 300,
354 makes_footstep_sound = false,
355 takes_fall_damage = false,
356 make_jump_noise = false,
358 gravity = {x = 0, y = -1, z = 0},
359 movement_type = "walk",
364 item_drop = "main:gold",
368 standing_frame = {x=0,y=0},
369 moving_frame = {x=0,y=40},
370 animation_multiplier = 20,
373 death_rotation = "x",
376 die_sound = "pig_die",
380 attacked_hostile = false,
381 attack_type = "punch",
383 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
384 --explosion_power = 7, -- how big the explosion has to be
385 --explosion_time = 3, -- how long it takes for a mob to explode
387 visual_size = vector.new(1/3,2/3,1/3),
388 position = vector.new(0,3,0),
396 mobname = "big_slime",
398 collide_with_objects = false,
399 collisionbox = {-1.25, 0, -1.25, 1.25, 2.5, 1.25},
401 visual_size = {x = 15, y = 15},
406 collision_boundary = 2.5,
409 automatic_face_movement_dir = 90,
410 automatic_face_movement_max_rotation_per_sec = 300,
411 makes_footstep_sound = false,
413 gravity = {x = 0, y = -9.81, z = 0},
414 movement_type = "jump",
415 make_jump_noise = true,
420 death_rotation = "z",
421 hurt_sound = "slime_die",
422 die_sound = "slime_die",
423 attack_type = "punch",
425 custom_on_death = function(self)
426 local pos = self.object:get_pos()
428 local obj = minetest.add_entity(pos,"mob:medium_slime")
434 --this is used to properly position fire when the mob catches on fire
436 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
437 position = vector.new(0,1.5,0),
444 mobname = "medium_slime",
446 collide_with_objects = false,
447 collisionbox = {-0.625, 0, -0.625, 0.625, 1.25, 0.625},
449 visual_size = {x = 7.5, y = 7.5},
456 automatic_face_movement_dir = 90,
457 automatic_face_movement_max_rotation_per_sec = 300,
458 makes_footstep_sound = false,
460 gravity = {x = 0, y = -9.81, z = 0},
461 movement_type = "jump",
462 make_jump_noise = true,
467 death_rotation = "z",
468 hurt_sound = "slime_die",
469 die_sound = "slime_die",
471 attack_type = "punch",
472 custom_on_death = function(self)
473 local pos = self.object:get_pos()
476 local obj = minetest.add_entity(pos,"mob:small_slime")
483 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
484 position = vector.new(0,1.5,0),
491 mobname = "small_slime",
493 collide_with_objects = false,
494 collisionbox = {-0.3, 0, -0.3, 0.3, 0.6, 0.3},
496 visual_size = {x = 3.7, y = 3.7},
503 automatic_face_movement_dir = 90,
504 automatic_face_movement_max_rotation_per_sec = 300,
505 makes_footstep_sound = false,
507 gravity = {x = 0, y = -9.81, z = 0},
508 movement_type = "jump",
509 make_jump_noise = true,
514 death_rotation = "z",
515 hurt_sound = "slime_die",
516 die_sound = "slime_die",
518 attack_type = "punch",
519 item_drop = "mob:slimeball",
521 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
522 position = vector.new(0,1.5,0),
534 collide_with_objects = false,
535 collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
537 visual_size = {x = 3, y = 3},
540 "creepig_body.png","creepig_leg.png","creepig_leg.png","creepig_leg.png","creepig_leg.png"
544 automatic_face_movement_dir = -90.0,
545 automatic_face_movement_max_rotation_per_sec = 300,
546 makes_footstep_sound = false,
548 gravity = {x = 0, y = -9.81, z = 0},
549 movement_type = "walk",
554 item_drop = "mob:cooked_porkchop",
556 standing_frame = {x=0,y=0},
557 moving_frame = {x=5,y=15},
558 animation_multiplier = 5,
561 has_head = true, --remove this when mesh based head rotation is implemented
562 head_visual = "mesh",
563 head_visual_size = {x = 1.1, y = 1.1},
564 head_mesh = "pig_head.x",
565 head_textures ={"creepig_head.png","creepig_nose.png"},
566 head_mount = vector.new(0,1.2,1.9),
568 death_rotation = "z",
571 die_sound = "pig_die",
573 attack_type = "explode",
574 --projectile_timer_cooldown = 5,
575 --projectile_type = "tnt:tnt",
577 explosion_radius = 2, -- how far away the mob has to be to initialize the explosion
578 explosion_power = 7, -- how big the explosion has to be
579 explosion_time = 5, -- how long it takes for a mob to explode
582 die_in_light_level = 12,
592 collide_with_objects = false,
593 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
595 visual_size = {x = 3.2, y = 3.2},
596 mesh = "creeper.b3d",
602 automatic_face_movement_max_rotation_per_sec = 300,
603 makes_footstep_sound = false,
605 gravity = {x = 0, y = -9.81, z = 0},
606 movement_type = "walk",
609 hostile_cooldown = false,
612 item_drop = "mob:gunpowder",
614 standing_frame = {x=0,y=0},
615 moving_frame = {x=0,y=40},
616 animation_multiplier = 20,
620 --these are used to anchor a point to the head position
622 automatic_face_movement_dir = 0,
624 debug_head_pos = false,
625 --this always has to be slightly positive
626 head_directional_offset = 0.01,
627 head_height_offset = 1.45, --added to the base y position
628 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
629 head_position_correction = vector.new(0,2.4,0),
630 head_coord = "vertical",
634 death_rotation = "x",
636 hurt_sound = "creeper_hurt",
637 die_sound = "creeper_hurt",
639 attack_type = "explode",
640 --projectile_timer_cooldown = 5,
641 --projectile_type = "tnt:tnt",
643 explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
644 explosion_power = 4, -- how big the explosion has to be
645 explosion_time = 3, -- how long it takes for a mob to explode
647 die_in_light = false,
648 --die_in_light_level = 12,
650 visual_size = vector.new(1/4,2/3,1/4),
651 position = vector.new(0,3.3,0),
660 collide_with_objects = false,
661 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
663 visual_size = {x = 3.2, y = 3.2},
664 mesh = "creeper.b3d",
670 automatic_face_movement_max_rotation_per_sec = 300,
671 makes_footstep_sound = false,
673 gravity = {x = 0, y = -9.81, z = 0},
674 movement_type = "walk",
677 hostile_cooldown = false,
680 item_drop = "mob:gunpowder",
682 standing_frame = {x=0,y=0},
683 moving_frame = {x=0,y=40},
684 animation_multiplier = 20,
688 --these are used to anchor a point to the head position
690 automatic_face_movement_dir = 0,
692 debug_head_pos = false,
693 --this always has to be slightly positive
694 head_directional_offset = 0.01,
695 head_height_offset = 1.45, --added to the base y position
696 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
697 head_position_correction = vector.new(0,2.4,0),
698 head_coord = "vertical",
701 damage_color = "blue",
703 death_rotation = "x",
705 hurt_sound = "creeper_hurt",
706 die_sound = "creeper_hurt",
708 attack_type = "explode",
709 explosion_type = "weather:snow_block",
710 --projectile_timer_cooldown = 5,
711 --projectile_type = "tnt:tnt",
713 explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
714 explosion_power = 4, -- how big the explosion has to be
715 explosion_time = 3, -- how long it takes for a mob to explode
717 die_in_light = false,
718 --die_in_light_level = 12,
720 visual_size = vector.new(1/4,2/3,1/4),
721 position = vector.new(0,3.3,0),
729 mobname = "nitro_creeper",
731 collide_with_objects = false,
732 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
734 visual_size = {x = 3.2, y = 3.2},
735 mesh = "creeper.b3d",
741 automatic_face_movement_max_rotation_per_sec = 300,
742 makes_footstep_sound = false,
744 gravity = {x = 0, y = -9.81, z = 0},
745 movement_type = "walk",
748 hostile_cooldown = false,
751 item_drop = "mob:gunpowder",
753 damage_color = "blue",
755 standing_frame = {x=0,y=0},
756 moving_frame = {x=0,y=40},
757 animation_multiplier = 20,
761 --these are used to anchor a point to the head position
763 automatic_face_movement_dir = 0,
765 debug_head_pos = false,
766 --this always has to be slightly positive
767 head_directional_offset = 0.01,
768 head_height_offset = 1.45, --added to the base y position
769 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
770 head_position_correction = vector.new(0,2.4,0),
771 head_coord = "vertical",
775 death_rotation = "x",
777 hurt_sound = "creeper_hurt",
778 die_sound = "creeper_hurt",
780 attack_type = "explode",
781 --projectile_timer_cooldown = 5,
782 --projectile_type = "tnt:tnt",
784 explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
785 explosion_power = 14, -- how big the explosion is (radius)
786 explosion_time = 3, -- how long it takes for a mob to explode
787 explosion_blink_timer = 0.1, -- how fast the blinking happens
789 die_in_light = false,
790 --die_in_light_level = 12,
792 visual_size = vector.new(1/4,2/3,1/4),
793 position = vector.new(0,3.3,0),
798 local spider_eyes = {}
800 spider_eyes.initial_properties = {
802 mesh = "spider_eyes.b3d",
803 textures = {"spider_eyes.png"},
805 collisionbox = {0, 0, 0, 0, 0, 0}
807 spider_eyes.glow = -1
808 spider_eyes.on_step = function(self)
809 if not self.owner or not self.owner:get_luaentity() then
812 local owner_head_bone = self.owner:get_luaentity().head_bone
813 local position,rotation = self.owner:get_bone_position(owner_head_bone)
814 self.object:set_attach(self.owner, owner_head_bone, vector.new(0,0,0), rotation)
817 minetest.register_entity("mob:spider_eyes",spider_eyes)
823 collide_with_objects = false,
824 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
826 visual_size = {x = 3, y = 3},
832 --these are used to anchor a point to the head position
834 head_bone = "body.head",
835 debug_head_pos = false,
836 rotational_correction = -math.pi/2,
837 head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
838 head_height_offset = 0.63, --added to the base y position
839 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
840 head_position_correction = vector.new(0,1.24,0),
841 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
842 head_coord = "horizontal",
847 automatic_face_movement_dir = 90,
848 automatic_face_movement_max_rotation_per_sec = 300,
849 makes_footstep_sound = false,
851 gravity = {x = 0, y = -9.81, z = 0},
852 movement_type = "walk",
857 item_drop = "mob:string",
858 standing_frame = {x=21,y=21},
859 moving_frame = {x=0,y=20},
860 animation_multiplier = 20,
863 death_rotation = "z",
865 hurt_sound = "spider",
866 die_sound = "spider_die",
872 friendly_in_daylight = true,
873 attacked_hostile = true,
875 attack_type = "punch",
878 custom_on_activate = function(self)
879 local eyes = minetest.add_entity(self.object:get_pos(), "mob:spider_eyes")
880 eyes:set_attach(self.object, "body.head", vector.new(0,0,0), vector.new(0,0,0))
881 eyes:get_luaentity().owner = self.object
882 if math.random() > 0.998 then
883 local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
884 local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
885 local obj3 = minetest.add_entity(self.object:get_pos(),"boat:boat")
887 obj2:get_luaentity().timer = 7
888 obj2:get_luaentity().radius = 7
890 obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
891 obj2:set_attach(obj,"",vector.new(0,4.5,0),vector.new(0,90,0))
892 obj3:set_attach(obj2,"",vector.new(0,6.5,0),vector.new(0,0,0))
894 obj:set_properties({visual_size={x=1,y=1}})
895 obj2:set_properties({visual_size={x=1/3,y=1/3}})
898 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
899 --explosion_power = 7, -- how big the explosion has to be
900 --explosion_time = 3, -- how long it takes for a mob to explode
901 --this is used to properly position fire when the mob catches on fire
903 visual_size = vector.new(1.3/3,2/3,1.3/3),
904 position = vector.new(0,4,0),
913 collide_with_objects = false,
914 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
916 visual_size = {x = 3, y = 3},
922 --these are used to anchor a point to the head position
924 head_bone = "body.head",
925 debug_head_pos = false,
926 rotational_correction = -math.pi/2,
927 head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
928 head_height_offset = 0.63, --added to the base y position
929 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
930 head_position_correction = vector.new(0,1.24,0),
931 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
932 head_coord = "horizontal",
937 automatic_face_movement_dir = 90,
938 automatic_face_movement_max_rotation_per_sec = 300,
939 makes_footstep_sound = false,
941 gravity = {x = 0, y = -9.81, z = 0},
942 movement_type = "walk",
947 item_drop = "mob:string",
948 standing_frame = {x=21,y=21},
949 moving_frame = {x=0,y=20},
950 animation_multiplier = 20,
953 death_rotation = "z",
955 hurt_sound = "spider",
956 die_sound = "spider_die",
962 friendly_in_daylight = true,
963 attacked_hostile = true,
965 attack_type = "punch",
968 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
969 --explosion_power = 7, -- how big the explosion has to be
970 --explosion_time = 3, -- how long it takes for a mob to explode
972 visual_size = vector.new(1.3/3,2/3,1.3/3),
973 position = vector.new(0,4,0),