1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-01-23 16:00:16 +01:00

use invisibility mod api

This commit is contained in:
tenplus1 2024-11-14 08:17:41 +00:00
parent 39f9f8df31
commit 2e4664a5ce

View File

@ -7,6 +7,7 @@ local use_cmi = minetest.global_exists("cmi")
local use_mc2 = minetest.get_modpath("mcl_core") -- MineClonia support local use_mc2 = minetest.get_modpath("mcl_core") -- MineClonia support
local use_vh1 = minetest.get_modpath("visual_harm_1ndicators") local use_vh1 = minetest.get_modpath("visual_harm_1ndicators")
local use_tr = minetest.get_modpath("toolranks") local use_tr = minetest.get_modpath("toolranks")
local use_invisibility = minetest.get_modpath("invisibility")
-- Node check helper -- Node check helper
@ -18,10 +19,9 @@ end
mobs = { mobs = {
mod = "redo", mod = "redo",
version = "20241113", version = "20241114",
spawning_mobs = {}, spawning_mobs = {},
translate = S, translate = S,
invis = minetest.global_exists("invisibility") and invisibility or {},
node_snow = has(minetest.registered_aliases["mapgen_snow"]) node_snow = has(minetest.registered_aliases["mapgen_snow"])
or has("mcl_core:snow") or has("default:snow") or "air", or has("mcl_core:snow") or has("default:snow") or "air",
node_dirt = has(minetest.registered_aliases["mapgen_dirt"]) node_dirt = has(minetest.registered_aliases["mapgen_dirt"])
@ -1211,7 +1211,10 @@ end
local function is_invisible(self, player_name) local function is_invisible(self, player_name)
if mobs.invis[player_name] and not self.ignore_invisibility then return true end if use_invisibility and not self.ignore_invisibility
and invisibility.is_visible and not invisibility.is_visible(player_name) then
return true
end
end end
-- should mob follow what I'm holding ? -- should mob follow what I'm holding ?