Make lava/fire wait 2 seconds before destroying items to allow chance for pickup, fix dogs following when sitting, and add some rotation so mobs don't idle at cliffs.
This commit is contained in:
parent
b0dc0ecc9c
commit
b56ae38939
|
@ -632,12 +632,15 @@ minetest.register_entity(":__builtin:item", {
|
||||||
local fg = minetest.get_item_group(nn, "fire")
|
local fg = minetest.get_item_group(nn, "fire")
|
||||||
local dg = minetest.get_item_group(nn, "destroys_items")
|
local dg = minetest.get_item_group(nn, "destroys_items")
|
||||||
if (def and (lg ~= 0 or fg ~= 0 or dg == 1)) then
|
if (def and (lg ~= 0 or fg ~= 0 or dg == 1)) then
|
||||||
if dg ~= 2 then
|
--Wait 2 seconds to allow mob drops to be cooked, & picked up instead of instantly destroyed.
|
||||||
minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5}, true)
|
if self.age > 2 then
|
||||||
|
if dg ~= 2 then
|
||||||
|
minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5})
|
||||||
|
end
|
||||||
|
self._removed = true
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
end
|
end
|
||||||
self._removed = true
|
|
||||||
self.object:remove()
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Push item out when stuck inside solid opaque node
|
-- Push item out when stuck inside solid opaque node
|
||||||
|
|
|
@ -2059,6 +2059,7 @@ local follow_flop = function(self)
|
||||||
or self.order == "follow")
|
or self.order == "follow")
|
||||||
and not self.following
|
and not self.following
|
||||||
and self.state ~= "attack"
|
and self.state ~= "attack"
|
||||||
|
and self.order ~= "sit"
|
||||||
and self.state ~= "runaway" then
|
and self.state ~= "runaway" then
|
||||||
|
|
||||||
local s = self.object:get_pos()
|
local s = self.object:get_pos()
|
||||||
|
@ -2079,6 +2080,7 @@ local follow_flop = function(self)
|
||||||
if self.type == "npc"
|
if self.type == "npc"
|
||||||
and self.order == "follow"
|
and self.order == "follow"
|
||||||
and self.state ~= "attack"
|
and self.state ~= "attack"
|
||||||
|
and self.order ~= "sit"
|
||||||
and self.owner ~= "" then
|
and self.owner ~= "" then
|
||||||
|
|
||||||
-- npc stop following player if not owner
|
-- npc stop following player if not owner
|
||||||
|
@ -2364,6 +2366,8 @@ local do_states = function(self, dtime)
|
||||||
set_velocity(self, 0)
|
set_velocity(self, 0)
|
||||||
self.state = "stand"
|
self.state = "stand"
|
||||||
set_animation(self, "stand")
|
set_animation(self, "stand")
|
||||||
|
local yaw = self.object:get_yaw() or 0
|
||||||
|
yaw = set_yaw(self, yaw + 0.78, 8)
|
||||||
else
|
else
|
||||||
|
|
||||||
set_velocity(self, self.walk_velocity)
|
set_velocity(self, self.walk_velocity)
|
||||||
|
@ -2390,6 +2394,8 @@ local do_states = function(self, dtime)
|
||||||
set_velocity(self, 0)
|
set_velocity(self, 0)
|
||||||
self.state = "stand"
|
self.state = "stand"
|
||||||
set_animation(self, "stand")
|
set_animation(self, "stand")
|
||||||
|
local yaw = self.object:get_yaw() or 0
|
||||||
|
yaw = set_yaw(self, yaw + 0.78, 8)
|
||||||
else
|
else
|
||||||
set_velocity(self, self.run_velocity)
|
set_velocity(self, self.run_velocity)
|
||||||
set_animation(self, "run")
|
set_animation(self, "run")
|
||||||
|
@ -2622,6 +2628,8 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
set_velocity(self, 0)
|
set_velocity(self, 0)
|
||||||
set_animation(self, "stand")
|
set_animation(self, "stand")
|
||||||
|
local yaw = self.object:get_yaw() or 0
|
||||||
|
yaw = set_yaw(self, yaw + 0.78, 8)
|
||||||
else
|
else
|
||||||
|
|
||||||
if self.path.stuck then
|
if self.path.stuck then
|
||||||
|
@ -3516,6 +3524,8 @@ local mob_step = function(self, dtime)
|
||||||
set_velocity(self, 0)
|
set_velocity(self, 0)
|
||||||
self.state = "stand"
|
self.state = "stand"
|
||||||
set_animation(self, "stand")
|
set_animation(self, "stand")
|
||||||
|
local yaw = self.object:get_yaw() or 0
|
||||||
|
yaw = set_yaw(self, yaw + 0.78, 8)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Despawning: when lifetimer expires, remove mob
|
-- Despawning: when lifetimer expires, remove mob
|
||||||
|
|
Loading…
Reference in New Issue