add mobs:is_node_dangerous(self, nodename) global function
This commit is contained in:
parent
e5d1958e16
commit
e83620553d
8
api.lua
8
api.lua
@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20211212",
|
version = "20220115",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -1002,7 +1002,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- Returns true is node can deal damage to self
|
-- 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
|
if self.water_damage > 0
|
||||||
and minetest.get_item_group(nodename, "water") ~= 0 then
|
and minetest.get_item_group(nodename, "water") ~= 0 then
|
||||||
@ -1026,6 +1026,10 @@ local is_node_dangerous = function(self, nodename)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function is_node_dangerous(self, nodename)
|
||||||
|
return mobs:is_node_dangerous(self, nodename)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- is mob facing a cliff
|
-- is mob facing a cliff
|
||||||
function mob_class:is_at_cliff()
|
function mob_class:is_at_cliff()
|
||||||
|
6
api.txt
6
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.
|
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"
|
External Settings for "minetest.conf"
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user