mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-04-30 05:41:46 -04:00
Add support for Visual Harm 1ndicators mod
This commit is contained in:
parent
97375e0888
commit
030a77fd9d
2 changed files with 18 additions and 1 deletions
13
mob_meta.lua
13
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
|
||||
|
|
6
mod.conf
6
mod.conf
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue