mobs_mc/villager_evoker.lua

98 lines
2.2 KiB
Lua
Raw Normal View History

2017-05-26 19:18:05 -04:00
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
2017-07-02 15:31:26 +02:00
-- intllib
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--dofile(minetest.get_modpath("mobs").."/api.lua")
--###################
--################### EVOKER
--###################
2017-06-22 23:07:48 +02:00
local pr = PseudoRandom(os.time()*666)
2017-05-26 19:18:05 -04:00
mobs:register_mob("mobs_mc:evoker", {
type = "monster",
2017-06-22 22:56:39 +02:00
physical = true,
2017-05-26 19:18:05 -04:00
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_evoker.b3d",
textures = {
{"mobs_mc_evoker_base.png"},
-- TODO: Attack glow
},
2017-05-26 19:18:05 -04:00
visual_size = {x=3, y=3},
makes_footstep_sound = true,
damage = 6,
2017-05-26 19:18:05 -04:00
walk_velocity = 0.2,
run_velocity = 1.4,
group_attack = true,
2017-06-22 22:56:39 +02:00
attack_type = "dogfight",
-- Summon vexes
custom_attack = function(self, to_attack)
2017-06-22 23:07:48 +02:00
local r = pr:next(2,4)
2017-06-22 22:56:39 +02:00
local basepos = self.object:getpos()
basepos.y = basepos.y + 1
for i=1, r do
2017-06-22 23:07:48 +02:00
local spawnpos = vector.add(basepos, minetest.yaw_to_dir(pr:next(0,360)))
2017-06-22 22:56:39 +02:00
local vex = minetest.add_entity(spawnpos, "mobs_mc:vex")
2017-06-22 23:07:48 +02:00
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)
2017-06-22 22:56:39 +02:00
end
end,
2017-06-22 23:07:48 +02:00
shoot_interval = 15,
2017-05-26 19:18:05 -04:00
passive = false,
drops = {
{name = mobs_mc.items.emerald,
2017-05-28 23:16:44 -04:00
chance = 1,
min = 0,
2017-05-28 23:16:44 -04:00
max = 1,},
{name = mobs_mc.items.totem,
2017-05-28 23:16:44 -04:00
chance = 1,
min = 1,
max = 1,},
},
sounds = {
2017-05-26 19:18:05 -04:00
random = "Villagerdead",
death = "Villagerdead",
2017-05-26 19:18:05 -04:00
damage = "mese_dragon",
attack = "zombiedeath",
distance = 16,
},
animation = {
2017-07-26 00:15:42 +02:00
walk_speed = 25,
run_speed = 25,
stand_start = 40,
stand_end = 59,
2017-07-26 00:15:42 +02:00
stand_speed = 5,
walk_start = 0,
walk_end = 40,
shoot_start = 60,
shoot_end = 80,
die_start = 80,
die_end = 130,
2017-07-26 00:15:42 +02:00
die_loop = false,
},
water_damage = 0,
lava_damage = 4,
light_damage = 0,
view_range = 16,
fear_height = 4,
2017-05-26 19:18:05 -04:00
})
-- spawn eggs
2017-07-02 15:31:26 +02:00
mobs:register_egg("mobs_mc:evoker", S("Evoker"), "mobs_mc_spawn_icon_evoker.png", 0)
2017-06-21 00:20:06 -04:00
if minetest.settings:get_bool("log_mods") then
2017-05-26 19:18:05 -04:00
minetest.log("action", "MC Evoker loaded")
end