mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-11 12:13:15 +01:00
Prevent projectiles from crashing server when removed when it punched something (wither skull hitting the wither will cause this), mark wither skull with _removed = true when death timer removes it
This commit is contained in:
parent
6c22307d99
commit
6173333c9e
@ -201,6 +201,7 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
|||||||
self._death_timer = self._death_timer + self.health - self._health_old
|
self._death_timer = self._death_timer + self.health - self._health_old
|
||||||
if self.health == self._health_old then self._death_timer = self._death_timer + dtime end
|
if self.health == self._health_old then self._death_timer = self._death_timer + dtime end
|
||||||
if self._death_timer > 100 then
|
if self._death_timer > 100 then
|
||||||
|
self._removed = true
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -276,6 +276,9 @@ local function handle_entity_collision(self, entity_def, projectile_def, object)
|
|||||||
if do_damage then
|
if do_damage then
|
||||||
object:punch(self.object, 1.0, projectile_def.tool or { full_punch_interval = 1.0, damage_groups = dmg }, dir )
|
object:punch(self.object, 1.0, projectile_def.tool or { full_punch_interval = 1.0, damage_groups = dmg }, dir )
|
||||||
|
|
||||||
|
-- Guard against crashes when projectiles get destroyed in response to what it punched
|
||||||
|
if not self.object:get_pos() then return true 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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user