Stop minimum draw arrows from hitting player that shot them

This commit is contained in:
teknomunk 2024-09-09 06:47:45 -05:00
parent d5c3d83fbf
commit caae0a5964
2 changed files with 35 additions and 34 deletions

View File

@ -297,7 +297,7 @@ local arrow_entity = {
end
local pos = self.object:get_pos()
if not self._start_pos or pos and vector.distance(self._start_pos, pos) > 1 then
if not self._startpos or pos and vector.distance(self._startpos, pos) > 1.5 then
self._allow_punch = true
end

View File

@ -233,25 +233,27 @@ function mod.collides_with_solids(self, dtime, entity_def, projectile_def)
end
local function handle_entity_collision(self, entity_def, projectile_def, object)
if DEBUG then
minetest.log("handle_enity_collision("..dump({
self = self,
entity_def = entity_def,
object = object,
luaentity = object:get_luaentity(),
})..")")
end
local pos = self.object:get_pos()
local dir = vector.normalize(self.object:get_velocity())
local self_vl_projectile = self._vl_projectile
-- Allow punching
-- Check if this is allowed
local allow_punching = projectile_def.allow_punching or true
if type(allow_punching) == "function" then
allow_punching = allow_punching(self, entity_def, projectile_def, object)
end
if allow_punching then
if DEBUG then
minetest.log("handle_enity_collision("..dump({
self = self,
allow_punching = allow_punching,
entity_def = entity_def,
object = object,
luaentity = object:get_luaentity(),
})..")")
end
if not allow_punching then return end
-- Get damage
local dmg = projectile_def.damage_groups or 0
if type(dmg) == "function" then
@ -282,7 +284,6 @@ local function handle_entity_collision(self, entity_def, projectile_def, object)
mcl_burning.set_on_fire(obj, 5)
end
end
end
-- Call entity collision hook
local hook = projectile_def.on_collide_with_entity