forked from VoxeLibre/VoxeLibre
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
4a71d993d3
commit
aebafd7af0
|
@ -201,6 +201,7 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
|||
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._death_timer > 100 then
|
||||
self._removed = true
|
||||
self.object:remove()
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -276,6 +276,9 @@ local function handle_entity_collision(self, entity_def, projectile_def, object)
|
|||
if do_damage then
|
||||
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
|
||||
damage_particles(vector.add(pos, vector.multiply(self.object:get_velocity(), 0.1)), self._is_critical)
|
||||
|
||||
|
|
Loading…
Reference in New Issue