]> git.lizzy.rs Git - Crafter.git/blob - mods/mob/init.lua
Rebalance mobs to attack faster yet deal less damage
[Crafter.git] / mods / mob / init.lua
1 --this is where mobs are defined
2
3 --this is going to be used to set an active mob limit
4 global_mob_amount = 0
5 mob_limit = 100
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          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
72          --explosion_power = 7, -- how big the explosion has to be
73          --explosion_time = 3, -- how long it takes for a mob to explode
74         }
75 )
76
77
78 mobs.register_mob(
79         {
80          mobname = "chicken",
81          physical = true,
82          collide_with_objects = false,
83          collisionbox = {-0.225, 0, -0.225, 0.225, 0.675, 0.225},
84          visual = "mesh",
85          visual_size = {x = 3, y = 3},
86          mesh = "chicken.b3d",
87          textures = {
88                  --blank out the first two to create adult pig
89                 "chicken.png"
90          },
91          
92          --these are used to anchor a point to the head position
93
94
95          -----
96          head_bone = "head",
97          debug_head_pos = false,
98          rotational_correction = -math.pi/2,
99          head_directional_offset = 0.2, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
100          head_height_offset = 0.82, --added to the base y position
101          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
102          head_position_correction = vector.new(0,1.8,-0.89),
103          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
104          head_coord = "vertical",
105          flip_pitch = true,
106          -----
107          
108          is_visible = true,
109          pointable = true,
110          automatic_face_movement_dir = 90,
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:egg","mob:feather"}, 
121          standing_frame = {x=20,y=20},
122          moving_frame = {x=0,y=20},
123          animation_multiplier = 15,
124          ----
125          ----
126          death_rotation = "z",
127          
128          hurt_sound = "chicken_hurt",
129          die_sound = "chicken_die",
130          
131          
132          hostile = false,
133          attacked_hostile = false,
134          attack_type = "punch",
135          group_attack = true,
136          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
137          --explosion_power = 7, -- how big the explosion has to be
138          --explosion_time = 3, -- how long it takes for a mob to explode
139         }
140 )
141
142 mobs.register_mob(
143         {
144          mobname = "snowman",
145          physical = true,
146          collide_with_objects = false,
147          collisionbox = {-0.37, 0, -0.37, 0.37, 1.75, 0.37},
148          visual = "mesh",
149          visual_size = {x = 3, y = 3},
150          mesh = "snowman.b3d",
151          textures = {
152                 "snowman.png","snowman.png","snowman.png","snowman.png","snowman.png","snowman.png",
153          },
154          
155          --these are used to anchor a point to the head position
156
157
158          -----
159          --head_bone = "Bone",
160          debug_head_pos = false,
161          head_directional_offset = 0, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
162          head_height_offset = 1.625, --added to the base y position
163          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
164          head_position_correction = vector.new(0,4.6,0),
165          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
166          head_coord = "vertical",
167          --rotational_correction = math.pi/2,
168          -----
169          
170          is_visible = true,
171          pointable = true,
172          automatic_face_movement_dir = -90,
173          automatic_face_movement_max_rotation_per_sec = 300,
174          makes_footstep_sound = false,
175          hp = 10,
176          gravity = {x = 0, y = -9.81, z = 0},
177          movement_type = "walk",
178          max_speed = 5,
179          state = 0,
180          view_distance = 15,
181          
182          item_drop = {"weather:snowball","main:coal","mob:carrot","main:stick"}, 
183          standing_frame = {x=0,y=0},
184          moving_frame = {x=0,y=0},
185          animation_multiplier = 10,
186          ----
187          ----
188          death_rotation = "z",
189          
190          hurt_sound = "wool",
191          die_sound = "wool",
192          
193          
194          hostile = true,
195          attack_type = "projectile",
196          projectile_type = "weather:snowball",
197          projectile_timer_cooldown = 1,
198
199          custom_function = function(self,dtime,moveresult)
200                 if moveresult and moveresult.touching_ground then
201                         local pos = vector.floor(vector.add(self.object:get_pos(),0.5))
202
203                         if self.custom_old_pos and not vector.equals(pos,self.custom_old_pos) then
204                                 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
205                                         minetest.set_node(pos,{name="weather:snow"})
206                                 end
207                         end
208                         self.custom_old_pos = pos
209                 end
210          end,
211
212          custom_timer = 0.75,
213          custom_timer_function = function(self,dtime)
214                 if weather_type and weather_type ~= 1 then
215                         self.object:punch(self.object, 2, 
216                                 {
217                                 full_punch_interval=1.5,
218                                 damage_groups = {damage=2},
219                                 })
220                 end
221          end,
222         }
223 )
224
225 mobs.register_mob(
226         {
227          mobname = "phyg",
228          physical = true,
229          collide_with_objects = false,
230          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
231          visual = "mesh",
232          visual_size = {x = 3, y = 3},
233          mesh = "phyg.b3d",
234          textures = {
235                  --blank out the first two to create adult pig
236                 "phyg.png","wings.png"
237          },
238          
239          --these are used to anchor a point to the head position
240
241
242          -----
243          head_bone = "head",
244          debug_head_pos = false,
245          head_directional_offset = 0.5, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
246          head_height_offset = 0.8, --added to the base y position
247          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
248          head_position_correction = vector.new(0,3,-0.5),
249          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
250          head_coord = "horizontal",
251          -----
252          
253          is_visible = true,
254          pointable = true,
255          automatic_face_movement_dir = 0,
256          automatic_face_movement_max_rotation_per_sec = 300,
257          makes_footstep_sound = false,
258          takes_fall_damage = false,
259          make_jump_noise = false,
260          hp = 10,
261          gravity = {x = 0, y = -1, z = 0},
262          movement_type = "walk",
263          max_speed = 5,
264          state = 0,
265          view_distance = 15,
266          
267          item_drop = "main:gold", 
268          item_minimum = 4,
269          item_max = 5,
270
271          standing_frame = {x=0,y=0},
272          moving_frame = {x=0,y=40},
273          animation_multiplier = 20,
274          ----
275          ----
276          death_rotation = "x",
277          
278          hurt_sound = "pig",
279          die_sound = "pig_die",
280          
281          
282          hostile = false,
283          attacked_hostile = false,
284          attack_type = "punch",
285          group_attack = true,
286          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
287          --explosion_power = 7, -- how big the explosion has to be
288          --explosion_time = 3, -- how long it takes for a mob to explode
289         }
290 )
291
292
293 mobs.register_mob(
294         {
295         mobname = "big_slime",
296         physical = true,
297         collide_with_objects = false,
298         collisionbox = {-1.25, 0, -1.25, 1.25, 2.5, 1.25},
299         visual = "mesh",
300         visual_size = {x = 15, y = 15},
301         mesh = "slime.b3d",
302         textures = {
303                 "slime.png"
304         },
305         collision_boundary = 2.5,
306         is_visible = true,
307         pointable = true,
308         automatic_face_movement_dir = 90,
309         automatic_face_movement_max_rotation_per_sec = 300,
310         makes_footstep_sound = false,
311         hp = 32,
312         gravity = {x = 0, y = -9.81, z = 0},
313         movement_type = "jump",
314         make_jump_noise = true,
315         max_speed = 5,
316         hostile = true,
317         state = 0,
318         view_distance = 20,
319         death_rotation = "z",
320         hurt_sound = "slime_die",
321         die_sound = "slime_die",
322         attack_type = "punch",
323         attack_damage = 6,
324         custom_on_death = function(self)
325                 local pos = self.object:get_pos()
326                 for i = 1,4 do
327                         minetest.add_entity(pos,"mob:medium_slime")
328                 end
329         end,
330         }
331 )
332
333 mobs.register_mob(
334         {
335         mobname = "medium_slime",
336         physical = true,
337         collide_with_objects = false,
338         collisionbox = {-0.625, 0, -0.625, 0.625, 1.25, 0.625},
339         visual = "mesh",
340         visual_size = {x = 7.5, y = 7.5},
341         mesh = "slime.b3d",
342         textures = {
343                 "slime.png"
344         },
345         is_visible = true,
346         pointable = true,
347         automatic_face_movement_dir = 90,
348         automatic_face_movement_max_rotation_per_sec = 300,
349         makes_footstep_sound = false,
350         hp = 10,
351         gravity = {x = 0, y = -9.81, z = 0},
352         movement_type = "jump",
353         make_jump_noise = true,
354         max_speed = 5,
355         hostile = true,
356         state = 0,
357         view_distance = 20,
358         death_rotation = "z",
359         hurt_sound = "slime_die",
360         die_sound = "slime_die",
361         attack_damage = 2,
362         attack_type = "punch",
363         custom_on_death = function(self)
364                 local pos = self.object:get_pos()
365                 pos.y = pos.y + 0.2
366                 for i = 1,4 do
367                         minetest.add_entity(pos,"mob:small_slime")
368                 end
369         end,
370         }
371 )
372
373 mobs.register_mob(
374         {
375         mobname = "small_slime",
376         physical = true,
377         collide_with_objects = false,
378         collisionbox = {-0.3, 0, -0.3, 0.3, 0.6, 0.3},
379         visual = "mesh",
380         visual_size = {x = 3.7, y = 3.7},
381         mesh = "slime.b3d",
382         textures = {
383                 "slime.png"
384         },
385         is_visible = true,
386         pointable = true,
387         automatic_face_movement_dir = 90,
388         automatic_face_movement_max_rotation_per_sec = 300,
389         makes_footstep_sound = false,
390         hp = 4,
391         gravity = {x = 0, y = -9.81, z = 0},
392         movement_type = "jump",
393         make_jump_noise = true,
394         max_speed = 5,
395         hostile = true,
396         state = 0,
397         view_distance = 20,
398         death_rotation = "z",
399         hurt_sound = "slime_die",
400         die_sound = "slime_die",
401         attack_damage = 1,
402         attack_type = "punch",
403         item_drop = "mob:slimeball"
404         }
405 )
406
407 --[[
408
409
410 mobs.register_mob(
411         {
412          mobname = "creepig",
413          physical = true,
414          collide_with_objects = false,
415          collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
416          visual = "mesh",
417          visual_size = {x = 3, y = 3},
418          mesh = "pig.x",
419          textures = {
420                 "creepig_body.png","creepig_leg.png","creepig_leg.png","creepig_leg.png","creepig_leg.png"
421         },
422          is_visible = true,
423          pointable = true,
424          automatic_face_movement_dir = -90.0,
425          automatic_face_movement_max_rotation_per_sec = 300,
426          makes_footstep_sound = false,
427          hp = 10,
428          gravity = {x = 0, y = -9.81, z = 0},
429          movement_type = "walk",
430          max_speed = 4,
431          hostile = true,
432          state = 0,
433          view_distance = 20,
434          item_drop = "mob:cooked_porkchop",
435           
436          standing_frame = {x=0,y=0},
437          moving_frame = {x=5,y=15},
438          animation_multiplier = 5,
439          ----
440           
441          has_head = true, --remove this when mesh based head rotation is implemented
442          head_visual = "mesh",
443          head_visual_size = {x = 1.1, y = 1.1},
444          head_mesh = "pig_head.x",
445          head_textures ={"creepig_head.png","creepig_nose.png"},
446          head_mount = vector.new(0,1.2,1.9),
447          
448          death_rotation = "z",
449          
450          hurt_sound = "pig",
451          die_sound = "pig_die",
452          
453          attack_type = "explode",
454          --projectile_timer_cooldown = 5,
455          --projectile_type = "tnt:tnt",
456          
457          explosion_radius = 2, -- how far away the mob has to be to initialize the explosion
458          explosion_power = 7, -- how big the explosion has to be
459          explosion_time = 5, -- how long it takes for a mob to explode
460          
461          die_in_light = true,
462          die_in_light_level = 12,
463         }
464 )
465
466 ]]--
467
468 mobs.register_mob(
469         {
470          mobname = "creeper",
471          physical = true,
472          collide_with_objects = false,
473          collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
474          visual = "mesh",
475          visual_size = {x = 3.2, y = 3.2},
476          mesh = "creeper.b3d",
477          textures = {
478                 "creeper.png"
479         },
480          is_visible = true,
481          pointable = true,
482          automatic_face_movement_max_rotation_per_sec = 300,
483          makes_footstep_sound = false,
484          hp = 27,
485          gravity = {x = 0, y = -9.81, z = 0},
486          movement_type = "walk",
487          max_speed = 5.5,
488          hostile = true,
489          hostile_cooldown = false,
490          state = 0,
491          view_distance = 32,
492          item_drop = "mob:gunpowder",
493           
494          standing_frame = {x=0,y=0},
495          moving_frame = {x=0,y=40},
496          animation_multiplier = 20,
497          ----
498          pathfinds = true,
499          
500          --these are used to anchor a point to the head position
501          -----
502          automatic_face_movement_dir = 0,
503          head_bone = "head",
504          debug_head_pos = false,
505          --this always has to be slightly positive
506          head_directional_offset = 0.01,
507          head_height_offset = 1.45, --added to the base y position
508          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
509          head_position_correction = vector.new(0,2.4,0),
510          head_coord = "vertical",
511          -----
512           
513          
514          death_rotation = "x",
515          
516          hurt_sound = "creeper_hurt",
517          die_sound = "creeper_hurt",
518          
519          attack_type = "explode",
520          --projectile_timer_cooldown = 5,
521          --projectile_type = "tnt:tnt",
522          
523          explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
524          explosion_power = 4, -- how big the explosion has to be
525          explosion_time = 3, -- how long it takes for a mob to explode
526          
527          die_in_light = false,
528          --die_in_light_level = 12,
529         }
530 )
531
532
533
534 mobs.register_mob(
535         {
536          mobname = "nitro_creeper",
537          physical = true,
538          collide_with_objects = false,
539          collisionbox = {-0.37,0, -0.37, 0.37, 1.5, 0.37},
540          visual = "mesh",
541          visual_size = {x = 3.2, y = 3.2},
542          mesh = "creeper.b3d",
543          textures = {
544                 "nitro_creeper.png"
545         },
546          is_visible = true,
547          pointable = true,
548          automatic_face_movement_max_rotation_per_sec = 300,
549          makes_footstep_sound = false,
550          hp = 40,
551          gravity = {x = 0, y = -9.81, z = 0},
552          movement_type = "walk",
553          max_speed = 9,
554          hostile = true,
555          hostile_cooldown = false,
556          state = 0,
557          view_distance = 40,
558          item_drop = "mob:gunpowder",
559
560          damage_color = "blue",
561           
562          standing_frame = {x=0,y=0},
563          moving_frame = {x=0,y=40},
564          animation_multiplier = 20,
565          ----
566          pathfinds = true,
567          
568          --these are used to anchor a point to the head position
569          -----
570          automatic_face_movement_dir = 0,
571          head_bone = "head",
572          debug_head_pos = false,
573          --this always has to be slightly positive
574          head_directional_offset = 0.01,
575          head_height_offset = 1.45, --added to the base y position
576          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
577          head_position_correction = vector.new(0,2.4,0),
578          head_coord = "vertical",
579          -----
580           
581          
582          death_rotation = "x",
583          
584          hurt_sound = "creeper_hurt",
585          die_sound = "creeper_hurt",
586          
587          attack_type = "explode",
588          --projectile_timer_cooldown = 5,
589          --projectile_type = "tnt:tnt",
590          
591          explosion_radius = 6, -- how far away the mob has to be to initialize the explosion
592          explosion_power = 14, -- how big the explosion is (radius)
593          explosion_time = 3, -- how long it takes for a mob to explode
594          explosion_blink_timer = 0.1, -- how fast the blinking happens
595          
596          die_in_light = false,
597          --die_in_light_level = 12,
598         }
599 )
600
601
602 mobs.register_mob(
603         {
604          mobname = "spider",
605          physical = true,
606          collide_with_objects = false,
607          collisionbox = {-0.37, 0, -0.37, 0.37, 0.85, 0.37},
608          visual = "mesh",
609          visual_size = {x = 3, y = 3},
610          mesh = "spider.b3d",
611          textures = {
612                 "spider.png"
613          },
614          
615          --these are used to anchor a point to the head position
616          -----
617          head_bone = "body.head",
618          debug_head_pos = false,
619          rotational_correction = -math.pi/2,
620          head_directional_offset = 0.3, --used in vector.multiply(minetest.yaw_to_dir(body_yaw),head_offset)
621          head_height_offset = 0.63, --added to the base y position
622          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
623          head_position_correction = vector.new(0,1.24,0),
624          --this is used to tell the game the orientation of the bone (swaps x to and y, then z and y)
625          head_coord = "horizontal",
626          -----
627          
628          is_visible = true,
629          pointable = true,
630          automatic_face_movement_dir = 90,
631          automatic_face_movement_max_rotation_per_sec = 300,
632          makes_footstep_sound = false,
633          hp = 30,
634          gravity = {x = 0, y = -9.81, z = 0},
635          movement_type = "walk",
636          max_speed = 6,
637          state = 0,
638          view_distance = 32,
639          
640          item_drop = "mob:string", 
641          standing_frame = {x=21,y=21},
642          moving_frame = {x=0,y=20},
643          animation_multiplier = 20,
644          ----
645          ----
646          death_rotation = "z",
647          
648          hurt_sound = "spider",
649          die_sound = "spider_die",
650          
651          
652          pathfinds = true,
653
654          hostile = true,
655          friendly_in_daylight = true,
656          attacked_hostile = true,
657          attack_damage = 3,
658          attack_type = "punch",
659          group_attack = true,
660
661          custom_on_activate = function(self)
662                 if math.random() > 0.998 then
663                         local obj = minetest.add_entity(self.object:get_pos(),"mob:pig")
664                         local obj2 = minetest.add_entity(self.object:get_pos(),"tnt:tnt")
665                         local obj3 = minetest.add_entity(self.object:get_pos(),"boat:boat")
666
667                         obj2:get_luaentity().timer = 7
668                         obj2:get_luaentity().radius = 7
669
670                         obj:set_attach(self.object,"",vector.new(0,3,0),vector.new(0,90,0))
671                         obj2:set_attach(obj,"",vector.new(0,4.5,0),vector.new(0,90,0))
672                         obj3:set_attach(obj2,"",vector.new(0,6.5,0),vector.new(0,0,0))
673
674                         obj:set_properties({visual_size={x=1,y=1}})
675                         obj2:set_properties({visual_size={x=1/3,y=1/3}})
676                 end
677          end
678          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
679          --explosion_power = 7, -- how big the explosion has to be
680          --explosion_time = 3, -- how long it takes for a mob to explode
681         }
682 )