MineClone2/mods/ENTITIES/mobs_mc/villager_evoker.lua

93 lines
2.3 KiB
Lua
Raw Permalink Normal View History

2017-07-05 04:15:46 +03:00
--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")
2017-07-05 04:15:46 +03:00
--###################
--################### EVOKER
--###################
local pr = PseudoRandom(os.time()*666)
local spawned_vexes = {} --this is stored locally so the mobs engine doesn't try to store it in staticdata
mcl_mobs.register_mob("mobs_mc:evoker", {
2021-04-25 18:30:15 +03:00
description = S("Evoker"),
2017-07-05 04:15:46 +03:00
type = "monster",
2020-04-11 03:46:03 +03:00
spawn_class = "hostile",
can_despawn = false,
2017-07-05 04:15:46 +03:00
physical = true,
pathfinding = 1,
hp_min = 24,
hp_max = 24,
2020-12-06 16:46:42 +02:00
xp_min = 10,
xp_max = 10,
2022-10-07 04:56:38 +03:00
head_swivel = "head.control",
bone_eye_height = 6.3,
head_eye_height = 2.2,
curiosity = 10,
2017-07-05 04:15:46 +03:00
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.95, 0.4},
visual = "mesh",
2017-09-14 00:13:47 +03:00
mesh = "mobs_mc_villager.b3d",
textures = { {
2018-05-30 19:48:07 +03:00
"mobs_mc_evoker.png",
2017-09-14 00:13:47 +03:00
"blank.png", --no hat
2017-07-05 04:15:46 +03:00
-- TODO: Attack glow
2017-09-14 00:13:47 +03:00
} },
2017-07-05 04:15:46 +03:00
makes_footstep_sound = true,
damage = 6,
walk_velocity = 0.2,
run_velocity = 1.4,
group_attack = true,
attack_type = "dogfight",
2017-07-05 04:15:46 +03:00
-- Summon vexes
custom_attack = function(self, to_attack)
if not spawned_vexes[self] then spawned_vexes[self] = {} end
if #spawned_vexes[self] >= 7 then return end
for k,v in pairs(spawned_vexes[self]) do
if not v or v.health <= 0 then table.remove(spawned_vexes[self],k) end
end
local r = pr:next(1,4)
2019-02-01 07:33:07 +02:00
local basepos = self.object:get_pos()
2017-07-05 04:15:46 +03:00
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()
2017-07-05 04:15:46 +03:00
-- Mark vexes as summoned and start their life clock (they take damage it reaches 0)
ent._summoned = true
ent._lifetimer = pr:next(33, 108)
table.insert(spawned_vexes[self],ent)
2017-07-05 04:15:46 +03:00
end
end,
shoot_interval = 15,
passive = false,
drops = {
2022-05-26 00:25:15 +03:00
{name = "mcl_core:emerald",
2017-07-05 04:15:46 +03:00
chance = 1,
min = 0,
2020-12-23 18:41:42 +02:00
max = 1,
looting = "common",},
2022-05-26 00:25:15 +03:00
{name = "mcl_totems:totem",
2017-07-05 04:15:46 +03:00
chance = 1,
min = 1,
max = 1,},
},
-- TODO: sounds
2017-07-05 04:15:46 +03:00
animation = {
2022-09-29 22:40:01 +03:00
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 6,
run_start = 0, run_end = 40, run_speed = 24,
shoot_start = 142, shoot_end = 152, -- Magic arm swinging
2017-07-05 04:15:46 +03:00
},
view_range = 16,
fear_height = 4,
})
-- spawn eggs
mcl_mobs.register_egg("mobs_mc:evoker", S("Evoker"), "#959b9b", "#1e1c1a", 0)