diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index 3356dca05..a981a049a 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -82,6 +82,7 @@ functions needed for the mob to work properly which contains the following: 'reach' is how far the mob can attack player when standing nearby, default is 3 nodes. + 'shoot_reach' is how far the mob can shoot, default is 16 nodes. 'docile_by_day' when true has mobs wandering around during daylight hours and only attacking player at night or when provoked. diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index 3b28c1a37..87a6b4228 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -1154,9 +1154,9 @@ function mob_class:do_states_attack (dtime) end end - elseif self.attack_type == "shoot" + elseif dist <= self.shoot_reach and (self.attack_type == "shoot" or (self.attack_type == "dogshoot" and self:dogswitch(dtime) == 1) - 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 p.y = p.y - .5 s.y = s.y + .5 diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index c981e6a86..c921ecacc 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -229,6 +229,7 @@ function mcl_mobs.register_mob(name, def) health = 0, frame_speed_multiplier = 1, reach = def.reach or 3, + shoot_reach = def.shoot_reach or def.view_range or 16, htimer = 0, texture_list = def.textures, child_texture = def.child_texture,