mob attack tweaks

This commit is contained in:
kno10 2024-11-10 01:40:30 +01:00
parent 6510ea4777
commit f14ff83737
2 changed files with 7 additions and 6 deletions

View File

@ -928,7 +928,7 @@ function mob_class:do_states_attack(dtime)
p = vector_copy(p1) p = vector_copy(p1)
end end
self:turn_in_direction(p.x - s.x, p.z - s.z, 1) self:turn_in_direction(p.x - s.x, p.z - s.z, 10)
-- move towards enemy if beyond mob reach -- move towards enemy if beyond mob reach
if dist > self.reach then if dist > self.reach then
@ -940,7 +940,7 @@ function mob_class:do_states_attack(dtime)
if self:is_at_cliff_or_danger() then if self:is_at_cliff_or_danger() then
self:set_velocity(0) self:set_velocity(0)
self:set_animation("stand") self:set_animation("stand")
self:turn_by(PI * (random() - 0.5), 10) --self:turn_by(PI * (random() - 0.5), 10)
else else
if self.path.stuck then if self.path.stuck then
self:set_velocity(self.walk_velocity) self:set_velocity(self.walk_velocity)
@ -1000,7 +1000,7 @@ function mob_class:do_states_attack(dtime)
or (self.attack_type == "dogshoot" and (dist > self.reach or dist < self.avoid_distance and self.shooter_avoid_enemy) and self:dogswitch() == 0) then or (self.attack_type == "dogshoot" and (dist > self.reach or dist < self.avoid_distance and self.shooter_avoid_enemy) and self:dogswitch() == 0) then
local vec = vector_new(p.x - s.x, p.y - s.y - 1, p.z - s.z) local vec = vector_new(p.x - s.x, p.y - s.y - 1, p.z - s.z)
local dist = (vec.x*vec.x + vec.y*vec.y + vec.z*vec.z)^0.5 local dist = (vec.x*vec.x + vec.y*vec.y + vec.z*vec.z)^0.5
self:turn_in_direction(vec.x, vec.z, 1) self:turn_in_direction(vec.x, vec.z, 10)
if self.strafes then if self.strafes then
if not self.strafe_direction then self.strafe_direction = HALFPI end if not self.strafe_direction then self.strafe_direction = HALFPI end
@ -1015,6 +1015,7 @@ function mob_class:do_states_attack(dtime)
end end
else else
self:set_velocity(0) self:set_velocity(0)
self:set_animation("stand")
end end
local p = self.object:get_pos() local p = self.object:get_pos()

View File

@ -43,10 +43,10 @@ pillager = {
arrow = "mcl_bows:arrow_entity", arrow = "mcl_bows:arrow_entity",
attack_type = "dogshoot", -- Alternate punching/shooting attack_type = "dogshoot", -- Alternate punching/shooting
attack_npcs = true, attack_npcs = true,
reach = 0, -- Punching max distance reach = 2, -- Punching max distance
damage = 0, -- Punching damage damage = 2, -- Punching damage
dogshoot_switch = 1, -- Start of shooting dogshoot_switch = 1, -- Start of shooting
dogshoot_count_max = 5, -- Max time spent shooting (standing) dogshoot_count_max = 4, -- Max time spent shooting (standing)
dogshoot_count2_max = 1, -- Max time spent punching (running) dogshoot_count2_max = 1, -- Max time spent punching (running)
sounds = { sounds = {
random = "mobs_mc_pillager_grunt2", random = "mobs_mc_pillager_grunt2",