mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-07-01 16:00:23 +02:00
add support for visual_harm_1ndicators mod (thx Mantar)
This commit is contained in:
13
api.lua
13
api.lua
@ -8,10 +8,13 @@ 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",
|
||||
version = "20231116",
|
||||
version = "20231120",
|
||||
translate = S,
|
||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||
node_snow = minetest.registered_aliases["mapgen_snow"]
|
||||
@ -827,6 +830,10 @@ 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
|
||||
|
||||
@ -2837,6 +2844,10 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
||||
|
||||
self.health = self.health - floor(damage)
|
||||
|
||||
if use_vh1 then
|
||||
VH1.update_bar(self.object, self.health)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user