81 lines
1.7 KiB
Lua
81 lines
1.7 KiB
Lua
|
|
local S = mobs.intllib
|
|
|
|
mobs:register_mob("supertuxstuff:snowballenemy", {
|
|
stepheight = 0.6,
|
|
type = "animal",
|
|
passive = false,
|
|
hp_min = 1,
|
|
hp_max = 1,
|
|
armor = 200,
|
|
collisionbox = {-0.2, -1, -0.2, 0.2, -0.8, 0.2},
|
|
visual = "mesh",
|
|
mesh = "snowball_model.obj",
|
|
textures = {
|
|
{"snowball_enemy_texture.png"},
|
|
},
|
|
makes_footstep_sound = false,
|
|
sounds = {
|
|
random = "mobs_snowballenemy",
|
|
},
|
|
walk_velocity = 1,
|
|
run_velocity = 1.5,
|
|
runaway = false,
|
|
jump = true,
|
|
water_damage = 1,
|
|
lava_damage = 1,
|
|
light_damage = 0,
|
|
fear_height = 2,
|
|
on_rightclick = function(self, clicker)
|
|
mobs:capture_mob(self, clicker, 50, 90, 0, true, "supertuxstuff:snowballenemy")
|
|
end,
|
|
--[[
|
|
do_custom = function(self, dtime)
|
|
|
|
self.snowballenemy_timer = (self.snowballenemy_timer or 0) + dtime
|
|
|
|
if self.snowballenemy_timer < 1 then return end -- every 1 second
|
|
|
|
self.snowballenemy_timer = 0
|
|
|
|
local pos = self.object:get_pos()
|
|
|
|
print("snowballenemy pos", pos.x, pos.y, pos.z, dtime)
|
|
|
|
return false -- return but skip doing rest of API
|
|
end,
|
|
]]
|
|
--[[
|
|
on_blast = function(obj, damage)
|
|
print ("--- damage is", damage)
|
|
print ("--- mob is", obj.object:get_luaentity().name)
|
|
-- return's do_damage, do_knockback and drops
|
|
return false, true, {"default:mese"}
|
|
end,
|
|
]]
|
|
})
|
|
|
|
|
|
local function snowballenemy_spawn(self, pos)
|
|
self = self:get_luaentity()
|
|
print (self.name, pos.x, pos.y, pos.z)
|
|
self.hp_max = 100
|
|
self.health = 100
|
|
end
|
|
|
|
if not mobs.custom_spawn_animal then
|
|
mobs:spawn({
|
|
name = "supertuxstuff:snowballenemy",
|
|
nodes = {"default:dirt_with_snow"},
|
|
min_light = 3,
|
|
max_light = 9,
|
|
interval = 60,
|
|
chance = 8000,
|
|
max_height = 0,
|
|
-- on_spawn = snowballenemy_spawn,
|
|
})
|
|
end
|
|
|
|
|
|
mobs:register_egg("supertuxstuff:snowballenemy", S("snowballenemy"), "mobs_snowballenemy_inv.png")
|