From e83620553d318e9dda8f1555fd74ad6f427f8fd4 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sat, 15 Jan 2022 09:41:21 +0000 Subject: [PATCH] add mobs:is_node_dangerous(self, nodename) global function --- api.lua | 8 ++++++-- api.txt | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/api.lua b/api.lua index 6ca5fed..1f82df8 100644 --- a/api.lua +++ b/api.lua @@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20211212", + version = "20220115", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {} } @@ -1002,7 +1002,7 @@ end -- Returns true is node can deal damage to self -local is_node_dangerous = function(self, nodename) +function mobs:is_node_dangerous(self, nodename) if self.water_damage > 0 and minetest.get_item_group(nodename, "water") ~= 0 then @@ -1026,6 +1026,10 @@ local is_node_dangerous = function(self, nodename) return false end +local function is_node_dangerous(self, nodename) + return mobs:is_node_dangerous(self, nodename) +end + -- is mob facing a cliff function mob_class:is_at_cliff() diff --git a/api.txt b/api.txt index 772f76a..7cba54b 100644 --- a/api.txt +++ b/api.txt @@ -691,6 +691,12 @@ space to spawn mob [name], if so then a new position is returned for use, otherwise nil is returned. +mobs:is_node_dangerous(self, nodename) + +This function returns true if the node name given is harmful to the mob (self), it is +mainly used when a mob is near a node it has to avoid. + + External Settings for "minetest.conf" ------------------------------------