]> git.lizzy.rs Git - Crafter.git/blob - mods/mob/init.lua
Make snowman not hostile until punched
[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 = false,
288          attacked_hostile = true,
289          attack_type = "projectile",
290          projectile_type = "weather:snowball",
291          projectile_timer_cooldown = 1,
292
293          custom_function = function(self,dtime,moveresult)
294                 if moveresult and moveresult.touching_ground then
295                         local pos = vector.floor(vector.add(self.object:get_pos(),0.5))
296
297                         if self.custom_old_pos and not vector.equals(pos,self.custom_old_pos) then
298                                 if minetest.get_nodedef(minetest.get_node(pos).name,"buildable_to") == true and minetest.get_nodedef(minetest.get_node(vector.new(pos.x,pos.y-1,pos.z)).name,"buildable_to") == false then
299                                         minetest.set_node(pos,{name="weather:snow"})
300                                 end
301                         end
302                         self.custom_old_pos = pos
303                 end
304          end,
305
306          custom_timer = 0.75,
307          custom_timer_function = function(self,dtime)
308                 if weather_type and weather_type ~= 1 then
309                         self.object:punch(self.object, 2, 
310                                 {
311                                 full_punch_interval=1.5,
312                                 damage_groups = {damage=2},
313                                 })
314                 end
315          end,
316          fire_table = {
317                 visual_size = vector.new(1/4,2/3,1/4),
318                 position = vector.new(0,3.3,0),
319         }
320         }
321 )
322
323 mobs.register_mob(
324         {
325          mobname = "phyg",
326          physical = true,
327          collide_with_objects = false,
328          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
329          visual = "mesh",
330          visual_size = {x = 3, y = 3},
331          mesh = "phyg.b3d",
332          textures = {
333                  --blank out the first two to create adult pig
334                 "phyg.png","wings.png"
335          },
336          
337          --these are used to anchor a point to the head position
338
339
340          -----
341          head_bone = "head",
342          debug_head_pos = false,
343          head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
344          head_height_offset = 0.8, --added to the base y position
345          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
346          head_position_correction = vector.new(0,3,-0.5),
347          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
348          head_coord = "horizontal",
349          -----
350          
351          is_visible = true,
352          pointable = true,
353          automatic_face_movement_dir = 0,
354          automatic_face_movement_max_rotation_per_sec = 300,
355          makes_footstep_sound = false,
356          takes_fall_damage = false,
357          make_jump_noise = false,
358          hp = 10,
359          gravity = {x = 0, y = -1, z = 0},
360          movement_type = "walk",
361          max_speed = 5,
362          state = 0,
363          view_distance = 15,
364          
365          item_drop = "main:gold", 
366          item_minimum = 4,
367          item_max = 5,
368
369          standing_frame = {x=0,y=0},
370          moving_frame = {x=0,y=40},
371          animation_multiplier = 20,
372          ----
373          ----
374          death_rotation = "x",
375          
376          hurt_sound = "pig",
377          die_sound = "pig_die",
378          
379          
380          hostile = false,
381          attacked_hostile = false,
382          attack_type = "punch",
383          group_attack = true,
384          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
385          --explosion_power = 7, -- how big the explosion has to be
386          --explosion_time = 3, -- how long it takes for a mob to explode
387          fire_table = {
388                 visual_size = vector.new(1/3,2/3,1/3),
389                 position = vector.new(0,3,0),
390         }
391         }
392 )
393
394
395 mobs.register_mob(
396         {
397         mobname = "big_slime",
398         physical = true,
399         collide_with_objects = false,
400         collisionbox = {-1.25, 0, -1.25, 1.25, 2.5, 1.25},
401         visual = "mesh",
402         visual_size = {x = 15, y = 15},
403         mesh = "slime.b3d",
404         textures = {
405                 "slime.png"
406         },
407         collision_boundary = 2.5,
408         is_visible = true,
409         pointable = true,
410         automatic_face_movement_dir = 90,
411         automatic_face_movement_max_rotation_per_sec = 300,
412         makes_footstep_sound = false,
413         hp = 32,
414         gravity = {x = 0, y = -9.81, z = 0},
415         movement_type = "jump",
416         make_jump_noise = true,
417         max_speed = 5,
418         hostile = true,
419         state = 0,
420         view_distance = 20,
421         death_rotation = "z",
422         hurt_sound = "slime_die",
423         die_sound = "slime_die",
424         attack_type = "punch",
425         attack_damage = 6,
426         custom_on_death = function(self)
427                 local pos = self.object:get_pos()
428                 for i = 1,4 do
429                         local obj = minetest.add_entity(pos,"mob:medium_slime")
430                         if self.on_fire then
431                                 start_fire(obj)
432                         end
433                 end
434         end,
435         --this is used to properly position fire when the mob catches on fire
436         fire_table = {
437                 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
438                 position = vector.new(0,1.5,0),
439         }
440         }
441 )
442
443 mobs.register_mob(
444         {
445         mobname = "medium_slime",
446         physical = true,
447         collide_with_objects = false,
448         collisionbox = {-0.625, 0, -0.625, 0.625, 1.25, 0.625},
449         visual = "mesh",
450         visual_size = {x = 7.5, y = 7.5},
451         mesh = "slime.b3d",
452         textures = {
453                 "slime.png"
454         },
455         is_visible = true,
456         pointable = true,
457         automatic_face_movement_dir = 90,
458         automatic_face_movement_max_rotation_per_sec = 300,
459         makes_footstep_sound = false,
460         hp = 10,
461         gravity = {x = 0, y = -9.81, z = 0},
462         movement_type = "jump",
463         make_jump_noise = true,
464         max_speed = 5,
465         hostile = true,
466         state = 0,
467         view_distance = 20,
468         death_rotation = "z",
469         hurt_sound = "slime_die",
470         die_sound = "slime_die",
471         attack_damage = 2,
472         attack_type = "punch",
473         custom_on_death = function(self)
474                 local pos = self.object:get_pos()
475                 pos.y = pos.y + 0.2
476                 for i = 1,4 do
477                         local obj = minetest.add_entity(pos,"mob:small_slime")
478                         if self.on_fire then
479                                 start_fire(obj)
480                         end
481                 end
482         end,
483         fire_table = {
484                 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
485                 position = vector.new(0,1.5,0),
486         }
487         }
488 )
489
490 mobs.register_mob(
491         {
492         mobname = "small_slime",
493         physical = true,
494         collide_with_objects = false,
495         collisionbox = {-0.3, 0, -0.3, 0.3, 0.6, 0.3},
496         visual = "mesh",
497         visual_size = {x = 3.7, y = 3.7},
498         mesh = "slime.b3d",
499         textures = {
500                 "slime.png"
501         },
502         is_visible = true,
503         pointable = true,
504         automatic_face_movement_dir = 90,
505         automatic_face_movement_max_rotation_per_sec = 300,
506         makes_footstep_sound = false,
507         hp = 4,
508         gravity = {x = 0, y = -9.81, z = 0},
509         movement_type = "jump",
510         make_jump_noise = true,
511         max_speed = 5,
512         hostile = true,
513         state = 0,
514         view_distance = 20,
515         death_rotation = "z",
516         hurt_sound = "slime_die",
517         die_sound = "slime_die",
518         attack_damage = 1,
519         attack_type = "punch",
520         item_drop = "mob:slimeball",
521         fire_table = {
522                 visual_size = vector.new(1/5.8,1/3.3,1/5.8),
523                 position = vector.new(0,1.5,0),
524         }
525         }
526 )
527
528 --[[
529
530
531 mobs.register_mob(
532         {
533          mobname = "creepig",
534          physical = true,
535          collide_with_objects = false,
536          collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
537          visual = "mesh",
538          visual_size = {x = 3, y = 3},
539          mesh = "pig.x",
540          textures = {
541                 "creepig_body.png","creepig_leg.png","creepig_leg.png","creepig_leg.png","creepig_leg.png"
542         },
543          is_visible = true,
544          pointable = true,
545          automatic_face_movement_dir = -90.0,
546          automatic_face_movement_max_rotation_per_sec = 300,
547          makes_footstep_sound = false,
548          hp = 10,
549          gravity = {x = 0, y = -9.81, z = 0},
550          movement_type = "walk",
551          max_speed = 4,
552          hostile = true,
553          state = 0,
554          view_distance = 20,
555          item_drop = "mob:cooked_porkchop",
556           
557          standing_frame = {x=0,y=0},
558          moving_frame = {x=5,y=15},
559          animation_multiplier = 5,
560          ----
561           
562          has_head = true, --remove this when mesh based head rotation is implemented
563          head_visual = "mesh",
564          head_visual_size = {x = 1.1, y = 1.1},
565          head_mesh = "pig_head.x",
566          head_textures ={"creepig_head.png","creepig_nose.png"},
567          head_mount = vector.new(0,1.2,1.9),
568          
569          death_rotation = "z",
570          
571          hurt_sound = "pig",
572          die_sound = "pig_die",
573          
574          attack_type = "explode",
575          --projectile_timer_cooldown = 5,
576          --projectile_type = "tnt:tnt",
577          
578          explosion_radius = 2, -- how far away the mob has to be to initialize the explosion
579          explosion_power = 7, -- how big the explosion has to be
580          explosion_time = 5, -- how long it takes for a mob to explode
581          
582          die_in_light = true,
583          die_in_light_level = 12,
584         }
585 )
586
587 ]]--
588
589 mobs.register_mob(
590         {
591          mobname = "creeper",
592          physical = true,
593          collide_with_objects = false,
594          collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
595          visual = "mesh",
596          visual_size = {x = 3.2, y = 3.2},
597          mesh = "creeper.b3d",
598          textures = {
599                 "creeper.png"
600         },
601          is_visible = true,
602          pointable = true,
603          automatic_face_movement_max_rotation_per_sec = 300,
604          makes_footstep_sound = false,
605          hp = 27,
606          gravity = {x = 0, y = -9.81, z = 0},
607          movement_type = "walk",
608          max_speed = 5.5,
609          hostile = true,
610          hostile_cooldown = false,
611          state = 0,
612          view_distance = 32,
613          item_drop = "mob:gunpowder",
614           
615          standing_frame = {x=0,y=0},
616          moving_frame = {x=0,y=40},
617          animation_multiplier = 20,
618          ----
619          pathfinds = true,
620          
621          --these are used to anchor a point to the head position
622          -----
623          automatic_face_movement_dir = 0,
624          head_bone = "head",
625          debug_head_pos = false,
626          --this always has to be slightly positive
627          head_directional_offset = 0.01,
628          head_height_offset = 1.45, --added to the base y position
629          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
630          head_position_correction = vector.new(0,2.4,0),
631          head_coord = "vertical",
632          -----
633           
634          
635          death_rotation = "x",
636          
637          hurt_sound = "creeper_hurt",
638          die_sound = "creeper_hurt",
639          
640          attack_type = "explode",
641          --projectile_timer_cooldown = 5,
642          --projectile_type = "tnt:tnt",
643          
644          explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
645          explosion_power = 4, -- how big the explosion has to be
646          explosion_time = 3, -- how long it takes for a mob to explode
647          
648          die_in_light = false,
649          --die_in_light_level = 12,
650          fire_table = {
651                 visual_size = vector.new(1/4,2/3,1/4),
652                 position = vector.new(0,3.3,0),
653         }
654         }
655 )
656
657 mobs.register_mob(
658         {
659          mobname = "sneeper",
660          physical = true,
661          collide_with_objects = false,
662          collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
663          visual = "mesh",
664          visual_size = {x = 3.2, y = 3.2},
665          mesh = "creeper.b3d",
666          textures = {
667                 "sneeper.png"
668         },
669          is_visible = true,
670          pointable = true,
671          automatic_face_movement_max_rotation_per_sec = 300,
672          makes_footstep_sound = false,
673          hp = 27,
674          gravity = {x = 0, y = -9.81, z = 0},
675          movement_type = "walk",
676          max_speed = 5.5,
677          hostile = true,
678          hostile_cooldown = false,
679          state = 0,
680          view_distance = 32,
681          item_drop = "mob:gunpowder",
682           
683          standing_frame = {x=0,y=0},
684          moving_frame = {x=0,y=40},
685          animation_multiplier = 20,
686          ----
687          pathfinds = true,
688          
689          --these are used to anchor a point to the head position
690          -----
691          automatic_face_movement_dir = 0,
692          head_bone = "head",
693          debug_head_pos = false,
694          --this always has to be slightly positive
695          head_directional_offset = 0.01,
696          head_height_offset = 1.45, --added to the base y position
697          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
698          head_position_correction = vector.new(0,2.4,0),
699          head_coord = "vertical",
700          -----
701          
702          damage_color = "blue",
703          
704          death_rotation = "x",
705          
706          hurt_sound = "creeper_hurt",
707          die_sound = "creeper_hurt",
708          
709          attack_type = "explode",
710          explosion_type = "weather:snow_block",
711          --projectile_timer_cooldown = 5,
712          --projectile_type = "tnt:tnt",
713          
714          explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
715          explosion_power = 4, -- how big the explosion has to be
716          explosion_time = 3, -- how long it takes for a mob to explode
717          
718          die_in_light = false,
719          --die_in_light_level = 12,
720          fire_table = {
721                 visual_size = vector.new(1/4,2/3,1/4),
722                 position = vector.new(0,3.3,0),
723         }
724         }
725 )
726
727
728 mobs.register_mob(
729         {
730          mobname = "nitro_creeper",
731          physical = true,
732          collide_with_objects = false,
733          collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
734          visual = "mesh",
735          visual_size = {x = 3.2, y = 3.2},
736          mesh = "creeper.b3d",
737          textures = {
738                 "nitro_creeper.png"
739         },
740          is_visible = true,
741          pointable = true,
742          automatic_face_movement_max_rotation_per_sec = 300,
743          makes_footstep_sound = false,
744          hp = 40,
745          gravity = {x = 0, y = -9.81, z = 0},
746          movement_type = "walk",
747          max_speed = 9,
748          hostile = true,
749          hostile_cooldown = false,
750          state = 0,
751          view_distance = 40,
752          item_drop = "mob:gunpowder",
753
754          damage_color = "blue",
755           
756          standing_frame = {x=0,y=0},
757          moving_frame = {x=0,y=40},
758          animation_multiplier = 20,
759          ----
760          pathfinds = true,
761          
762          --these are used to anchor a point to the head position
763          -----
764          automatic_face_movement_dir = 0,
765          head_bone = "head",
766          debug_head_pos = false,
767          --this always has to be slightly positive
768          head_directional_offset = 0.01,
769          head_height_offset = 1.45, --added to the base y position
770          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
771          head_position_correction = vector.new(0,2.4,0),
772          head_coord = "vertical",
773          -----
774           
775          
776          death_rotation = "x",
777          
778          hurt_sound = "creeper_hurt",
779          die_sound = "creeper_hurt",
780          
781          attack_type = "explode",
782          --projectile_timer_cooldown = 5,
783          --projectile_type = "tnt:tnt",
784          
785          explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
786          explosion_power = 14, -- how big the explosion is (radius)
787          explosion_time = 3, -- how long it takes for a mob to explode
788          explosion_blink_timer = 0.1, -- how fast the blinking happens
789          
790          die_in_light = false,
791          --die_in_light_level = 12,
792          fire_table = {
793                 visual_size = vector.new(1/4,2/3,1/4),
794                 position = vector.new(0,3.3,0),
795         }
796         }
797 )
798
799 local spider_eyes = {}
800
801 spider_eyes.initial_properties = {
802         visual = "mesh",
803         mesh = "spider_eyes.b3d",
804         textures = {"spider_eyes.png"},
805         pointable = false,
806         collisionbox = {0, 0, 0, 0, 0, 0}
807 }
808 spider_eyes.glow = -1
809 spider_eyes.on_step = function(self)
810         if not self.owner or not self.owner:get_luaentity() then
811                 self.object:remove()
812         else
813                 local owner_head_bone = self.owner:get_luaentity().head_bone
814                 local position,rotation = self.owner:get_bone_position(owner_head_bone)
815                 self.object:set_attach(self.owner, owner_head_bone, vector.new(0,0,0), rotation)
816         end
817 end
818 minetest.register_entity("mob:spider_eyes",spider_eyes)
819
820 mobs.register_mob(
821         {
822          mobname = "spider",
823          physical = true,
824          collide_with_objects = false,
825          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
826          visual = "mesh",
827          visual_size = {x = 3, y = 3},
828          mesh = "spider.b3d",
829          textures = {
830                 "spider.png"
831          },
832          
833          --these are used to anchor a point to the head position
834          -----
835          head_bone = "body.head",
836          debug_head_pos = false,
837          rotational_correction = -math.pi/2,
838          head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
839          head_height_offset = 0.63, --added to the base y position
840          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
841          head_position_correction = vector.new(0,1.24,0),
842          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
843          head_coord = "horizontal",
844          -----
845          
846          is_visible = true,
847          pointable = true,
848          automatic_face_movement_dir = 90,
849          automatic_face_movement_max_rotation_per_sec = 300,
850          makes_footstep_sound = false,
851          hp = 30,
852          gravity = {x = 0, y = -9.81, z = 0},
853          movement_type = "walk",
854          max_speed = 6,
855          state = 0,
856          view_distance = 32,
857          
858          item_drop = "mob:string", 
859          standing_frame = {x=21,y=21},
860          moving_frame = {x=0,y=20},
861          animation_multiplier = 20,
862          ----
863          ----
864          death_rotation = "z",
865          
866          hurt_sound = "spider",
867          die_sound = "spider_die",
868          
869          
870          pathfinds = true,
871
872          hostile = true,
873          friendly_in_daylight = true,
874          attacked_hostile = true,
875          attack_damage = 3,
876          attack_type = "punch",
877          group_attack = true,
878
879          custom_on_activate = function(self)
880                 local eyes = minetest.add_entity(self.object:get_pos(), "mob:spider_eyes")
881                 eyes:set_attach(self.object, "body.head", vector.new(0,0,0), vector.new(0,0,0))
882                 eyes:get_luaentity().owner = self.object
883                 if math.random() > 0.998 then
884                         local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
885                         local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
886                         local obj3 = minetest.add_entity(self.object:get_pos(),"boat:boat")
887
888                         obj2:get_luaentity().timer = 7
889                         obj2:get_luaentity().radius = 7
890
891                         obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
892                         obj2:set_attach(obj,"",vector.new(0,4.5,0),vector.new(0,90,0))
893                         obj3:set_attach(obj2,"",vector.new(0,6.5,0),vector.new(0,0,0))
894
895                         obj:set_properties({visual_size={x=1,y=1}})
896                         obj2:set_properties({visual_size={x=1/3,y=1/3}})
897                 end
898          end,
899          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
900          --explosion_power = 7, -- how big the explosion has to be
901          --explosion_time = 3, -- how long it takes for a mob to explode
902          --this is used to properly position fire when the mob catches on fire
903         fire_table = {
904                 visual_size = vector.new(1.3/3,2/3,1.3/3),
905                 position = vector.new(0,4,0),
906         }
907         }
908 )
909
910 mobs.register_mob(
911         {
912          mobname = "snoider",
913          physical = true,
914          collide_with_objects = false,
915          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
916          visual = "mesh",
917          visual_size = {x = 3, y = 3},
918          mesh = "spider.b3d",
919          textures = {
920                 "snoider.png"
921          },
922          
923          --these are used to anchor a point to the head position
924          -----
925          head_bone = "body.head",
926          debug_head_pos = false,
927          rotational_correction = -math.pi/2,
928          head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
929          head_height_offset = 0.63, --added to the base y position
930          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
931          head_position_correction = vector.new(0,1.24,0),
932          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
933          head_coord = "horizontal",
934          -----
935          
936          is_visible = true,
937          pointable = true,
938          automatic_face_movement_dir = 90,
939          automatic_face_movement_max_rotation_per_sec = 300,
940          makes_footstep_sound = false,
941          hp = 30,
942          gravity = {x = 0, y = -9.81, z = 0},
943          movement_type = "walk",
944          max_speed = 6,
945          state = 0,
946          view_distance = 32,
947          
948          item_drop = "mob:string", 
949          standing_frame = {x=21,y=21},
950          moving_frame = {x=0,y=20},
951          animation_multiplier = 20,
952          ----
953          ----
954          death_rotation = "z",
955          
956          hurt_sound = "spider",
957          die_sound = "spider_die",
958          
959          
960          pathfinds = true,
961
962          hostile = true,
963          friendly_in_daylight = true,
964          attacked_hostile = true,
965          attack_damage = 3,
966          attack_type = "punch",
967          group_attack = true,
968
969          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
970          --explosion_power = 7, -- how big the explosion has to be
971          --explosion_time = 3, -- how long it takes for a mob to explode
972          fire_table = {
973                 visual_size = vector.new(1.3/3,2/3,1.3/3),
974                 position = vector.new(0,4,0),
975         }
976         }
977 )