1
0
Fork 0

Reduce excessive mob overhead

illager_banner_description
ancientmarinerdev 2023-05-12 15:33:49 +01:00
parent 818052dc6c
commit 72c3f87925
3 changed files with 9 additions and 6 deletions

View File

@ -407,8 +407,11 @@ local function on_step_work (self, dtime)
self:check_water_flow()
self:env_danger_movement_checks (dtime)
-- Follow code is heavy and probably shouldn't run when not in range, but we need to extract the cancel follow stuff
if player_in_active_range then
if mcl_util.check_dtime_timer(self, dtime, "onstep_follow", 0.2) then
self:check_follow()
end
end
self:flop()
self:check_smooth_rotation(dtime)

View File

@ -269,7 +269,7 @@ function mob_class:set_animation(anim, fixed_frame)
if self:flight_check() and self.fly and anim == "walk" then anim = "fly" end
if self.fly and self:flight_check() and anim == "walk" then anim = "fly" end
self._current_animation = self._current_animation or ""
@ -324,12 +324,12 @@ local function who_are_you_looking_at (self)
self._locked_object = nil
end
elseif not self._locked_object then
if math.random(1, 30) then
if mcl_util.check_dtime_timer(self, dtime, "step_look_for_someone", 0.2) then
--minetest.log("Change look check: ".. self.name)
-- For the wither this was 20/60=0.33, so probably need to rebalance and divide rates.
-- but frequency of check isn't good as it is costly. Making others too infrequent requires testing
local chance = 20/self.curiosity
local chance = 150/self.curiosity
if chance < 1 then chance = 1 end
local look_at_player_chance = math.random(chance)

View File

@ -623,7 +623,7 @@ function mob_class:check_runaway_from()
end
-- follow player if owner or holding item, if fish outta water then flop
-- follow player if owner or holding item
function mob_class:check_follow()
-- find player to follow
if (self.follow ~= "" or self.order == "follow") and not self.following