From 09d10a5da00cba1d3c09ae83c5fb94fd778b3aa0 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sun, 19 Nov 2023 18:41:50 -0800 Subject: [PATCH] Add support for Visual Harm 1ndicators mod --- api.lua | 9 +++++++++ mod.conf | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index f948f61..f44847a 100644 --- a/api.lua +++ b/api.lua @@ -8,6 +8,9 @@ local use_cmi = minetest.global_exists("cmi") -- MineClone2 check local use_mc2 = minetest.get_modpath("mcl_core") +-- Visual Harm 1ndicator check +local use_vh1 = minetest.get_modpath("visual_harm_1ndicators") + -- Global mobs = { mod = "redo", @@ -827,6 +830,9 @@ function mob_class:check_for_death(cmi_cause) self.old_health = self.health + if use_vh1 then + VH1.update_bar(self.object, self.health) + end -- still got some health? play hurt sound if self.health > 0 then @@ -2836,6 +2842,9 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage) if damage <= -1 then self.health = self.health - floor(damage) + if use_vh1 then + VH1.update_bar(self.object, self.health) + end return true end diff --git a/mod.conf b/mod.conf index 7f9ea15..4317e4b 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = mobs description = Adds a mob api for mods to add animals or monsters etc. -optional_depends = default, tnt, invisibility, lucky_block, cmi, toolranks, pathfinder, player_api, mtobjid +optional_depends = default, tnt, invisibility, lucky_block, cmi, toolranks, pathfinder, player_api, mtobjid, visual_harm_1ndicators min_minetest_version = 5.0