Add tree monster and fix sliding of standing mobs
This commit is contained in:
parent
1a40012cf1
commit
b5b378fb4b
15
api.lua
15
api.lua
@ -222,6 +222,7 @@ function mobs:register_mob(name, def)
|
|||||||
if math.random(1, 4) == 1 then
|
if math.random(1, 4) == 1 then
|
||||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
|
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
|
||||||
end
|
end
|
||||||
|
self.set_velocity(self, 0)
|
||||||
self.set_animation(self, "stand")
|
self.set_animation(self, "stand")
|
||||||
if math.random(1, 100) <= 50 then
|
if math.random(1, 100) <= 50 then
|
||||||
self.set_velocity(self, self.walk_velocity)
|
self.set_velocity(self, self.walk_velocity)
|
||||||
@ -231,19 +232,19 @@ function mobs:register_mob(name, def)
|
|||||||
elseif self.state == "walk" then
|
elseif self.state == "walk" then
|
||||||
if math.random(1, 100) <= 30 then
|
if math.random(1, 100) <= 30 then
|
||||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
|
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
|
||||||
self.set_velocity(self, self.get_velocity(self))
|
|
||||||
end
|
|
||||||
self:set_animation("walk")
|
|
||||||
if math.random(1, 100) <= 10 then
|
|
||||||
self.set_velocity(self, 0)
|
|
||||||
self.state = "stand"
|
|
||||||
self:set_animation("stand")
|
|
||||||
end
|
end
|
||||||
if self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
if self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
|
||||||
local v = self.object:getvelocity()
|
local v = self.object:getvelocity()
|
||||||
v.y = 5
|
v.y = 5
|
||||||
self.object:setvelocity(v)
|
self.object:setvelocity(v)
|
||||||
end
|
end
|
||||||
|
self:set_animation("walk")
|
||||||
|
self.set_velocity(self, self.walk_velocity)
|
||||||
|
if math.random(1, 100) <= 10 then
|
||||||
|
self.set_velocity(self, 0)
|
||||||
|
self.state = "stand"
|
||||||
|
self:set_animation("stand")
|
||||||
|
end
|
||||||
elseif self.state == "attack" and self.attack_type == "dogfight" then
|
elseif self.state == "attack" and self.attack_type == "dogfight" then
|
||||||
if not self.attack.player or not self.attack.player:is_player() then
|
if not self.attack.player or not self.attack.player:is_player() then
|
||||||
self.state = "stand"
|
self.state = "stand"
|
||||||
|
46
init.lua
46
init.lua
@ -69,7 +69,6 @@ mobs:register_mob("mobs:stone_monster", {
|
|||||||
})
|
})
|
||||||
mobs:register_spawn("mobs:stone_monster", {"default:stone"}, 3, -1, 7000, 3, 0)
|
mobs:register_spawn("mobs:stone_monster", {"default:stone"}, 3, -1, 7000, 3, 0)
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs:sand_monster", {
|
mobs:register_mob("mobs:sand_monster", {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
hp_max = 3,
|
hp_max = 3,
|
||||||
@ -111,6 +110,51 @@ mobs:register_mob("mobs:sand_monster", {
|
|||||||
})
|
})
|
||||||
mobs:register_spawn("mobs:sand_monster", {"default:desert_sand"}, 20, -1, 7000, 3, 31000)
|
mobs:register_spawn("mobs:sand_monster", {"default:desert_sand"}, 20, -1, 7000, 3, 31000)
|
||||||
|
|
||||||
|
mobs:register_mob("mobs:tree_monster", {
|
||||||
|
type = "monster",
|
||||||
|
hp_max = 5,
|
||||||
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "mobs_tree_monster.x",
|
||||||
|
textures = {"mobs_tree_monster.png"},
|
||||||
|
visual_size = {x=4.5,y=4.5},
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
view_range = 15,
|
||||||
|
walk_velocity = 1,
|
||||||
|
run_velocity = 3,
|
||||||
|
damage = 2,
|
||||||
|
drops = {
|
||||||
|
{name = "default:sapling",
|
||||||
|
chance = 3,
|
||||||
|
min = 1,
|
||||||
|
max = 2,},
|
||||||
|
{name = "default:junglesapling",
|
||||||
|
chance = 3,
|
||||||
|
min = 1,
|
||||||
|
max = 2,},
|
||||||
|
},
|
||||||
|
light_resistant = true,
|
||||||
|
armor = 100,
|
||||||
|
drawtype = "front",
|
||||||
|
water_damage = 1,
|
||||||
|
lava_damage = 5,
|
||||||
|
light_damage = 2,
|
||||||
|
attack_type = "dogfight",
|
||||||
|
animation = {
|
||||||
|
speed_normal = 15,
|
||||||
|
speed_run = 15,
|
||||||
|
stand_start = 0,
|
||||||
|
stand_end = 24,
|
||||||
|
walk_start = 25,
|
||||||
|
walk_end = 47,
|
||||||
|
run_start = 48,
|
||||||
|
run_end = 62,
|
||||||
|
punch_start = 48,
|
||||||
|
punch_end = 62,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
mobs:register_spawn("mobs:tree_monster", {"default:leaves", "default:jungleleaves"}, 3, -1, 7000, 3, 31000)
|
||||||
|
|
||||||
mobs:register_mob("mobs:sheep", {
|
mobs:register_mob("mobs:sheep", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
hp_max = 5,
|
hp_max = 5,
|
||||||
|
BIN
models/mobs_tree_monster.png
Executable file
BIN
models/mobs_tree_monster.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
4009
models/mobs_tree_monster.x
Executable file
4009
models/mobs_tree_monster.x
Executable file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user