Skip to content

Commit

Permalink
PvP: Projectile: same y position for player & player. Relates to #1972
Browse files Browse the repository at this point in the history
  • Loading branch information
alek13 committed Jan 25, 2025
1 parent 2a64d95 commit e8522a3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mods/_various/mobs/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1723,10 +1723,16 @@ local do_states = function(self, dtime)
mob_sound(self, self.sounds.shoot_attack)

local arrow = ItemStack(self.arrow)
local shoot_dir = vector.normalize(vector.add(vector.subtract(p, s), vector.new(0, 2.5, 0)))
local v = vector.new
s = v(self.object:get_pos())
p = v(self.attack:get_pos())
if self.attack:is_player() then
p = p + v(0, .5, 0) -- на данный момент игрок находится на пол блока ниже моба
end
local shoot_dir = (p - s + v(0, 2, 0)):normalize()

minetest.sound_play(arrow:get_definition()["_sound_on_release"], { object = self.object })
local aim_variety = random(-2, 2) * 0.1
local aim_variety = random(-.1, .1)
archery.projectile_shoot(self.object, arrow, 0.6 + aim_variety, shoot_dir)
end
end
Expand Down

0 comments on commit e8522a3

Please sign in to comment.