]> git.lizzy.rs Git - Crafter.git/blob - mods/mob/init.lua
Add in hybriddog's flow logic
[Crafter.git] / mods / mob / init.lua
1 local minetest,math,vector = minetest,math,vector
2 --this is where mobs are defined
3
4 local path = minetest.get_modpath(minetest.get_current_modname())
5
6 dofile(path.."/spawning.lua")
7 dofile(path.."/api/api_hook.lua")
8 dofile(path.."/items.lua")
9 dofile(path.."/chatcommands.lua")
10
11
12 mobs.register_mob(
13         {
14          mobname = "pig",
15          physical = true,
16          collide_with_objects = false,
17          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
18          visual = "mesh",
19          visual_size = {x = 3, y = 3},
20          mesh = "pig.b3d",
21          textures = {
22                  --blank out the first two to create adult pig
23                 "pig.png"
24          },
25          
26          --these are used to anchor a point to the head position
27
28
29          -----
30          head_bone = "head",
31          debug_head_pos = false,
32          head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
33          head_height_offset = 0.8, --added to the base y position
34          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
35          head_position_correction = vector.new(0,3,-0.5),
36          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
37          head_coord = "horizontal",
38          -----
39          
40          is_visible = true,
41          pointable = true,
42          automatic_face_movement_dir = 0,
43          automatic_face_movement_max_rotation_per_sec = 300,
44          makes_footstep_sound = false,
45          hp = 10,
46          gravity = {x = 0, y = -9.81, z = 0},
47          movement_type = "walk",
48          max_speed = 5,
49          state = 0,
50          view_distance = 15,
51          
52          item_drop = "mob:raw_porkchop", 
53          standing_frame = {x=0,y=0},
54          moving_frame = {x=0,y=40},
55          animation_multiplier = 20,
56          ----
57          ----
58          death_rotation = "x",
59          
60          hurt_sound = "pig",
61          die_sound = "pig_die",
62          
63          
64          hostile = false,
65          attacked_hostile = false,
66          attack_type = "punch",
67          group_attack = true,
68
69          
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
73          fire_table = {
74                 visual_size = vector.new(1/3,2/3,1/3),
75                 position = vector.new(0,3,0),
76         }
77         }
78 )
79
80 mobs.register_mob(
81         {
82          mobname = "sheep",
83          physical = true,
84          collide_with_objects = false,
85          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
86          visual = "mesh",
87          visual_size = {x = 3, y = 3},
88          mesh = "sheep.b3d",
89          textures = {
90                 "sheep_head_wool.png","sheep_wool.png","sheep.png"
91                 --"sheep_head_shaved.png","nothing.png","sheep.png"
92          },
93          
94          --these are used to anchor a point to the head position
95
96
97          -----
98          head_bone = "head",
99          debug_head_pos = false,
100          head_directional_offset = 0.571, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
101          head_height_offset = 1.15, --added to the base y position
102          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
103          head_position_correction = vector.new(0,4.1,-0.86),
104          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
105          head_coord = "horizontal",
106          -----
107          
108          is_visible = true,
109          pointable = true,
110          automatic_face_movement_dir = 0,
111          automatic_face_movement_max_rotation_per_sec = 300,
112          makes_footstep_sound = false,
113          hp = 10,
114          gravity = {x = 0, y = -9.81, z = 0},
115          movement_type = "walk",
116          max_speed = 5,
117          state = 0,
118          view_distance = 15,
119          
120          item_drop = "mob:raw_porkchop", 
121          standing_frame = {x=0,y=0},
122          moving_frame = {x=0,y=40},
123          animation_multiplier = 20,
124          ----
125          ----
126          death_rotation = "x",
127          
128          hurt_sound = "sheep",
129          die_sound = "sheep",
130          
131          
132          hostile = false,
133          attacked_hostile = false,
134          attack_type = "punch",
135          group_attack = true,
136
137          c_mob_data = {sheared = false},
138
139          custom_on_activate = function(self)
140                 --print(dump(self.c_mob_data))
141                 if self.c_mob_data.sheared == true then
142                         self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
143                 end
144          end,
145
146          custom_on_punch = function(self)
147                 if self.c_mob_data.sheared == false then
148                         self.object:set_properties({textures = {"sheep_head_shaved.png","nothing.png","sheep.png"}})
149                         self.c_mob_data = {sheared=true}
150                         local pos = self.object:get_pos()
151                         pos.y = pos.y + 0.5
152                         minetest.throw_item(pos,{name="weather:snow_block"})
153                 end
154         end,
155         fire_table = {
156                 visual_size = vector.new(1/3,2/3,1/3),
157                 position = vector.new(0,3,0),
158         }
159         }
160         
161 )
162
163 mobs.register_mob(
164         {
165          mobname = "chicken",
166          physical = true,
167          collide_with_objects = false,
168          collisionbox = {-0.225, 0, -0.225, 0.225, 0.675, 0.225},
169          visual = "mesh",
170          visual_size = {x = 3, y = 3},
171          mesh = "chicken.b3d",
172          textures = {
173                  --blank out the first two to create adult pig
174                 "chicken.png"
175          },
176          
177          --these are used to anchor a point to the head position
178
179
180          -----
181          head_bone = "head",
182          debug_head_pos = false,
183          rotational_correction = -math.pi/2,
184          head_directional_offset = 0.2, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
185          head_height_offset = 0.82, --added to the base y position
186          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
187          head_position_correction = vector.new(0,1.8,-0.89),
188          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
189          head_coord = "vertical",
190          flip_pitch = true,
191          -----
192          
193          is_visible = true,
194          pointable = true,
195          automatic_face_movement_dir = 90,
196          automatic_face_movement_max_rotation_per_sec = 300,
197          makes_footstep_sound = false,
198          hp = 10,
199          gravity = {x = 0, y = -9.81, z = 0},
200          movement_type = "walk",
201          max_speed = 5,
202          state = 0,
203          view_distance = 15,
204          
205          item_drop = {"mob:egg","mob:feather"}, 
206          standing_frame = {x=20,y=20},
207          moving_frame = {x=0,y=20},
208          animation_multiplier = 15,
209          ----
210          ----
211          death_rotation = "z",
212          
213          hurt_sound = "chicken_hurt",
214          die_sound = "chicken_die",
215          
216          
217          hostile = false,
218          attacked_hostile = false,
219          attack_type = "punch",
220          group_attack = true,
221          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
222          --explosion_power = 7, -- how big the explosion has to be
223          --explosion_time = 3, -- how long it takes for a mob to explode
224          fire_table = {
225                 visual_size = vector.new(1/6,1/2.2,1/6),
226                 position = vector.new(0,2.3,0),
227         }
228         }
229 )
230
231 mobs.register_mob(
232         {
233          mobname = "snowman",
234          physical = true,
235          collide_with_objects = false,
236          collisionbox = {-0.37, 0, -0.37, 0.37, 1.75, 0.37},
237          visual = "mesh",
238          visual_size = {x = 9, y = 9},
239          mesh = "snowman.b3d",
240          textures = {
241                 "snowman.png","snowman.png","snowman.png","snowman.png","snowman.png","snowman.png",
242          },
243          
244          --these are used to anchor a point to the head position
245
246
247          -----
248          head_bone = "head",
249          debug_head_pos = false,
250          rotational_correction = math.pi/2,
251          head_directional_offset = 0.01, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
252          head_height_offset = 1.65, --added to the base y position
253          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
254          head_position_correction = vector.new(0,0.6,0),
255          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
256          head_coord = "vertical",
257          flip_pitch = true,
258          -----
259          
260          is_visible = true,
261          pointable = true,
262          automatic_face_movement_dir = -90,
263          automatic_face_movement_max_rotation_per_sec = 300,
264          makes_footstep_sound = false,
265          hp = 10,
266          gravity = {x = 0, y = -9.81, z = 0},
267          movement_type = "walk",
268          max_speed = 5,
269          state = 0,
270          view_distance = 15,
271          
272          item_drop = {"weather:snowball","main:coal","mob:carrot","main:stick"}, 
273          standing_frame = {x=0,y=0},
274          moving_frame = {x=0,y=0},
275          animation_multiplier = 10,
276          ----
277          ----
278          death_rotation = "z",
279          
280          hurt_sound = "wool",
281          die_sound = "wool",
282          
283          
284          hostile = false,
285          attacked_hostile = true,
286          attack_type = "projectile",
287          projectile_type = "weather:snowball",
288          projectile_timer_cooldown = 1,
289
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))
293
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"})
297                                 end
298                         end
299                         self.custom_old_pos = pos
300                 end
301          end,
302
303          custom_timer = 0.75,
304          custom_timer_function = function(self,dtime)
305                 if weather_type and weather_type ~= 1 then
306                         self.object:punch(self.object, 2, 
307                                 {
308                                 full_punch_interval=1.5,
309                                 damage_groups = {damage=2},
310                                 })
311                 end
312          end,
313          fire_table = {
314                 visual_size = vector.new(1/4,2/3,1/4),
315                 position = vector.new(0,3.3,0),
316         }
317         }
318 )
319
320 mobs.register_mob(
321         {
322          mobname = "phyg",
323          physical = true,
324          collide_with_objects = false,
325          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
326          visual = "mesh",
327          visual_size = {x = 3, y = 3},
328          mesh = "phyg.b3d",
329          textures = {
330                  --blank out the first two to create adult pig
331                 "phyg.png","wings.png"
332          },
333          
334          --these are used to anchor a point to the head position
335
336
337          -----
338          head_bone = "head",
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",
346          -----
347          
348          is_visible = true,
349          pointable = true,
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,
355          hp = 10,
356          gravity = {x = 0, y = -1, z = 0},
357          movement_type = "walk",
358          max_speed = 5,
359          state = 0,
360          view_distance = 15,
361          
362          item_drop = "main:gold", 
363          item_minimum = 4,
364          item_max = 5,
365
366          standing_frame = {x=0,y=0},
367          moving_frame = {x=0,y=40},
368          animation_multiplier = 20,
369          ----
370          ----
371          death_rotation = "x",
372          
373          hurt_sound = "pig",
374          die_sound = "pig_die",
375          
376          
377          hostile = false,
378          attacked_hostile = false,
379          attack_type = "punch",
380          group_attack = true,
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
384          fire_table = {
385                 visual_size = vector.new(1/3,2/3,1/3),
386                 position = vector.new(0,3,0),
387         }
388         }
389 )
390
391
392 mobs.register_mob(
393         {
394         mobname = "big_slime",
395         physical = true,
396         collide_with_objects = false,
397         collisionbox = {-1.25, 0, -1.25, 1.25, 2.5, 1.25},
398         visual = "mesh",
399         visual_size = {x = 15, y = 15},
400         mesh = "slime.b3d",
401         textures = {
402                 "slime.png"
403         },
404         collision_boundary = 2.5,
405         is_visible = true,
406         pointable = true,
407         automatic_face_movement_dir = 90,
408         automatic_face_movement_max_rotation_per_sec = 300,
409         makes_footstep_sound = false,
410         hp = 32,
411         gravity = {x = 0, y = -9.81, z = 0},
412         movement_type = "jump",
413         make_jump_noise = true,
414         max_speed = 4,
415         hostile = true,
416         state = 0,
417         view_distance = 20,
418         death_rotation = "z",
419         hurt_sound = "slime_die",
420         die_sound = "slime_die",
421         attack_type = "punch",
422         attack_damage = 6,
423         custom_on_death = function(self)
424                 local pos = self.object:get_pos()
425                 for i = 1,4 do
426                         local obj = minetest.add_entity(pos,"mob:medium_slime")
427                         if self.on_fire then
428                                 start_fire(obj)
429                         end
430                 end
431         end,
432         --this is used to properly position fire when the mob catches on fire
433         fire_table = {
434                 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
435                 position = vector.new(0,1.5,0),
436         }
437         }
438 )
439
440 mobs.register_mob(
441         {
442         mobname = "medium_slime",
443         physical = true,
444         collide_with_objects = false,
445         collisionbox = {-0.625, 0, -0.625, 0.625, 1.25, 0.625},
446         visual = "mesh",
447         visual_size = {x = 7.5, y = 7.5},
448         mesh = "slime.b3d",
449         textures = {
450                 "slime.png"
451         },
452         is_visible = true,
453         pointable = true,
454         automatic_face_movement_dir = 90,
455         automatic_face_movement_max_rotation_per_sec = 300,
456         makes_footstep_sound = false,
457         hp = 10,
458         gravity = {x = 0, y = -9.81, z = 0},
459         movement_type = "jump",
460         make_jump_noise = true,
461         max_speed = 4,
462         hostile = true,
463         state = 0,
464         view_distance = 20,
465         death_rotation = "z",
466         hurt_sound = "slime_die",
467         die_sound = "slime_die",
468         attack_damage = 2,
469         attack_type = "punch",
470         custom_on_death = function(self)
471                 local pos = self.object:get_pos()
472                 pos.y = pos.y + 0.2
473                 for i = 1,4 do
474                         local obj = minetest.add_entity(pos,"mob:small_slime")
475                         if self.on_fire then
476                                 start_fire(obj)
477                         end
478                 end
479         end,
480         fire_table = {
481                 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
482                 position = vector.new(0,1.5,0),
483         }
484         }
485 )
486
487 mobs.register_mob(
488         {
489         mobname = "small_slime",
490         physical = true,
491         collide_with_objects = false,
492         collisionbox = {-0.3, 0, -0.3, 0.3, 0.6, 0.3},
493         visual = "mesh",
494         visual_size = {x = 3.7, y = 3.7},
495         mesh = "slime.b3d",
496         textures = {
497                 "slime.png"
498         },
499         is_visible = true,
500         pointable = true,
501         automatic_face_movement_dir = 90,
502         automatic_face_movement_max_rotation_per_sec = 300,
503         makes_footstep_sound = false,
504         hp = 4,
505         gravity = {x = 0, y = -9.81, z = 0},
506         movement_type = "jump",
507         make_jump_noise = true,
508         max_speed = 4,
509         hostile = true,
510         state = 0,
511         view_distance = 20,
512         death_rotation = "z",
513         hurt_sound = "slime_die",
514         die_sound = "slime_die",
515         attack_damage = 1,
516         attack_type = "punch",
517         item_drop = "mob:slimeball",
518         fire_table = {
519                 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
520                 position = vector.new(0,1.5,0),
521         }
522         }
523 )
524
525 --[[
526
527
528 mobs.register_mob(
529         {
530          mobname = "creepig",
531          physical = true,
532          collide_with_objects = false,
533          collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
534          visual = "mesh",
535          visual_size = {x = 3, y = 3},
536          mesh = "pig.x",
537          textures = {
538                 "creepig_body.png","creepig_leg.png","creepig_leg.png","creepig_leg.png","creepig_leg.png"
539         },
540          is_visible = true,
541          pointable = true,
542          automatic_face_movement_dir = -90.0,
543          automatic_face_movement_max_rotation_per_sec = 300,
544          makes_footstep_sound = false,
545          hp = 10,
546          gravity = {x = 0, y = -9.81, z = 0},
547          movement_type = "walk",
548          max_speed = 4,
549          hostile = true,
550          state = 0,
551          view_distance = 20,
552          item_drop = "mob:cooked_porkchop",
553           
554          standing_frame = {x=0,y=0},
555          moving_frame = {x=5,y=15},
556          animation_multiplier = 5,
557          ----
558           
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),
565          
566          death_rotation = "z",
567          
568          hurt_sound = "pig",
569          die_sound = "pig_die",
570          
571          attack_type = "explode",
572          --projectile_timer_cooldown = 5,
573          --projectile_type = "tnt:tnt",
574          
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
578          
579          die_in_light = true,
580          die_in_light_level = 12,
581         }
582 )
583
584 ]]--
585
586
587 mobs.register_mob(
588         {
589          mobname = "zombie",
590          physical = true,
591          collide_with_objects = false,
592          collisionbox = {-0.37,0, -0.37, 0.37, 1.7, 0.37},
593          visual = "mesh",
594          visual_size = {x = 3.2, y = 3.2},
595          mesh = "zombie.b3d",
596          textures = {
597                 "zombie.png"
598         },
599          is_visible = true,
600          pointable = true,
601          automatic_face_movement_max_rotation_per_sec = 300,
602          makes_footstep_sound = false,
603          hp = 27,
604          gravity = {x = 0, y = -9.81, z = 0},
605          movement_type = "walk",
606          max_speed = 3,
607          hostile = true,
608          hostile_cooldown = false,
609          state = 0,
610          view_distance = 32,
611          item_drop = "mob:cooked_porkchop",
612           
613          standing_frame = {x=0,y=0},
614          moving_frame = {x=0,y=40},
615          animation_multiplier = 20,
616          ----
617          pathfinds = true,
618          
619          --these are used to anchor a point to the head position
620          -----
621          automatic_face_movement_dir = 0,
622          head_bone = "Head",
623          debug_head_pos = false,
624          --this always has to be slightly positive
625          head_directional_offset = 0.01,
626          head_height_offset = 1.55, --added to the base y position
627          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
628          head_position_correction = vector.new(0,2.4,0),
629          head_coord = "vertical",
630          -----
631           
632          
633          death_rotation = "x",
634          
635          hurt_sound = "hurt",
636          die_sound = "hurt",
637          sound_pitch_mod_min = 60,
638          sound_pitch_mod_max = 80,
639          sound_pitch_mod_min_die = 50,
640          sound_pitch_mod_max_die = 70,
641          attack_type = "punch",
642          attack_damage = 3,
643          
644          die_in_light = true,
645          --die_in_light_level = 12,
646          fire_table = {
647                 visual_size = vector.new(1/4,2/3,1/4),
648                 position = vector.new(0,3.3,0),
649         }
650         }
651 )
652
653
654 mobs.register_mob(
655         {
656          mobname = "creeper",
657          physical = true,
658          collide_with_objects = false,
659          collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
660          visual = "mesh",
661          visual_size = {x = 3.2, y = 3.2},
662          mesh = "creeper.b3d",
663          textures = {
664                 "creeper.png"
665         },
666          is_visible = true,
667          pointable = true,
668          automatic_face_movement_max_rotation_per_sec = 300,
669          makes_footstep_sound = false,
670          hp = 27,
671          gravity = {x = 0, y = -9.81, z = 0},
672          movement_type = "walk",
673          max_speed = 4,
674          hostile = true,
675          hostile_cooldown = false,
676          state = 0,
677          view_distance = 32,
678          item_drop = "mob:gunpowder",
679           
680          standing_frame = {x=0,y=0},
681          moving_frame = {x=0,y=40},
682          animation_multiplier = 20,
683          ----
684          pathfinds = true,
685          
686          --these are used to anchor a point to the head position
687          -----
688          automatic_face_movement_dir = 0,
689          head_bone = "head",
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",
697          -----
698           
699          
700          death_rotation = "x",
701          
702          hurt_sound = "creeper_hurt",
703          die_sound = "creeper_hurt",
704          
705          attack_type = "explode",
706          --projectile_timer_cooldown = 5,
707          --projectile_type = "tnt:tnt",
708          
709          explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
710          explosion_power = 4, -- how big the explosion has to be
711          explosion_time = 3, -- how long it takes for a mob to explode
712          
713          die_in_light = false,
714          --die_in_light_level = 12,
715          fire_table = {
716                 visual_size = vector.new(1/4,2/3,1/4),
717                 position = vector.new(0,3.3,0),
718         }
719         }
720 )
721
722 mobs.register_mob(
723         {
724          mobname = "sneeper",
725          physical = true,
726          collide_with_objects = false,
727          collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
728          visual = "mesh",
729          visual_size = {x = 3.2, y = 3.2},
730          mesh = "creeper.b3d",
731          textures = {
732                 "sneeper.png"
733         },
734          is_visible = true,
735          pointable = true,
736          automatic_face_movement_max_rotation_per_sec = 300,
737          makes_footstep_sound = false,
738          hp = 27,
739          gravity = {x = 0, y = -9.81, z = 0},
740          movement_type = "walk",
741          max_speed = 4,
742          hostile = true,
743          hostile_cooldown = false,
744          state = 0,
745          view_distance = 32,
746          item_drop = "mob:gunpowder",
747           
748          standing_frame = {x=0,y=0},
749          moving_frame = {x=0,y=40},
750          animation_multiplier = 20,
751          ----
752          pathfinds = true,
753          
754          --these are used to anchor a point to the head position
755          -----
756          automatic_face_movement_dir = 0,
757          head_bone = "head",
758          debug_head_pos = false,
759          --this always has to be slightly positive
760          head_directional_offset = 0.01,
761          head_height_offset = 1.45, --added to the base y position
762          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
763          head_position_correction = vector.new(0,2.4,0),
764          head_coord = "vertical",
765          -----
766          
767          damage_color = "blue",
768          
769          death_rotation = "x",
770          
771          hurt_sound = "creeper_hurt",
772          die_sound = "creeper_hurt",
773          
774          attack_type = "explode",
775          explosion_type = "weather:snow_block",
776          --projectile_timer_cooldown = 5,
777          --projectile_type = "tnt:tnt",
778          
779          explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
780          explosion_power = 4, -- how big the explosion has to be
781          explosion_time = 3, -- how long it takes for a mob to explode
782          
783          die_in_light = false,
784          --die_in_light_level = 12,
785          fire_table = {
786                 visual_size = vector.new(1/4,2/3,1/4),
787                 position = vector.new(0,3.3,0),
788         }
789         }
790 )
791
792
793 mobs.register_mob(
794         {
795          mobname = "nitro_creeper",
796          physical = true,
797          collide_with_objects = false,
798          collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
799          visual = "mesh",
800          visual_size = {x = 3.2, y = 3.2},
801          mesh = "creeper.b3d",
802          textures = {
803                 "nitro_creeper.png"
804         },
805          is_visible = true,
806          pointable = true,
807          automatic_face_movement_max_rotation_per_sec = 300,
808          makes_footstep_sound = false,
809          hp = 40,
810          gravity = {x = 0, y = -9.81, z = 0},
811          movement_type = "walk",
812          max_speed = 6,
813          hostile = true,
814          hostile_cooldown = false,
815          state = 0,
816          view_distance = 40,
817          item_drop = "mob:gunpowder",
818
819          damage_color = "blue",
820           
821          standing_frame = {x=0,y=0},
822          moving_frame = {x=0,y=40},
823          animation_multiplier = 20,
824          ----
825          pathfinds = true,
826          
827          --these are used to anchor a point to the head position
828          -----
829          automatic_face_movement_dir = 0,
830          head_bone = "head",
831          debug_head_pos = false,
832          --this always has to be slightly positive
833          head_directional_offset = 0.01,
834          head_height_offset = 1.45, --added to the base y position
835          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
836          head_position_correction = vector.new(0,2.4,0),
837          head_coord = "vertical",
838          -----
839           
840          
841          death_rotation = "x",
842          
843          hurt_sound = "creeper_hurt",
844          die_sound = "creeper_hurt",
845          
846          attack_type = "explode",
847          --projectile_timer_cooldown = 5,
848          --projectile_type = "tnt:tnt",
849          
850          explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
851          explosion_power = 6, -- how big the explosion is (radius)
852          explosion_time = 3, -- how long it takes for a mob to explode
853          explosion_blink_timer = 0.1, -- how fast the blinking happens
854          
855          die_in_light = false,
856          --die_in_light_level = 12,
857          fire_table = {
858                 visual_size = vector.new(1/4,2/3,1/4),
859                 position = vector.new(0,3.3,0),
860         }
861         }
862 )
863
864 local spider_eyes = {}
865
866 spider_eyes.initial_properties = {
867         visual = "mesh",
868         mesh = "spider_eyes.b3d",
869         textures = {"spider_eyes.png"},
870         pointable = false,
871         collisionbox = {0, 0, 0, 0, 0, 0}
872 }
873 spider_eyes.glow = -1
874 spider_eyes.on_step = function(self)
875         if not self.owner or not self.owner:get_luaentity() then
876                 self.object:remove()
877         else
878                 local owner_head_bone = self.owner:get_luaentity().head_bone
879                 local position,rotation = self.owner:get_bone_position(owner_head_bone)
880                 self.object:set_attach(self.owner, owner_head_bone, vector.new(0,0,0), rotation)
881         end
882 end
883 minetest.register_entity("mob:spider_eyes",spider_eyes)
884
885 mobs.register_mob(
886         {
887          mobname = "spider",
888          physical = true,
889          collide_with_objects = false,
890          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
891          visual = "mesh",
892          visual_size = {x = 3, y = 3},
893          mesh = "spider.b3d",
894          textures = {
895                 "spider.png"
896          },
897          
898          --these are used to anchor a point to the head position
899          -----
900          head_bone = "body.head",
901          debug_head_pos = false,
902          rotational_correction = -math.pi/2,
903          head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
904          head_height_offset = 0.63, --added to the base y position
905          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
906          head_position_correction = vector.new(0,1.24,0),
907          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
908          head_coord = "horizontal",
909          -----
910          
911          is_visible = true,
912          pointable = true,
913          automatic_face_movement_dir = 90,
914          automatic_face_movement_max_rotation_per_sec = 300,
915          makes_footstep_sound = false,
916          hp = 30,
917          gravity = {x = 0, y = -9.81, z = 0},
918          movement_type = "walk",
919          max_speed = 4,
920          state = 0,
921          view_distance = 32,
922          
923          item_drop = "mob:string", 
924          standing_frame = {x=21,y=21},
925          moving_frame = {x=0,y=20},
926          animation_multiplier = 20,
927          ----
928          ----
929          death_rotation = "z",
930          
931          hurt_sound = "spider",
932          die_sound = "spider_die",
933          
934          
935          pathfinds = true,
936
937          hostile = true,
938          friendly_in_daylight = true,
939          attacked_hostile = true,
940          attack_damage = 3,
941          attack_type = "punch",
942          group_attack = true,
943
944          custom_on_activate = function(self)
945                 local eyes = minetest.add_entity(self.object:get_pos(), "mob:spider_eyes")
946                 eyes:set_attach(self.object, "body.head", vector.new(0,0,0), vector.new(0,0,0))
947                 eyes:get_luaentity().owner = self.object
948                 if math.random() > 0.998 then
949                         local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
950                         local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
951                         local obj3 = minetest.add_entity(self.object:get_pos(),"boat:boat")
952
953                         obj2:get_luaentity().timer = 7
954                         obj2:get_luaentity().radius = 7
955
956                         obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
957                         obj2:set_attach(obj,"",vector.new(0,4.5,0),vector.new(0,90,0))
958                         obj3:set_attach(obj2,"",vector.new(0,6.5,0),vector.new(0,0,0))
959
960                         obj:set_properties({visual_size={x=1,y=1}})
961                         obj2:set_properties({visual_size={x=1/3,y=1/3}})
962                 end
963          end,
964          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
965          --explosion_power = 7, -- how big the explosion has to be
966          --explosion_time = 3, -- how long it takes for a mob to explode
967          --this is used to properly position fire when the mob catches on fire
968         fire_table = {
969                 visual_size = vector.new(1.3/3,2/3,1.3/3),
970                 position = vector.new(0,4,0),
971         }
972         }
973 )
974
975 mobs.register_mob(
976         {
977          mobname = "snoider",
978          physical = true,
979          collide_with_objects = false,
980          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
981          visual = "mesh",
982          visual_size = {x = 3, y = 3},
983          mesh = "spider.b3d",
984          textures = {
985                 "snoider.png"
986          },
987          
988          --these are used to anchor a point to the head position
989          -----
990          head_bone = "body.head",
991          debug_head_pos = false,
992          rotational_correction = -math.pi/2,
993          head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
994          head_height_offset = 0.63, --added to the base y position
995          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
996          head_position_correction = vector.new(0,1.24,0),
997          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
998          head_coord = "horizontal",
999          -----
1000          
1001          is_visible = true,
1002          pointable = true,
1003          automatic_face_movement_dir = 90,
1004          automatic_face_movement_max_rotation_per_sec = 300,
1005          makes_footstep_sound = false,
1006          hp = 30,
1007          gravity = {x = 0, y = -9.81, z = 0},
1008          movement_type = "walk",
1009          max_speed = 4,
1010          state = 0,
1011          view_distance = 32,
1012          
1013          item_drop = "mob:string", 
1014          standing_frame = {x=21,y=21},
1015          moving_frame = {x=0,y=20},
1016          animation_multiplier = 20,
1017          ----
1018          ----
1019          death_rotation = "z",
1020          
1021          hurt_sound = "spider",
1022          die_sound = "spider_die",
1023          
1024          
1025          pathfinds = true,
1026
1027          hostile = true,
1028          friendly_in_daylight = true,
1029          attacked_hostile = true,
1030          attack_damage = 3,
1031          attack_type = "punch",
1032          group_attack = true,
1033
1034          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
1035          --explosion_power = 7, -- how big the explosion has to be
1036          --explosion_time = 3, -- how long it takes for a mob to explode
1037          fire_table = {
1038                 visual_size = vector.new(1.3/3,2/3,1.3/3),
1039                 position = vector.new(0,4,0),
1040         }
1041         }
1042 )