add support for visual_harm_1ndicators mod (thx Mantar)

This commit is contained in:
tenplus1 2023-11-20 07:57:20 +00:00
parent bb66ffe335
commit 412066fc07
3 changed files with 21 additions and 2 deletions

13
api.lua
View File

@ -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

View File

@ -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

View File

@ -24,6 +24,14 @@ https://forum.minetest.net/viewtopic.php?f=11&t=9917
## Changelog
### Version 1.61
* Fixed mob damage when riding mobs
* Added entity:is_inside(itemtable) function (thx cora)
* Added self.attack_patience value so mobs stop attacking unseen players
* Added self.homing so that arrows follow player when visible
* Added support for Visual Harm 1ndicators mod to show health bars
### Version 1.60
* Move mob and arrow entities to use initial_properties