Restore mob water damage

This commit is contained in:
kay27 2022-02-13 06:18:50 +04:00
parent ac1ec1d77d
commit 49f84f194a
3 changed files with 32 additions and 3 deletions

View File

@ -893,6 +893,17 @@ function mobs.mob_step(self, dtime)
end
end
--water damage
if self.water_damage and self.water_damage ~= 0 then
local pos = self.object:get_pos()
local node = minetest_get_node(pos).name
if minetest_get_item_group(node, "water") ~= 0 then
mobs.smoke_effect(self)
self.health = self.health - self.water_damage
self:teleport()
end
end
--set mobs on fire when burned by sunlight
if self.ignited_by_sunlight then
local pos = self.object:get_pos()

View File

@ -147,4 +147,24 @@ mobs.breeding_effect = function(self)
vertical = false,
texture = "heart.png",
})
end
end
mobs.smoke_effect = function(self)
local pos = self.object:get_pos()
minetest.add_particlespawner({
amount = 5,
time = 0.25,
minpos = pos,
maxpos = pos,
minvel = {x = -1, y = -1, z = -1},
maxvel = {x = 1, y = 1, z = 1},
minacc = {x = 0, y = 10, z = 0},
maxacc = {x = 0, y = 10, z = 0},
minexptime = 0.1,
maxexptime = 1,
minsize = 0.5,
maxsize = 1,
collisiondetection = false,
texture = "mcl_particles_smoke.png",
})
end

View File

@ -1,2 +0,0 @@
mcl_mobs
mcl_potions