Add support for Visual Harm 1ndicators mod

This commit is contained in:
Jeremy 2023-11-20 12:46:27 -08:00
parent 97375e0888
commit 030a77fd9d
2 changed files with 18 additions and 1 deletions

View file

@ -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

View file

@ -1,2 +1,6 @@
name = creatura
description = A performant, semi-modular mob API
description = A performant, semi-modular mob API
optional_depends = visual_harm_1ndicators
release = 17555
author = ElCeejo
title = Creatura