]> git.lizzy.rs Git - Crafter.git/blob - mods/mob/init.lua
122bfad512ded3db80d3a45abc67038562f30395
[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.5, 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 = true,
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
79 --[[
80 mobs.register_mob(
81         {
82          mobname = "chicken",
83          physical = true,
84          collide_with_objects = false,
85          collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
86          visual = "mesh",
87          visual_size = {x = 3, y = 3},
88          mesh = "chicken.b3d",
89          textures = {
90                  --if you're wondering what mob this is, it's a chicken
91                 "chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png","chicken.png"
92          },
93          is_visible = true,
94          pointable = true,
95          automatic_face_movement_dir = -90.0,
96          automatic_face_movement_max_rotation_per_sec = 300,
97          makes_footstep_sound = false,
98          hp = 10,
99          gravity = {x = 0, y = -9.81, z = 0},
100          movement_type = "walk",
101          max_speed = 5,
102          hostile = false,
103          state = 0,
104          view_distance = 15,
105          
106          item_drop = "mob:raw_porkchop", 
107          standing_frame = {x=0,y=0},
108          moving_frame = {x=5,y=15},
109          animation_multiplier = 5,
110          ----
111           
112          has_head = true, --remove this when mesh based head rotation is implemented
113          head_visual = "mesh",
114          head_visual_size = {x = 1.1, y = 1.1},
115          head_mesh = "pig_head.x",
116          head_textures ={"head.png","nose.png"},
117          head_mount = vector.new(0,1.2,1.9),
118          
119          death_rotation = "z",
120          
121          hurt_sound = "pig",
122          die_sound = "pig_die",
123          
124          attack_type = "punch",
125          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
126          --explosion_power = 7, -- how big the explosion has to be
127          --explosion_time = 3, -- how long it takes for a mob to explode
128         }
129 )
130
131
132 mobs.register_mob(
133         {
134          mobname = "slime",
135          physical = true,
136          collide_with_objects = false,
137          collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
138          visual = "mesh",
139          visual_size = {x = 3, y = 3},
140          mesh = "slime.x",
141          textures = {
142                 "slimecore.png","slimeeye.png","slimeeye.png","slimeeye.png","slimeoutside.png"
143          },
144          is_visible = true,
145          pointable = true,
146          automatic_face_movement_dir = 180,
147          automatic_face_movement_max_rotation_per_sec = 300,
148          makes_footstep_sound = false,
149          hp = 10,
150          gravity = {x = 0, y = -9.81, z = 0},
151          movement_type = "jump",
152          max_speed = 5,
153          hostile = true,
154          state = 0,
155          view_distance = 20,
156          item_drop = "mob:slimeball",
157         
158          standing_frame = {x=0,y=0},
159          moving_frame = {x=0,y=0},
160          animation_multiplier = 5,
161          ----
162          has_head = false, --remove this when mesh based head rotation is implemented
163          
164          death_rotation = "x",
165          
166          hurt_sound = "slime_die",
167          die_sound = "slime_die",
168          
169          attack_type = "punch",
170          die_in_light = true,
171          die_in_light_level = 12,
172         }
173 )
174
175
176 mobs.register_mob(
177         {
178          mobname = "flying_pig",
179          physical = true,
180          collide_with_objects = false,
181          collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
182          visual = "mesh",
183          visual_size = {x = 3, y = 3},
184          mesh = "pig.x",
185          textures = {
186                 "flying_pig_body.png","flying_pig_leg.png","flying_pig_leg.png","flying_pig_leg.png","flying_pig_leg.png"
187         },
188          is_visible = true,
189          pointable = true,
190          automatic_face_movement_dir = -90.0,
191          automatic_face_movement_max_rotation_per_sec = 300,
192          makes_footstep_sound = false,
193          hp = 10,
194          gravity = {x = 0, y = -1, z = 0},
195          movement_type = "jump",
196          max_speed = 5,
197          hostile = true,
198          state = 0,
199          view_distance = 50,
200          item_drop = "main:gold",
201          item_minimum = 4,
202          item_amount = 5,
203           
204          standing_frame = {x=0,y=0},
205          moving_frame = {x=5,y=15},
206          animation_multiplier = 5,
207          ----
208           
209          has_head = true, --remove this when mesh based head rotation is implemented
210          head_visual = "mesh",
211          head_visual_size = {x = 1.1, y = 1.1},
212          head_mesh = "pig_head.x",
213          head_textures ={"flying_pig_head.png","flying_pig_nose.png"},
214          head_mount = vector.new(0,1.2,1.9),
215          
216          death_rotation = "z",
217          
218          hurt_sound = "pig",
219          die_sound = "pig_die",
220          
221          attack_type = "projectile",
222          projectile_timer_cooldown = 5,
223          projectile_type = "tnt:tnt",
224          
225          --explosion_radius = 4, -- how far away the mob has to be to initialize the explosion
226          --explosion_power = 7, -- how big the explosion has to be
227          --explosion_time = 3, -- how long it takes for a mob to explode
228         }
229 )
230
231
232
233 mobs.register_mob(
234         {
235          mobname = "creepig",
236          physical = true,
237          collide_with_objects = false,
238          collisionbox = {-0.37, -0.4, -0.37, 0.37, 0.5, 0.37},
239          visual = "mesh",
240          visual_size = {x = 3, y = 3},
241          mesh = "pig.x",
242          textures = {
243                 "creepig_body.png","creepig_leg.png","creepig_leg.png","creepig_leg.png","creepig_leg.png"
244         },
245          is_visible = true,
246          pointable = true,
247          automatic_face_movement_dir = -90.0,
248          automatic_face_movement_max_rotation_per_sec = 300,
249          makes_footstep_sound = false,
250          hp = 10,
251          gravity = {x = 0, y = -9.81, z = 0},
252          movement_type = "walk",
253          max_speed = 4,
254          hostile = true,
255          state = 0,
256          view_distance = 20,
257          item_drop = "mob:cooked_porkchop",
258           
259          standing_frame = {x=0,y=0},
260          moving_frame = {x=5,y=15},
261          animation_multiplier = 5,
262          ----
263           
264          has_head = true, --remove this when mesh based head rotation is implemented
265          head_visual = "mesh",
266          head_visual_size = {x = 1.1, y = 1.1},
267          head_mesh = "pig_head.x",
268          head_textures ={"creepig_head.png","creepig_nose.png"},
269          head_mount = vector.new(0,1.2,1.9),
270          
271          death_rotation = "z",
272          
273          hurt_sound = "pig",
274          die_sound = "pig_die",
275          
276          attack_type = "explode",
277          --projectile_timer_cooldown = 5,
278          --projectile_type = "tnt:tnt",
279          
280          explosion_radius = 2, -- how far away the mob has to be to initialize the explosion
281          explosion_power = 7, -- how big the explosion has to be
282          explosion_time = 5, -- how long it takes for a mob to explode
283          
284          die_in_light = true,
285          die_in_light_level = 12,
286         }
287 )
288
289 ]]--
290
291 mobs.register_mob(
292         {
293          mobname = "creeper",
294          physical = true,
295          collide_with_objects = false,
296          collisionbox = {-0.37,0, -0.37, 0.37, 0.5, 0.37},
297          visual = "mesh",
298          visual_size = {x = 3.2, y = 3.2},
299          mesh = "creeper.b3d",
300          textures = {
301                 "creeper.png"
302         },
303          is_visible = true,
304          pointable = true,
305          automatic_face_movement_max_rotation_per_sec = 300,
306          makes_footstep_sound = false,
307          hp = 10,
308          gravity = {x = 0, y = -9.81, z = 0},
309          movement_type = "walk",
310          max_speed = 0.1,
311          hostile = false,
312          state = 0,
313          view_distance = 20,
314          item_drop = "mob:cooked_porkchop",
315           
316          standing_frame = {x=0,y=0},
317          moving_frame = {x=0,y=40},
318          animation_multiplier = 20,
319          ----
320          
321          
322          --these are used to anchor a point to the head position
323          -----
324          automatic_face_movement_dir = 0,
325          head_bone = "head",
326          debug_head_pos = true,
327          --this always has to be slightly positive
328          head_directional_offset = 0.01,
329          head_height_offset = 1.45, --added to the base y position
330          --use this to correct the head position initially because it becomes severly offset - look at your blender model to get this perfect
331          head_position_correction = vector.new(0,2.4,0),
332          head_coord = "vertical",
333          -----
334           
335          
336          death_rotation = "x",
337          
338          hurt_sound = "pig",
339          die_sound = "pig_die",
340          
341          attack_type = "explode",
342          --projectile_timer_cooldown = 5,
343          --projectile_type = "tnt:tnt",
344          
345          explosion_radius = 2, -- how far away the mob has to be to initialize the explosion
346          explosion_power = 7, -- how big the explosion has to be
347          explosion_time = 5, -- how long it takes for a mob to explode
348          
349          die_in_light = false,
350          --die_in_light_level = 12,
351         }
352 )
353