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