Fix blazes attemted to find vector.distance to nil

This commit is contained in:
kay27 2022-02-05 23:04:56 +04:00
parent 304ea98ef9
commit f6b34f8865
1 changed files with 6 additions and 3 deletions

View File

@ -89,10 +89,13 @@ mobs:register_mob("mobs_mc:blaze", {
end,
do_custom = function(self)
if self.attacking and self.state == "attack" and vector.distance(self.object:get_pos(), self.attacking:get_pos()) < 1.2 then
mcl_burning.set_on_fire(self.attacking, 5)
end
local pos = self.object:get_pos()
if self.attacking and self.state == "attack" then
local attacking_pos = self.attacking:get_pos()
if attacking_pos and vector.distance(pos, attacking_pos) < 1.2 then
mcl_burning.set_on_fire(self.attacking, 5)
end
end
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},