mobs_more_monsters/mobs_yeti/init.lua

99 lines
2.6 KiB
Lua

-- Yeti by TenPlus1
if mobs.mod and mobs.mod == "redo" then
-- yeti
mobs:register_mob("mobs_yeti:yeti", {
type = "monster",
visual = "mesh",
mesh = "character.b3d",
textures = {
{"mobs_yeti.png"},
},
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219
},
makes_footstep_sound = true,
sounds = {
random = "mobs_stonemonster",
},
hp_min = 60,
hp_max = 85,
armor = 100,
knock_back = 1,
lava_damage = 15,
fall_damage = 15,
damage = 8,
reach = 2,
attack_type = "dogshoot",
arrow = "mobs_yeti:snowball",
shoot_interval = .7,
shoot_offset = 2,
view_range = 15,
run_velocity = 4,
stepheight = 1.1,
floats = 0,
drops = {
{name = "default:ice", chance = 1, min = 1, max = 3},
{name = "ethereal:bone", chance = 2, min = 2, max = 4}
},
replace_rate = 50,
replace_what = {"air"},
replace_with = "default:snow",
replace_offset = -1
})
local l_spawn_elevation_min = minetest.setting_get("water_level")+1 or 1
--name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height
mobs:spawn_specific("mobs_yeti:yeti",
{"default:dirt_with_snow", "default:snow", "default:snowblock", "default:ice"},
{"air"},
-1, 25, 30, 20000, 1, 420, 4200
)
mobs:register_egg("mobs_yeti:yeti", "Yeti", "default_snow.png", 1)
mobs:register_arrow("mobs_yeti:snowball", {
visual = "sprite",
visual_size = {x=.5, y=.5},
textures = {"default_snowball.png"},
velocity = 6,
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1},
}, 0)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1},
}, 0)
end,
hit_node = function(self, pos, node)
end
})
-- snowball throwing item
local snowball_GRAVITY=9
local snowball_VELOCITY=19
-- shoot snowball
local mobs_shoot_snowball=function (item, player, pointed_thing)
local playerpos=player:getpos()
local obj=minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "mobs_yeti:snowball")
local dir=player:get_look_dir()
obj:get_luaentity().velocity = snowball_VELOCITY -- needed for api internal timing
obj:setvelocity({x=dir.x*snowball_VELOCITY, y=dir.y*snowball_VELOCITY, z=dir.z*snowball_VELOCITY})
obj:setacceleration({x=dir.x*-3, y=-snowball_GRAVITY, z=dir.z*-3})
item:take_item()
return item
end
end