Stop minimum draw arrows from hitting player that shot them
This commit is contained in:
parent
e12420b93e
commit
db00c709db
|
@ -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,54 +233,55 @@ 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
|
||||||
-- Get damage
|
minetest.log("handle_enity_collision("..dump({
|
||||||
local dmg = projectile_def.damage_groups or 0
|
self = self,
|
||||||
if type(dmg) == "function" then
|
allow_punching = allow_punching,
|
||||||
dmg = dmg(self, entity_def, projectile_def, object)
|
entity_def = entity_def,
|
||||||
end
|
object = object,
|
||||||
|
luaentity = object:get_luaentity(),
|
||||||
|
})..")")
|
||||||
|
end
|
||||||
|
|
||||||
local object_lua = object:get_luaentity()
|
if not allow_punching then return end
|
||||||
|
-- Get damage
|
||||||
|
local dmg = projectile_def.damage_groups or 0
|
||||||
|
if type(dmg) == "function" then
|
||||||
|
dmg = dmg(self, entity_def, projectile_def, object)
|
||||||
|
end
|
||||||
|
|
||||||
-- Apply damage
|
local object_lua = object:get_luaentity()
|
||||||
-- Note: Damage blocking for shields is handled in mcl_shields with an mcl_damage modifier
|
|
||||||
local do_damage = false
|
|
||||||
if object:is_player() and projectile_def.damages_players then
|
|
||||||
do_damage = true
|
|
||||||
|
|
||||||
handle_player_sticking(self, entity_def, projectile_def, object)
|
-- Apply damage
|
||||||
elseif object_lua and (object_lua.is_mob or object_lua._hittable_by_projectile) then
|
-- Note: Damage blocking for shields is handled in mcl_shields with an mcl_damage modifier
|
||||||
do_damage = true
|
local do_damage = false
|
||||||
end
|
if object:is_player() and projectile_def.damages_players then
|
||||||
|
do_damage = true
|
||||||
|
|
||||||
if do_damage then
|
handle_player_sticking(self, entity_def, projectile_def, object)
|
||||||
object:punch(self.object, 1.0, projectile_def.tool or { full_punch_interval = 1.0, damage_groups = dmg }, dir )
|
elseif object_lua and (object_lua.is_mob or object_lua._hittable_by_projectile) then
|
||||||
|
do_damage = true
|
||||||
|
end
|
||||||
|
|
||||||
-- Indicate damage
|
if do_damage then
|
||||||
damage_particles(vector.add(pos, vector.multiply(self.object:get_velocity(), 0.1)), self._is_critical)
|
object:punch(self.object, 1.0, projectile_def.tool or { full_punch_interval = 1.0, damage_groups = dmg }, dir )
|
||||||
|
|
||||||
-- Light things on fire
|
-- Indicate damage
|
||||||
if mcl_burning.is_burning(self.object) then
|
damage_particles(vector.add(pos, vector.multiply(self.object:get_velocity(), 0.1)), self._is_critical)
|
||||||
mcl_burning.set_on_fire(obj, 5)
|
|
||||||
end
|
-- Light things on fire
|
||||||
|
if mcl_burning.is_burning(self.object) then
|
||||||
|
mcl_burning.set_on_fire(obj, 5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue