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