From 030a77fd9dd676256f57a3dd97509bce61c4d10e Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 20 Nov 2023 12:46:27 -0800 Subject: [PATCH 1/3] Add support for Visual Harm 1ndicators mod --- mob_meta.lua | 13 +++++++++++++ mod.conf | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mob_meta.lua b/mob_meta.lua index c458508..9cd537e 100644 --- a/mob_meta.lua +++ b/mob_meta.lua @@ -2,6 +2,13 @@ -- Mob Meta -- -------------- +-- Visual Harm 1ndicator check + +local use_vh1 +minetest.register_on_mods_loaded(function() + use_vh1 = minetest.get_modpath("visual_harm_1ndicators") +end) + -- Math -- local pi = math.pi @@ -239,6 +246,9 @@ function mob:hurt(health) if self.protected then return end self.hp = self.hp - math.ceil(health) if self.hp < 0 then self.hp = 0 end + if use_vh1 then + VH1.update_bar(self.object, self.hp, self.max_health) + end end -- Add HP to mob @@ -249,6 +259,9 @@ function mob:heal(health) if self.hp > self.max_health then self.hp = self.max_health end + if use_vh1 then + VH1.update_bar(self.object, self.hp, self.max_health) + end end -- Return position at center of mobs hitbox diff --git a/mod.conf b/mod.conf index e126b90..330a208 100644 --- a/mod.conf +++ b/mod.conf @@ -1,2 +1,6 @@ name = creatura -description = A performant, semi-modular mob API \ No newline at end of file +description = A performant, semi-modular mob API +optional_depends = visual_harm_1ndicators +release = 17555 +author = ElCeejo +title = Creatura From cfe3411ca829ea89a80f6a36a0ad53921fe76f76 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 20 Nov 2023 13:32:47 -0800 Subject: [PATCH 2/3] Oops, that's not necessary --- mob_meta.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mob_meta.lua b/mob_meta.lua index 9cd537e..249c92e 100644 --- a/mob_meta.lua +++ b/mob_meta.lua @@ -4,10 +4,7 @@ -- Visual Harm 1ndicator check -local use_vh1 -minetest.register_on_mods_loaded(function() - use_vh1 = minetest.get_modpath("visual_harm_1ndicators") -end) +local use_vh1 = minetest.get_modpath("visual_harm_1ndicators") -- Math -- From fbf0aba0ced8fe5dcbbb350cd0169c6f71d0fafd Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 22 Nov 2023 20:54:10 -0800 Subject: [PATCH 3/3] Remove lines that crept in from Contentdb --- mod.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/mod.conf b/mod.conf index 330a208..29d09c0 100644 --- a/mod.conf +++ b/mod.conf @@ -1,6 +1,3 @@ name = creatura description = A performant, semi-modular mob API optional_depends = visual_harm_1ndicators -release = 17555 -author = ElCeejo -title = Creatura