Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions mob_meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
-- Mob Meta --
--------------

-- Visual Harm 1ndicator check

local use_vh1 = minetest.get_modpath("visual_harm_1ndicators")

-- Math --

local pi = math.pi
Expand Down Expand Up @@ -239,6 +243,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
Expand All @@ -249,6 +256,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
Expand Down
3 changes: 2 additions & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
name = creatura
description = A performant, semi-modular mob API
description = A performant, semi-modular mob API
optional_depends = visual_harm_1ndicators