From 49f84f194a031d4ef6c9f60a6f400ef66a098955 Mon Sep 17 00:00:00 2001 From: kay27 Date: Sun, 13 Feb 2022 06:18:50 +0400 Subject: [PATCH] Restore mob water damage --- .../mcl_mobs/api/mob_functions/ai.lua | 11 ++++++++++ .../api/mob_functions/mob_effects.lua | 22 ++++++++++++++++++- mods/ENTITIES/mobs_mc/depends.txt | 2 -- 3 files changed, 32 insertions(+), 3 deletions(-) delete mode 100644 mods/ENTITIES/mobs_mc/depends.txt diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua index cdcffd81c..6da0d5a1a 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua @@ -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() diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/mob_effects.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/mob_effects.lua index 83df80992..26513a648 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/mob_effects.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/mob_effects.lua @@ -147,4 +147,24 @@ mobs.breeding_effect = function(self) vertical = false, texture = "heart.png", }) -end \ No newline at end of file +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 diff --git a/mods/ENTITIES/mobs_mc/depends.txt b/mods/ENTITIES/mobs_mc/depends.txt deleted file mode 100644 index 96c9f5131..000000000 --- a/mods/ENTITIES/mobs_mc/depends.txt +++ /dev/null @@ -1,2 +0,0 @@ -mcl_mobs -mcl_potions \ No newline at end of file