Merge pull request 'Fix mobs flopping for the first second when in thier own element' (#2889) from mob_fly_check_fix into master

Reviewed-on: MineClone2/MineClone2#2889
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-11-01 03:41:42 +00:00
commit 56cbe50a02
1 changed files with 8 additions and 3 deletions

View File

@ -531,7 +531,7 @@ local flight_check = function(self)
end
for _,checknode in pairs(fly_in) do
if nod == checknode then
if nod == checknode or nod == "ignore" then
return true
end
end
@ -2468,7 +2468,7 @@ local follow_flop = function(self)
-- swimmers flop when out of their element, and swim again when back in
if self.fly then
local s = self.object:get_pos()
if not flight_check(self, s) then
if flight_check(self, s) == false then
self.state = "flop"
self.object:set_acceleration({x = 0, y = DEFAULT_FALL_SPEED, z = 0})
@ -4096,7 +4096,12 @@ local mob_activate = function(self, staticdata, def, dtime)
self.on_spawn_run = true -- if true, set flag to run once only
end
end
if not self._run_armor_init then
if not self.wears_armor and self.armor_list then
self.armor_list = nil
end
if not self._run_armor_init and self.wears_armor then
self.armor_list={helmet="",chestplate="",boots="",leggings=""}
set_armor_texture(self)
self._run_armor_init = true