Add support for Visual Harm 1ndicators mod
This commit is contained in:
parent
bb66ffe335
commit
09d10a5da0
9
api.lua
9
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
|
||||
|
|
2
mod.conf
2
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
|
||||
|
|
Loading…
Reference in New Issue