mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-09 16:49:35 +01:00
Change object alive check so that projectiles are still removed when the object dies
This commit is contained in:
parent
60e3c139cc
commit
5c1881753b
1 changed files with 4 additions and 2 deletions
|
@ -495,6 +495,8 @@ local function handle_entity_collision(self, entity_def, projectile_def, object)
|
||||||
do_damage = true
|
do_damage = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local object_alive = true
|
||||||
|
|
||||||
if do_damage then
|
if do_damage then
|
||||||
-- Get damage
|
-- Get damage
|
||||||
local dmg = projectile_def.damage_groups or 0
|
local dmg = projectile_def.damage_groups or 0
|
||||||
|
@ -508,13 +510,13 @@ local function handle_entity_collision(self, entity_def, projectile_def, object)
|
||||||
if self._removed or not self.object:get_pos() then return true end
|
if self._removed or not self.object:get_pos() then return true end
|
||||||
|
|
||||||
-- Guard against crashes when the object the projectile collided with was destroyed
|
-- Guard against crashes when the object the projectile collided with was destroyed
|
||||||
if object_lua._removed or not object:get_pos() then return true end
|
if (object_lua and object_lua._removed) or not object:get_pos() then object_alive = false end
|
||||||
|
|
||||||
-- Indicate damage
|
-- Indicate damage
|
||||||
damage_particles(vector.add(pos, vector.multiply(self.object:get_velocity(), 0.1)), self._is_critical)
|
damage_particles(vector.add(pos, vector.multiply(self.object:get_velocity(), 0.1)), self._is_critical)
|
||||||
|
|
||||||
-- Light things on fire
|
-- Light things on fire
|
||||||
if mcl_burning.is_burning(self.object) then
|
if object_alive and mcl_burning.is_burning(self.object) then
|
||||||
mcl_burning.set_on_fire(object, 5)
|
mcl_burning.set_on_fire(object, 5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue