3 --made for MC like Survival game
4 --License for code WTFPL and otherwise stated in readmes
7 local MP
= minetest
.get_modpath(minetest
.get_current_modname())
8 local S
, NS
= dofile(MP
.."/intllib.lua")
10 --dofile(minetest.get_modpath("mobs").."/api.lua")
14 --################### WITHER
18 mobs
:register_mob("mobs_mc:wither", {
23 -- This deviates from MC Wiki's size, which makes no sense
24 collisionbox
= {-0.9, 0.4, -0.9, 0.9, 2.45, 0.9},
26 mesh
= "mobs_mc_wither.b3d",
28 {"mobs_mc_wither.png"},
30 visual_size
= {x
=4, y
=4},
31 makes_footstep_sound
= true,
38 shoot_attack
= "mobs_mc_ender_dragon_shoot",
39 attack
= "mobs_mc_ender_dragon_attack",
48 dogshoot_count_max
=1,
49 attack_animals
= true,
52 {name
= mobs_mc
.items
.nether_star
,
60 attack_type
= "dogshoot",
62 explosion_fire
= false,
64 arrow
= "mobs_mc:fireball",
69 walk_speed
= 12, run_speed
= 12, stand_speed
= 12,
70 stand_start
= 0, stand_end
= 20,
71 walk_start
= 0, walk_end
= 20,
72 run_start
= 0, run_end
= 20,
77 local mobs_griefing
= minetest
.settings
:get_bool("mobs_griefing") ~= false
79 mobs
:register_arrow("mobs_mc:roar_of_the_dragon", {
81 visual_size
= {x
= 1, y
= 1},
82 textures
= {"blank.png"},
85 on_step
= function(self
, dtime
)
87 local pos
= self
.object
:getpos()
89 local n
= minetest
.get_node(pos
).name
91 if self
.timer
== 0 then
92 self
.timer
= os
.time()
95 if os
.time() - self
.timer
> 8 or minetest
.is_protected(pos
, "") then
99 local objects
= minetest
.get_objects_inside_radius(pos
, 1)
100 for _
,obj
in ipairs(objects
) do
101 local name
= self
.name
102 if name
~="mobs_mc:roar_of_the_dragon" and name
~= "mobs_mc:wither" then
103 obj
:set_hp(obj
:get_hp()-0.05)
104 if (obj
:get_hp() <= 0) then
105 if (not obj
:is_player()) and name
~= self
.object
:get_luaentity().name
then
112 if mobs_griefing
then
113 minetest
.set_node(pos
, {name
="air"})
114 if math
.random(1,2)==1 then
115 local dx
= math
.random(-1,1)
116 local dy
= math
.random(-1,1)
117 local dz
= math
.random(-1,1)
118 local p
= {x
=pos
.x
+dx
, y
=pos
.y
+dy
, z
=pos
.z
+dz
}
119 minetest
.set_node(p
, {name
="air"})
126 mobs
:register_arrow(":mobs_mc:fireball", {
128 visual_size
= {x
= 0.75, y
= 0.75},
129 -- TODO: 3D projectile, replace tetxture
130 textures
= {"mobs_mc_TEMP_wither_projectile.png"},
133 -- direct hit, no fire... just plenty of pain
134 hit_player
= function(self
, player
)
135 minetest
.sound_play("tnt_explode", {pos
= pos
, gain
= 1.5, max_hear_distance
= 16})
136 player
:punch(self
.object
, 1.0, {
137 full_punch_interval
= 0.5,
138 damage_groups
= {fleshy
= 8},
143 hit_mob
= function(self
, player
)
144 minetest
.sound_play("tnt_explode", {pos
= pos
, gain
= 1.5,max_hear_distance
= 16})
145 player
:punch(self
.object
, 1.0, {
146 full_punch_interval
= 0.5,
147 damage_groups
= {fleshy
= 8},
152 -- node hit, bursts into flame
153 hit_node
= function(self
, pos
, node
)
154 -- FIXME: Deprecated, switch to mobs:boom instead
155 mobs
:explosion(pos
, 3, 0, 1)
159 mobs
:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0)
162 mobs
:alias_mob("nssm:mese_dragon", "mobs_mc:wither")