Merge branch 'fixes' into itemframe

This commit is contained in:
Elias Fleckenstein 2021-01-04 17:58:54 +01:00
commit 0a482cc0cf
2 changed files with 32 additions and 29 deletions

View file

@ -3586,35 +3586,20 @@ local mob_step = function(self, dtime)
and ((not self.nametag) or (self.nametag == "")) then and ((not self.nametag) or (self.nametag == "")) then
self.lifetimer = self.lifetimer - dtime self.lifetimer = self.lifetimer - dtime
if self.lifetimer <= 10 then local despawn = self.despawn_immediately
if not despawn and self.lifetimer <= 10 then
-- only despawn away from player if math.random(10) < 4 then
local far_objs = minetest.get_objects_inside_radius(pos, 48) despawn = true
for n = 1, #far_objs do
if far_objs[n]:is_player() then
local close_objs = minetest.get_objects_inside_radius(pos, 16)
for n = 1, #close_objs do
if close_objs[n]:is_player() then
self.lifetimer = 20
return
end
end
if math.random(1, 10) <= 3 then
minetest.log("action", "Mob "..self.name.." despawns in mob_step at "..minetest.pos_to_string(pos))
mcl_burning.extinguish(self.object)
self.object:remove()
return
end
else else
self.lifetimer = 20
end
end
if despawn then
minetest.log("action", "Mob "..self.name.." despawns in mob_step at "..minetest.pos_to_string(pos)) minetest.log("action", "Mob "..self.name.." despawns in mob_step at "..minetest.pos_to_string(pos))
mcl_burning.extinguish(self.object) mcl_burning.extinguish(self.object)
self.object:remove() self.object:remove()
return
end
end
end end
self.despawn_immediately = true
end end
end end
@ -4556,3 +4541,21 @@ function mobs:alias_mob(old_name, new_name)
}) })
end end
minetest.register_globalstep(function()
for _, player in ipairs(minetest.get_connected_players()) do
local pos = player:get_pos()
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 24)) do
local lua = obj:get_luaentity()
if lua and lua._cmi_is_mob then
lua.lifetimer = 20
end
end
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 32)) do
local lua = obj:get_luaentity()
if lua and lua._cmi_is_mob then
lua.despawn_immediately = false
end
end
end
end)

View file

@ -195,7 +195,7 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
if wielditem then if wielditem then
local fire_aspect_level = mcl_enchanting.get_enchantment(wielditem, "fire_aspect") local fire_aspect_level = mcl_enchanting.get_enchantment(wielditem, "fire_aspect")
if fire_aspect_level > 0 then if fire_aspect_level > 0 then
mcl_burning.set_on_fire(player, 4, fire_aspect_level * 2, hitter:get_player_name()) mcl_burning.set_on_fire(player, 4, fire_aspect_level * 4 - 1, hitter:get_player_name())
end end
end end
end end