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:
MysticTempest 2020-12-22 08:29:24 -06:00
parent b0dc0ecc9c
commit b56ae38939
2 changed files with 18 additions and 5 deletions

View file

@ -632,12 +632,15 @@ minetest.register_entity(":__builtin:item", {
local fg = minetest.get_item_group(nn, "fire")
local dg = minetest.get_item_group(nn, "destroys_items")
if (def and (lg ~= 0 or fg ~= 0 or dg == 1)) then
if dg ~= 2 then
minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5}, true)
--Wait 2 seconds to allow mob drops to be cooked, & picked up instead of instantly destroyed.
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
self._removed = true
self.object:remove()
return
end
-- Push item out when stuck inside solid opaque node

View file

@ -2059,6 +2059,7 @@ local follow_flop = function(self)
or self.order == "follow")
and not self.following
and self.state ~= "attack"
and self.order ~= "sit"
and self.state ~= "runaway" then
local s = self.object:get_pos()
@ -2079,6 +2080,7 @@ local follow_flop = function(self)
if self.type == "npc"
and self.order == "follow"
and self.state ~= "attack"
and self.order ~= "sit"
and self.owner ~= "" then
-- npc stop following player if not owner
@ -2364,6 +2366,8 @@ local do_states = function(self, dtime)
set_velocity(self, 0)
self.state = "stand"
set_animation(self, "stand")
local yaw = self.object:get_yaw() or 0
yaw = set_yaw(self, yaw + 0.78, 8)
else
set_velocity(self, self.walk_velocity)
@ -2390,6 +2394,8 @@ local do_states = function(self, dtime)
set_velocity(self, 0)
self.state = "stand"
set_animation(self, "stand")
local yaw = self.object:get_yaw() or 0
yaw = set_yaw(self, yaw + 0.78, 8)
else
set_velocity(self, self.run_velocity)
set_animation(self, "run")
@ -2622,6 +2628,8 @@ local do_states = function(self, dtime)
set_velocity(self, 0)
set_animation(self, "stand")
local yaw = self.object:get_yaw() or 0
yaw = set_yaw(self, yaw + 0.78, 8)
else
if self.path.stuck then
@ -3516,6 +3524,8 @@ local mob_step = function(self, dtime)
set_velocity(self, 0)
self.state = "stand"
set_animation(self, "stand")
local yaw = self.object:get_yaw() or 0
yaw = set_yaw(self, yaw + 0.78, 8)
end
-- Despawning: when lifetimer expires, remove mob