mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 20:03:45 +01:00
Reduce excessive mob overhead
This commit is contained in:
parent
818052dc6c
commit
72c3f87925
@ -407,8 +407,11 @@ local function on_step_work (self, dtime)
|
|||||||
self:check_water_flow()
|
self:check_water_flow()
|
||||||
self:env_danger_movement_checks (dtime)
|
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
|
||||||
self:check_follow()
|
if mcl_util.check_dtime_timer(self, dtime, "onstep_follow", 0.2) then
|
||||||
|
self:check_follow()
|
||||||
|
end
|
||||||
|
end
|
||||||
self:flop()
|
self:flop()
|
||||||
|
|
||||||
self:check_smooth_rotation(dtime)
|
self:check_smooth_rotation(dtime)
|
||||||
|
@ -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 ""
|
self._current_animation = self._current_animation or ""
|
||||||
|
|
||||||
@ -324,12 +324,12 @@ local function who_are_you_looking_at (self)
|
|||||||
self._locked_object = nil
|
self._locked_object = nil
|
||||||
end
|
end
|
||||||
elseif not self._locked_object then
|
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)
|
--minetest.log("Change look check: ".. self.name)
|
||||||
|
|
||||||
-- For the wither this was 20/60=0.33, so probably need to rebalance and divide rates.
|
-- 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
|
-- 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
|
if chance < 1 then chance = 1 end
|
||||||
local look_at_player_chance = math.random(chance)
|
local look_at_player_chance = math.random(chance)
|
||||||
|
@ -623,7 +623,7 @@ function mob_class:check_runaway_from()
|
|||||||
end
|
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()
|
function mob_class:check_follow()
|
||||||
-- find player to follow
|
-- find player to follow
|
||||||
if (self.follow ~= "" or self.order == "follow") and not self.following
|
if (self.follow ~= "" or self.order == "follow") and not self.following
|
||||||
|
Loading…
Reference in New Issue
Block a user