mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-30 13:17:29 +01:00
91 lines
2.0 KiB
Lua
91 lines
2.0 KiB
Lua
--MCmobs v0.4
|
|
--maikerumine
|
|
--made for MC like Survival game
|
|
--License for code WTFPL and otherwise stated in readmes
|
|
|
|
local S = minetest.get_translator("mobs_mc")
|
|
|
|
--###################
|
|
--################### EVOKER
|
|
--###################
|
|
|
|
local pr = PseudoRandom(os.time()*666)
|
|
|
|
mobs:register_mob("mobs_mc:evoker", {
|
|
type = "monster",
|
|
physical = true,
|
|
pathfinding = 1,
|
|
hp_min = 24,
|
|
hp_max = 24,
|
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.95, 0.4},
|
|
visual = "mesh",
|
|
mesh = "mobs_mc_villager.b3d",
|
|
textures = { {
|
|
"mobs_mc_evoker.png",
|
|
"blank.png", --no hat
|
|
-- TODO: Attack glow
|
|
} },
|
|
visual_size = {x=3, y=3},
|
|
makes_footstep_sound = true,
|
|
damage = 6,
|
|
walk_velocity = 0.2,
|
|
run_velocity = 1.4,
|
|
group_attack = true,
|
|
attack_type = "dogfight",
|
|
-- Summon vexes
|
|
custom_attack = function(self, to_attack)
|
|
local r = pr:next(2,4)
|
|
local basepos = self.object:get_pos()
|
|
basepos.y = basepos.y + 1
|
|
for i=1, r do
|
|
local spawnpos = vector.add(basepos, minetest.yaw_to_dir(pr:next(0,360)))
|
|
local vex = minetest.add_entity(spawnpos, "mobs_mc:vex")
|
|
local ent = vex:get_luaentity()
|
|
-- Mark vexes as summoned and start their life clock (they take damage it reaches 0)
|
|
ent._summoned = true
|
|
ent._lifetimer = pr:next(33, 108)
|
|
end
|
|
end,
|
|
shoot_interval = 15,
|
|
passive = false,
|
|
drops = {
|
|
{name = mobs_mc.items.emerald,
|
|
chance = 1,
|
|
min = 0,
|
|
max = 1,},
|
|
{name = mobs_mc.items.totem,
|
|
chance = 1,
|
|
min = 1,
|
|
max = 1,},
|
|
},
|
|
-- TODO: sounds
|
|
animation = {
|
|
stand_speed = 25,
|
|
stand_start = 40,
|
|
stand_end = 59,
|
|
walk_speed = 25,
|
|
walk_start = 0,
|
|
walk_end = 40,
|
|
run_speed = 25,
|
|
shoot_start = 120, --magic arm swinging
|
|
shoot_end = 140,
|
|
die_speed = 15,
|
|
die_start = 190,
|
|
die_end = 200,
|
|
die_loop = false,
|
|
},
|
|
water_damage = 0,
|
|
lava_damage = 4,
|
|
light_damage = 0,
|
|
view_range = 16,
|
|
fear_height = 4,
|
|
})
|
|
|
|
-- spawn eggs
|
|
mobs:register_egg("mobs_mc:evoker", S("Evoker"), "mobs_mc_spawn_icon_evoker.png", 0)
|
|
|
|
|
|
if minetest.settings:get_bool("log_mods") then
|
|
minetest.log("action", "MC Evoker loaded")
|
|
end
|