mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-04-30 13:51:41 -04:00
Merge fbf0aba0ce
into 24f997039f
This commit is contained in:
commit
9622a9d99c
2 changed files with 12 additions and 1 deletions
10
mob_meta.lua
10
mob_meta.lua
|
@ -2,6 +2,10 @@
|
||||||
-- Mob Meta --
|
-- Mob Meta --
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
-- Visual Harm 1ndicator check
|
||||||
|
|
||||||
|
local use_vh1 = minetest.get_modpath("visual_harm_1ndicators")
|
||||||
|
|
||||||
-- Math --
|
-- Math --
|
||||||
|
|
||||||
local pi = math.pi
|
local pi = math.pi
|
||||||
|
@ -239,6 +243,9 @@ function mob:hurt(health)
|
||||||
if self.protected then return end
|
if self.protected then return end
|
||||||
self.hp = self.hp - math.ceil(health)
|
self.hp = self.hp - math.ceil(health)
|
||||||
if self.hp < 0 then self.hp = 0 end
|
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
|
end
|
||||||
|
|
||||||
-- Add HP to mob
|
-- Add HP to mob
|
||||||
|
@ -249,6 +256,9 @@ function mob:heal(health)
|
||||||
if self.hp > self.max_health then
|
if self.hp > self.max_health then
|
||||||
self.hp = self.max_health
|
self.hp = self.max_health
|
||||||
end
|
end
|
||||||
|
if use_vh1 then
|
||||||
|
VH1.update_bar(self.object, self.hp, self.max_health)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return position at center of mobs hitbox
|
-- Return position at center of mobs hitbox
|
||||||
|
|
1
mod.conf
1
mod.conf
|
@ -1,2 +1,3 @@
|
||||||
name = creatura
|
name = creatura
|
||||||
description = A performant, semi-modular mob API
|
description = A performant, semi-modular mob API
|
||||||
|
optional_depends = visual_harm_1ndicators
|
||||||
|
|
Loading…
Add table
Reference in a new issue