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