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