diff --git a/mods/ENTITIES/mobs/api.lua b/mods/ENTITIES/mobs/api.lua index d126c0db18..b284216f88 100644 --- a/mods/ENTITIES/mobs/api.lua +++ b/mods/ENTITIES/mobs/api.lua @@ -646,6 +646,17 @@ local do_env_damage = function(self) local nodef = minetest.registered_nodes[self.standing_in] + -- rain + if self.rain_damage and minetest.get_modpath("mcl_weather") then + if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then + + self.health = self.health - self.rain_damage + + if check_for_death(self, "rain", {type = "environment", + pos = pos, node = self.standing_in}) then return end + end + end + pos.y = pos.y + 1 -- for particle effect position -- water @@ -3097,6 +3108,7 @@ minetest.register_entity(name, { -- MCL2 extensions ignores_nametag = def.ignores_nametag or false, + rain_damage = def.rain_damage or 0, on_spawn = def.on_spawn, diff --git a/mods/ENTITIES/mobs/api.txt b/mods/ENTITIES/mobs/api.txt index c2cd327319..6d9ecc7c03 100644 --- a/mods/ENTITIES/mobs/api.txt +++ b/mods/ENTITIES/mobs/api.txt @@ -208,6 +208,7 @@ functions needed for the mob to work properly which contains the following: MineClone 2 extensions: 'ignores_nametag' if true, mob cannot be named by nametag + 'rain_damage' damage per second if mob is standing in rain (default: 0) Node Replacement diff --git a/mods/ENTITIES/mobs/depends.txt b/mods/ENTITIES/mobs/depends.txt index da5ffd9ba4..91d5a20742 100644 --- a/mods/ENTITIES/mobs/depends.txt +++ b/mods/ENTITIES/mobs/depends.txt @@ -1,4 +1,5 @@ mcl_core +mcl_weather? mcl_tnt? invisibility? intllib? diff --git a/mods/ENTITIES/mobs_mc/snowman.lua b/mods/ENTITIES/mobs_mc/snowman.lua index 0f07a8616d..c9d9a9cee6 100644 --- a/mods/ENTITIES/mobs_mc/snowman.lua +++ b/mods/ENTITIES/mobs_mc/snowman.lua @@ -101,6 +101,8 @@ mobs:register_mob("mobs_mc:snowman", { end end end, + + rain_damage = 4, }) -- This is to be called when a pumpkin or jack'o lantern has been placed. Recommended: In the on_construct function