changed API to recognise sitting order, added animations for sitting and idle, dog will no longer walk around while in sit mode
parent
c60002b18d
commit
3852c0297f
|
@ -248,7 +248,7 @@ local set_velocity = function(self, v)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- halt mob if it has been ordered to stay
|
-- halt mob if it has been ordered to stay
|
||||||
if self.order == "stand" then
|
if self.order == "stand" or self.order == "sit" then
|
||||||
self.object:set_velocity({x = 0, y = 0, z = 0})
|
self.object:set_velocity({x = 0, y = 0, z = 0})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -2392,9 +2392,13 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
yaw = set_yaw(self, yaw, 8)
|
yaw = set_yaw(self, yaw, 8)
|
||||||
end
|
end
|
||||||
|
if self.order == "sit" then
|
||||||
set_velocity(self, 0)
|
set_animation(self, "sit")
|
||||||
set_animation(self, "stand")
|
set_velocity(self, 0)
|
||||||
|
else
|
||||||
|
set_animation(self, "stand")
|
||||||
|
set_velocity(self, 0)
|
||||||
|
end
|
||||||
|
|
||||||
-- npc's ordered to stand stay standing
|
-- npc's ordered to stand stay standing
|
||||||
if self.type ~= "npc"
|
if self.type ~= "npc"
|
||||||
|
|
Binary file not shown.
|
@ -66,6 +66,9 @@ local wolf = {
|
||||||
ent = dog:get_luaentity()
|
ent = dog:get_luaentity()
|
||||||
ent.owner = clicker:get_player_name()
|
ent.owner = clicker:get_player_name()
|
||||||
ent.tamed = true
|
ent.tamed = true
|
||||||
|
mcl_mobs:set_animation(ent, "sit")
|
||||||
|
ent.walk_chance = 0
|
||||||
|
ent.jump = false
|
||||||
-- cornfirm taming
|
-- cornfirm taming
|
||||||
minetest.sound_play("mobs_mc_wolf_bark", {object=dog, max_hear_distance=16}, true)
|
minetest.sound_play("mobs_mc_wolf_bark", {object=dog, max_hear_distance=16}, true)
|
||||||
-- Replace wolf
|
-- Replace wolf
|
||||||
|
@ -75,9 +78,10 @@ local wolf = {
|
||||||
end,
|
end,
|
||||||
animation = {
|
animation = {
|
||||||
speed_normal = 50, speed_run = 100,
|
speed_normal = 50, speed_run = 100,
|
||||||
stand_start = 40, stand_end = 45,
|
stand_start = 0, stand_end = 40,
|
||||||
walk_start = 0, walk_end = 40,
|
walk_start = 40, walk_end = 80,
|
||||||
run_start = 0, run_end = 40,
|
run_start = 80, run_end = 120,
|
||||||
|
sit_start = 121, sit_end = 140,
|
||||||
},
|
},
|
||||||
jump = true,
|
jump = true,
|
||||||
attacks_monsters = true,
|
attacks_monsters = true,
|
||||||
|
@ -128,7 +132,8 @@ dog.hp_max = 20
|
||||||
dog.textures = get_dog_textures("unicolor_red")
|
dog.textures = get_dog_textures("unicolor_red")
|
||||||
dog.owner = ""
|
dog.owner = ""
|
||||||
-- TODO: Start sitting by default
|
-- TODO: Start sitting by default
|
||||||
dog.order = "roam"
|
dog.order = "sit"
|
||||||
|
dog.state = "stand"
|
||||||
dog.owner_loyal = true
|
dog.owner_loyal = true
|
||||||
dog.follow_velocity = 3.2
|
dog.follow_velocity = 3.2
|
||||||
-- Automatically teleport dog to owner
|
-- Automatically teleport dog to owner
|
||||||
|
@ -190,14 +195,18 @@ dog.on_rightclick = function(self, clicker)
|
||||||
if not self.order or self.order == "" or self.order == "sit" then
|
if not self.order or self.order == "" or self.order == "sit" then
|
||||||
particle = "mobs_mc_wolf_icon_roam.png"
|
particle = "mobs_mc_wolf_icon_roam.png"
|
||||||
self.order = "roam"
|
self.order = "roam"
|
||||||
|
self.state = "stand"
|
||||||
self.walk_chance = default_walk_chance
|
self.walk_chance = default_walk_chance
|
||||||
self.jump = true
|
self.jump = true
|
||||||
|
mcl_mobs:set_animation(self, "stand")
|
||||||
-- TODO: Add sitting model
|
-- TODO: Add sitting model
|
||||||
else
|
else
|
||||||
particle = "mobs_mc_wolf_icon_sit.png"
|
particle = "mobs_mc_wolf_icon_sit.png"
|
||||||
self.order = "sit"
|
self.order = "sit"
|
||||||
|
self.state = "stand"
|
||||||
self.walk_chance = 0
|
self.walk_chance = 0
|
||||||
self.jump = false
|
self.jump = false
|
||||||
|
mcl_mobs:set_animation(self, "sit")
|
||||||
end
|
end
|
||||||
-- Display icon to show current order (sit or roam)
|
-- Display icon to show current order (sit or roam)
|
||||||
minetest.add_particle({
|
minetest.add_particle({
|
||||||
|
|
Loading…
Reference in New Issue