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 attacked_hostile = true,
289 attack_type = "projectile",
290 projectile_type = "weather:snowball",
291 projectile_timer_cooldown = 1,
293 custom_function = function(self,dtime,moveresult)
294 if moveresult and moveresult.touching_ground then
295 local pos = vector.floor(vector.add(self.object:get_pos(),0.5))
297 if self.custom_old_pos and not vector.equals(pos,self.custom_old_pos) then
298 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
299 minetest.set_node(pos,{name="weather:snow"})
302 self.custom_old_pos = pos
307 custom_timer_function = function(self,dtime)
308 if weather_type and weather_type ~= 1 then
309 self.object:punch(self.object, 2,
311 full_punch_interval=1.5,
312 damage_groups = {damage=2},
317 visual_size = vector.new(1/4,2/3,1/4),
318 position = vector.new(0,3.3,0),
327 collide_with_objects = false,
328 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
330 visual_size = {x = 3, y = 3},
333 --blank out the first two to create adult pig
334 "phyg.png","wings.png"
337 --these are used to anchor a point to the head position
342 debug_head_pos = false,
343 head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
344 head_height_offset = 0.8, --added to the base y position
345 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
346 head_position_correction = vector.new(0,3,-0.5),
347 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
348 head_coord = "horizontal",
353 automatic_face_movement_dir = 0,
354 automatic_face_movement_max_rotation_per_sec = 300,
355 makes_footstep_sound = false,
356 takes_fall_damage = false,
357 make_jump_noise = false,
359 gravity = {x = 0, y = -1, z = 0},
360 movement_type = "walk",
365 item_drop = "main:gold",
369 standing_frame = {x=0,y=0},
370 moving_frame = {x=0,y=40},
371 animation_multiplier = 20,
374 death_rotation = "x",
377 die_sound = "pig_die",
381 attacked_hostile = false,
382 attack_type = "punch",
384 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
385 --explosion_power = 7, -- how big the explosion has to be
386 --explosion_time = 3, -- how long it takes for a mob to explode
388 visual_size = vector.new(1/3,2/3,1/3),
389 position = vector.new(0,3,0),
397 mobname = "big_slime",
399 collide_with_objects = false,
400 collisionbox = {-1.25, 0, -1.25, 1.25, 2.5, 1.25},
402 visual_size = {x = 15, y = 15},
407 collision_boundary = 2.5,
410 automatic_face_movement_dir = 90,
411 automatic_face_movement_max_rotation_per_sec = 300,
412 makes_footstep_sound = false,
414 gravity = {x = 0, y = -9.81, z = 0},
415 movement_type = "jump",
416 make_jump_noise = true,
421 death_rotation = "z",
422 hurt_sound = "slime_die",
423 die_sound = "slime_die",
424 attack_type = "punch",
426 custom_on_death = function(self)
427 local pos = self.object:get_pos()
429 local obj = minetest.add_entity(pos,"mob:medium_slime")
435 --this is used to properly position fire when the mob catches on fire
437 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
438 position = vector.new(0,1.5,0),
445 mobname = "medium_slime",
447 collide_with_objects = false,
448 collisionbox = {-0.625, 0, -0.625, 0.625, 1.25, 0.625},
450 visual_size = {x = 7.5, y = 7.5},
457 automatic_face_movement_dir = 90,
458 automatic_face_movement_max_rotation_per_sec = 300,
459 makes_footstep_sound = false,
461 gravity = {x = 0, y = -9.81, z = 0},
462 movement_type = "jump",
463 make_jump_noise = true,
468 death_rotation = "z",
469 hurt_sound = "slime_die",
470 die_sound = "slime_die",
472 attack_type = "punch",
473 custom_on_death = function(self)
474 local pos = self.object:get_pos()
477 local obj = minetest.add_entity(pos,"mob:small_slime")
484 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
485 position = vector.new(0,1.5,0),
492 mobname = "small_slime",
494 collide_with_objects = false,
495 collisionbox = {-0.3, 0, -0.3, 0.3, 0.6, 0.3},
497 visual_size = {x = 3.7, y = 3.7},
504 automatic_face_movement_dir = 90,
505 automatic_face_movement_max_rotation_per_sec = 300,
506 makes_footstep_sound = false,
508 gravity = {x = 0, y = -9.81, z = 0},
509 movement_type = "jump",
510 make_jump_noise = true,
515 death_rotation = "z",
516 hurt_sound = "slime_die",
517 die_sound = "slime_die",
519 attack_type = "punch",
520 item_drop = "mob:slimeball",
522 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
523 position = vector.new(0,1.5,0),
535 collide_with_objects = false,
536 collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
538 visual_size = {x = 3, y = 3},
541 "creepig_body.png","creepig_leg.png","creepig_leg.png","creepig_leg.png","creepig_leg.png"
545 automatic_face_movement_dir = -90.0,
546 automatic_face_movement_max_rotation_per_sec = 300,
547 makes_footstep_sound = false,
549 gravity = {x = 0, y = -9.81, z = 0},
550 movement_type = "walk",
555 item_drop = "mob:cooked_porkchop",
557 standing_frame = {x=0,y=0},
558 moving_frame = {x=5,y=15},
559 animation_multiplier = 5,
562 has_head = true, --remove this when mesh based head rotation is implemented
563 head_visual = "mesh",
564 head_visual_size = {x = 1.1, y = 1.1},
565 head_mesh = "pig_head.x",
566 head_textures ={"creepig_head.png","creepig_nose.png"},
567 head_mount = vector.new(0,1.2,1.9),
569 death_rotation = "z",
572 die_sound = "pig_die",
574 attack_type = "explode",
575 --projectile_timer_cooldown = 5,
576 --projectile_type = "tnt:tnt",
578 explosion_radius = 2, -- how far away the mob has to be to initialize the explosion
579 explosion_power = 7, -- how big the explosion has to be
580 explosion_time = 5, -- how long it takes for a mob to explode
583 die_in_light_level = 12,
593 collide_with_objects = false,
594 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
596 visual_size = {x = 3.2, y = 3.2},
597 mesh = "creeper.b3d",
603 automatic_face_movement_max_rotation_per_sec = 300,
604 makes_footstep_sound = false,
606 gravity = {x = 0, y = -9.81, z = 0},
607 movement_type = "walk",
610 hostile_cooldown = false,
613 item_drop = "mob:gunpowder",
615 standing_frame = {x=0,y=0},
616 moving_frame = {x=0,y=40},
617 animation_multiplier = 20,
621 --these are used to anchor a point to the head position
623 automatic_face_movement_dir = 0,
625 debug_head_pos = false,
626 --this always has to be slightly positive
627 head_directional_offset = 0.01,
628 head_height_offset = 1.45, --added to the base y position
629 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
630 head_position_correction = vector.new(0,2.4,0),
631 head_coord = "vertical",
635 death_rotation = "x",
637 hurt_sound = "creeper_hurt",
638 die_sound = "creeper_hurt",
640 attack_type = "explode",
641 --projectile_timer_cooldown = 5,
642 --projectile_type = "tnt:tnt",
644 explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
645 explosion_power = 4, -- how big the explosion has to be
646 explosion_time = 3, -- how long it takes for a mob to explode
648 die_in_light = false,
649 --die_in_light_level = 12,
651 visual_size = vector.new(1/4,2/3,1/4),
652 position = vector.new(0,3.3,0),
661 collide_with_objects = false,
662 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
664 visual_size = {x = 3.2, y = 3.2},
665 mesh = "creeper.b3d",
671 automatic_face_movement_max_rotation_per_sec = 300,
672 makes_footstep_sound = false,
674 gravity = {x = 0, y = -9.81, z = 0},
675 movement_type = "walk",
678 hostile_cooldown = false,
681 item_drop = "mob:gunpowder",
683 standing_frame = {x=0,y=0},
684 moving_frame = {x=0,y=40},
685 animation_multiplier = 20,
689 --these are used to anchor a point to the head position
691 automatic_face_movement_dir = 0,
693 debug_head_pos = false,
694 --this always has to be slightly positive
695 head_directional_offset = 0.01,
696 head_height_offset = 1.45, --added to the base y position
697 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
698 head_position_correction = vector.new(0,2.4,0),
699 head_coord = "vertical",
702 damage_color = "blue",
704 death_rotation = "x",
706 hurt_sound = "creeper_hurt",
707 die_sound = "creeper_hurt",
709 attack_type = "explode",
710 explosion_type = "weather:snow_block",
711 --projectile_timer_cooldown = 5,
712 --projectile_type = "tnt:tnt",
714 explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
715 explosion_power = 4, -- how big the explosion has to be
716 explosion_time = 3, -- how long it takes for a mob to explode
718 die_in_light = false,
719 --die_in_light_level = 12,
721 visual_size = vector.new(1/4,2/3,1/4),
722 position = vector.new(0,3.3,0),
730 mobname = "nitro_creeper",
732 collide_with_objects = false,
733 collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
735 visual_size = {x = 3.2, y = 3.2},
736 mesh = "creeper.b3d",
742 automatic_face_movement_max_rotation_per_sec = 300,
743 makes_footstep_sound = false,
745 gravity = {x = 0, y = -9.81, z = 0},
746 movement_type = "walk",
749 hostile_cooldown = false,
752 item_drop = "mob:gunpowder",
754 damage_color = "blue",
756 standing_frame = {x=0,y=0},
757 moving_frame = {x=0,y=40},
758 animation_multiplier = 20,
762 --these are used to anchor a point to the head position
764 automatic_face_movement_dir = 0,
766 debug_head_pos = false,
767 --this always has to be slightly positive
768 head_directional_offset = 0.01,
769 head_height_offset = 1.45, --added to the base y position
770 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
771 head_position_correction = vector.new(0,2.4,0),
772 head_coord = "vertical",
776 death_rotation = "x",
778 hurt_sound = "creeper_hurt",
779 die_sound = "creeper_hurt",
781 attack_type = "explode",
782 --projectile_timer_cooldown = 5,
783 --projectile_type = "tnt:tnt",
785 explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
786 explosion_power = 14, -- how big the explosion is (radius)
787 explosion_time = 3, -- how long it takes for a mob to explode
788 explosion_blink_timer = 0.1, -- how fast the blinking happens
790 die_in_light = false,
791 --die_in_light_level = 12,
793 visual_size = vector.new(1/4,2/3,1/4),
794 position = vector.new(0,3.3,0),
799 local spider_eyes = {}
801 spider_eyes.initial_properties = {
803 mesh = "spider_eyes.b3d",
804 textures = {"spider_eyes.png"},
806 collisionbox = {0, 0, 0, 0, 0, 0}
808 spider_eyes.glow = -1
809 spider_eyes.on_step = function(self)
810 if not self.owner or not self.owner:get_luaentity() then
813 local owner_head_bone = self.owner:get_luaentity().head_bone
814 local position,rotation = self.owner:get_bone_position(owner_head_bone)
815 self.object:set_attach(self.owner, owner_head_bone, vector.new(0,0,0), rotation)
818 minetest.register_entity("mob:spider_eyes",spider_eyes)
824 collide_with_objects = false,
825 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
827 visual_size = {x = 3, y = 3},
833 --these are used to anchor a point to the head position
835 head_bone = "body.head",
836 debug_head_pos = false,
837 rotational_correction = -math.pi/2,
838 head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
839 head_height_offset = 0.63, --added to the base y position
840 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
841 head_position_correction = vector.new(0,1.24,0),
842 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
843 head_coord = "horizontal",
848 automatic_face_movement_dir = 90,
849 automatic_face_movement_max_rotation_per_sec = 300,
850 makes_footstep_sound = false,
852 gravity = {x = 0, y = -9.81, z = 0},
853 movement_type = "walk",
858 item_drop = "mob:string",
859 standing_frame = {x=21,y=21},
860 moving_frame = {x=0,y=20},
861 animation_multiplier = 20,
864 death_rotation = "z",
866 hurt_sound = "spider",
867 die_sound = "spider_die",
873 friendly_in_daylight = true,
874 attacked_hostile = true,
876 attack_type = "punch",
879 custom_on_activate = function(self)
880 local eyes = minetest.add_entity(self.object:get_pos(), "mob:spider_eyes")
881 eyes:set_attach(self.object, "body.head", vector.new(0,0,0), vector.new(0,0,0))
882 eyes:get_luaentity().owner = self.object
883 if math.random() > 0.998 then
884 local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
885 local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
886 local obj3 = minetest.add_entity(self.object:get_pos(),"boat:boat")
888 obj2:get_luaentity().timer = 7
889 obj2:get_luaentity().radius = 7
891 obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
892 obj2:set_attach(obj,"",vector.new(0,4.5,0),vector.new(0,90,0))
893 obj3:set_attach(obj2,"",vector.new(0,6.5,0),vector.new(0,0,0))
895 obj:set_properties({visual_size={x=1,y=1}})
896 obj2:set_properties({visual_size={x=1/3,y=1/3}})
899 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
900 --explosion_power = 7, -- how big the explosion has to be
901 --explosion_time = 3, -- how long it takes for a mob to explode
902 --this is used to properly position fire when the mob catches on fire
904 visual_size = vector.new(1.3/3,2/3,1.3/3),
905 position = vector.new(0,4,0),
914 collide_with_objects = false,
915 collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
917 visual_size = {x = 3, y = 3},
923 --these are used to anchor a point to the head position
925 head_bone = "body.head",
926 debug_head_pos = false,
927 rotational_correction = -math.pi/2,
928 head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
929 head_height_offset = 0.63, --added to the base y position
930 --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
931 head_position_correction = vector.new(0,1.24,0),
932 --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
933 head_coord = "horizontal",
938 automatic_face_movement_dir = 90,
939 automatic_face_movement_max_rotation_per_sec = 300,
940 makes_footstep_sound = false,
942 gravity = {x = 0, y = -9.81, z = 0},
943 movement_type = "walk",
948 item_drop = "mob:string",
949 standing_frame = {x=21,y=21},
950 moving_frame = {x=0,y=20},
951 animation_multiplier = 20,
954 death_rotation = "z",
956 hurt_sound = "spider",
957 die_sound = "spider_die",
963 friendly_in_daylight = true,
964 attacked_hostile = true,
966 attack_type = "punch",
969 --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
970 --explosion_power = 7, -- how big the explosion has to be
971 --explosion_time = 3, -- how long it takes for a mob to explode
973 visual_size = vector.new(1.3/3,2/3,1.3/3),
974 position = vector.new(0,4,0),