forked from VoxeLibre/VoxeLibre
Stop minimum draw arrows from hitting player that shot them
This commit is contained in:
parent
52946b3a26
commit
ca63f1ce58
|
@ -297,7 +297,7 @@ local arrow_entity = {
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
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
|
self._allow_punch = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -233,25 +233,27 @@ function mod.collides_with_solids(self, dtime, entity_def, projectile_def)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function handle_entity_collision(self, entity_def, projectile_def, object)
|
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 pos = self.object:get_pos()
|
||||||
local dir = vector.normalize(self.object:get_velocity())
|
local dir = vector.normalize(self.object:get_velocity())
|
||||||
local self_vl_projectile = self._vl_projectile
|
local self_vl_projectile = self._vl_projectile
|
||||||
|
|
||||||
-- Allow punching
|
-- Check if this is allowed
|
||||||
local allow_punching = projectile_def.allow_punching or true
|
local allow_punching = projectile_def.allow_punching or true
|
||||||
if type(allow_punching) == "function" then
|
if type(allow_punching) == "function" then
|
||||||
allow_punching = allow_punching(self, entity_def, projectile_def, object)
|
allow_punching = allow_punching(self, entity_def, projectile_def, object)
|
||||||
end
|
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
|
-- Get damage
|
||||||
local dmg = projectile_def.damage_groups or 0
|
local dmg = projectile_def.damage_groups or 0
|
||||||
if type(dmg) == "function" then
|
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)
|
mcl_burning.set_on_fire(obj, 5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
-- Call entity collision hook
|
-- Call entity collision hook
|
||||||
local hook = projectile_def.on_collide_with_entity
|
local hook = projectile_def.on_collide_with_entity
|
||||||
|
|
Loading…
Reference in New Issue