1 --License for code WTFPL and otherwise stated in readmes
4 local MP
= minetest
.get_modpath(minetest
.get_current_modname())
5 local S
, NS
= dofile(MP
.."/intllib.lua")
14 collisionbox
= {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02},
15 visual_size
= {x
=12.5, y
=12.5},
16 textures
= {{"mobs_mc_slime.png"}},
18 mesh
= "mobs_mc_slime.b3d",
19 blood_texture
="mobs_mc_slime_blood.png",
20 makes_footstep_sound
= true,
22 jump
= "green_slime_jump",
23 death
= "green_slime_death",
24 damage
= "green_slime_damage",
25 attack
= "green_slime_attack",
32 -- TODO: Fix animations
52 attack_type
= "dogfight",
61 on_die
= function(self
, pos
)
63 angle
= math
.random(0, math
.pi
*2)
65 posadd
= {x
=math
.cos(angle
),y
=0,z
=math
.sin(angle
)}
66 posadd
= vector
.normalize(posadd
)
67 local slime
= minetest
.add_entity(vector
.add(pos
, posadd
), "mobs_mc:slime_small")
68 slime
:setvelocity(vector
.multiply(posadd
, 1.5))
69 slime
:setyaw(angle
-math
.pi
/2)
70 angle
= angle
+ math
.pi
/2
74 mobs
:register_mob("mobs_mc:slime_big", slime_big
)
76 local slime_small
= table.copy(slime_big
)
77 slime_small
.hp_min
= 4
78 slime_small
.hp_max
= 4
79 slime_small
.collisionbox
= {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51}
80 slime_small
.visual_size
= {x
=6.25, y
=6.25}
81 slime_small
.damage
= 3
82 slime_small
.reach
= 2.75
83 slime_small
.walk_velocity
= 1.3
84 slime_small
.run_velocity
= 1.3
85 slime_small
.jump_height
= 4.3
86 slime_small
.on_die
= function(self
, pos
)
87 local angle
, posadd
, dir
88 angle
= math
.random(0, math
.pi
*2)
90 dir
= {x
=math
.cos(angle
),y
=0,z
=math
.sin(angle
)}
91 posadd
= vector
.multiply(vector
.normalize(dir
), 0.6)
92 local slime
= minetest
.add_entity(vector
.add(pos
, posadd
), "mobs_mc:slime_tiny")
93 slime
:setvelocity(dir
)
94 slime
:setyaw(angle
-math
.pi
/2)
95 angle
= angle
+ math
.pi
/2
98 mobs
:register_mob("mobs_mc:slime_small", slime_small
)
100 local slime_tiny
= table.copy(slime_big
)
101 slime_tiny
.hp_min
= 1
102 slime_tiny
.hp_max
= 1
103 slime_tiny
.collisionbox
= {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505}
104 slime_tiny
.visual_size
= {x
=3.125, y
=3.125}
105 slime_tiny
.damage
= 0
106 slime_tiny
.reach
= 2.5
109 {name
= mobs_mc
.items
.slimeball
,
114 slime_tiny
.walk_velocity
= 0.7
115 slime_tiny
.run_velocity
= 0.7
116 slime_tiny
.jump_height
= 3
117 slime_tiny
.on_die
= nil
119 mobs
:register_mob("mobs_mc:slime_tiny", slime_tiny
)
121 local smin
= mobs_mc
.spawn_height
.overworld_min
122 local smax
= mobs_mc
.spawn_height
.water
- 23
124 mobs
:spawn_specific("mobs_mc:slime_tiny", mobs_mc
.spawn
.solid
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 12000, 4, smin
, smax
)
125 mobs
:spawn_specific("mobs_mc:slime_small", mobs_mc
.spawn
.solid
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 8500, 4, smin
, smax
)
126 mobs
:spawn_specific("mobs_mc:slime_big", mobs_mc
.spawn
.solid
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 10000, 4, smin
, smax
)
129 local magma_cube_big
= {
133 collisionbox
= {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02},
134 visual_size
= {x
=12.5, y
=12.5},
135 textures
= {{ "mobs_mc_magmacube.png" }},
137 mesh
= "mobs_mc_magmacube.b3d",
138 blood_texture
= "mobs_mc_magmacube_blood.png",
139 makes_footstep_sound
= true,
141 jump
= "green_slime_jump",
142 death
= "green_slime_death",
143 damage
= "green_slime_damage",
144 attack
= "green_slime_attack",
153 {name
= mobs_mc
.items
.magma_cream
,
158 -- TODO: Fix animations
178 attack_type
= "dogfight",
184 fear_height
= 100000,
185 on_die
= function(self
, pos
)
187 angle
= math
.random(0, math
.pi
*2)
189 posadd
= {x
=math
.cos(angle
),y
=0,z
=math
.sin(angle
)}
190 posadd
= vector
.normalize(posadd
)
191 local mob
= minetest
.add_entity(vector
.add(pos
, posadd
), "mobs_mc:magma_cube_small")
192 mob
:setvelocity(vector
.multiply(posadd
, 1.5))
193 mob
:setyaw(angle
-math
.pi
/2)
194 angle
= angle
+ (math
.pi
*2) / 3
198 mobs
:register_mob("mobs_mc:magma_cube_big", magma_cube_big
)
200 local magma_cube_small
= table.copy(magma_cube_big
)
201 magma_cube_small
.hp_min
= 4
202 magma_cube_small
.hp_max
= 4
203 magma_cube_small
.collisionbox
= {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51}
204 magma_cube_small
.visual_size
= {x
=6.25, y
=6.25}
205 magma_cube_small
.damage
= 3
206 magma_cube_small
.reach
= 2.75
207 magma_cube_small
.walk_velocity
= .8
208 magma_cube_small
.run_velocity
= 2.6
209 magma_cube_small
.jump_height
= 6
210 magma_cube_small
.damage
= 4
211 magma_cube_small
.reach
= 2.75
212 magma_cube_small
.armor
= 70
213 magma_cube_small
.on_die
= function(self
, pos
)
214 local angle
, posadd
, dir
215 angle
= math
.random(0, math
.pi
*2)
217 dir
= vector
.normalize({x
=math
.cos(angle
),y
=0,z
=math
.sin(angle
)})
218 posadd
= vector
.multiply(dir
, 0.6)
219 local mob
= minetest
.add_entity(vector
.add(pos
, posadd
), "mobs_mc:magma_cube_tiny")
221 mob
:setyaw(angle
-math
.pi
/2)
222 angle
= angle
+ math
.pi
/2
225 mobs
:register_mob("mobs_mc:magma_cube_small", magma_cube_small
)
227 local magma_cube_tiny
= table.copy(magma_cube_big
)
228 magma_cube_tiny
.hp_min
= 1
229 magma_cube_tiny
.hp_max
= 1
230 magma_cube_tiny
.collisionbox
= {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505}
231 magma_cube_tiny
.visual_size
= {x
=3.125, y
=3.125}
232 magma_cube_tiny
.walk_velocity
= 1.02
233 magma_cube_tiny
.run_velocity
= 1.02
234 magma_cube_tiny
.jump_height
= 4
235 magma_cube_tiny
.damage
= 3
236 magma_cube_tiny
.reach
= 2.5
237 magma_cube_tiny
.armor
= 85
238 magma_cube_tiny
.drops
= {}
239 magma_cube_tiny
.on_die
= nil
241 mobs
:register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny
)
244 local mmin
= mobs_mc
.spawn_height
.nether_min
245 local mmax
= mobs_mc
.spawn_height
.nether_max
247 mobs
:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc
.spawn
.nether
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 15000, 4, mmin
, mmax
)
248 mobs
:spawn_specific("mobs_mc:magma_cube_small", mobs_mc
.spawn
.nether
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 15500, 4, mmin
, mmax
)
249 mobs
:spawn_specific("mobs_mc:magma_cube_big", mobs_mc
.spawn
.nether
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 16000, 4, mmin
, mmax
)
251 mobs
:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc
.spawn
.nether_fortress
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 11000, 4, mmin
, mmax
)
252 mobs
:spawn_specific("mobs_mc:magma_cube_small", mobs_mc
.spawn
.nether_fortress
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 11100, 4, mmin
, mmax
)
253 mobs
:spawn_specific("mobs_mc:magma_cube_big", mobs_mc
.spawn
.nether_fortress
, {"air"}, 0, minetest
.LIGHT_MAX
+1, 30, 11200, 4, mmin
, mmax
)
257 mobs
:alias_mob("mobs_mc:greensmall", "mobs_mc:slime_tiny")
258 mobs
:alias_mob("mobs_mc:greenmedium", "mobs_mc:slime_small")
259 mobs
:alias_mob("mobs_mc:greenbig", "mobs_mc:slime_big")
260 mobs
:alias_mob("mobs_mc:lavasmall", "mobs_mc:magma_cube_tiny")
261 mobs
:alias_mob("mobs_mc:lavamedium", "mobs_mc:magma_cube_small")
262 mobs
:alias_mob("mobs_mc:lavabig", "mobs_mc:magma_cube_big")
265 mobs
:register_egg("mobs_mc:magma_cube_big", S("Magma Cube"), "mobs_mc_spawn_icon_magmacube.png")
266 mobs
:register_egg("mobs_mc:slime_big", S("Slime"), "mobs_mc_spawn_icon_slime.png")
269 if minetest
.settings
:get_bool("log_mods") then
270 minetest
.log("action", "MC Slimes loaded")