forked from VoxeLibre/VoxeLibre
add mob_class:shoot_reach
This commit is contained in:
parent
65cc03bc8f
commit
7b39170839
|
@ -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
|
'reach' is how far the mob can attack player when standing
|
||||||
nearby, default is 3 nodes.
|
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
|
'docile_by_day' when true has mobs wandering around during daylight
|
||||||
hours and only attacking player at night or when
|
hours and only attacking player at night or when
|
||||||
provoked.
|
provoked.
|
||||||
|
|
|
@ -1154,9 +1154,9 @@ function mob_class:do_states_attack (dtime)
|
||||||
end
|
end
|
||||||
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 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
|
p.y = p.y - .5
|
||||||
s.y = s.y + .5
|
s.y = s.y + .5
|
||||||
|
|
|
@ -229,6 +229,7 @@ function mcl_mobs.register_mob(name, def)
|
||||||
health = 0,
|
health = 0,
|
||||||
frame_speed_multiplier = 1,
|
frame_speed_multiplier = 1,
|
||||||
reach = def.reach or 3,
|
reach = def.reach or 3,
|
||||||
|
shoot_reach = def.shoot_reach or def.view_range or 16,
|
||||||
htimer = 0,
|
htimer = 0,
|
||||||
texture_list = def.textures,
|
texture_list = def.textures,
|
||||||
child_texture = def.child_texture,
|
child_texture = def.child_texture,
|
||||||
|
|
Loading…
Reference in New Issue