From fb08f7adb707d86ae5e6a1eb1697e3d3e472a01c Mon Sep 17 00:00:00 2001 From: Alden Peeters Date: Fri, 13 Sep 2019 15:08:44 -0400 Subject: [PATCH] Better checks for playerfactions mod availability --- api.lua | 2 +- chatcommands.lua | 2 +- init.lua | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api.lua b/api.lua index e7f83d6..1981727 100644 --- a/api.lua +++ b/api.lua @@ -94,7 +94,7 @@ function areas:canInteract(pos, name) for _, area in pairs(self:getAreasAtPos(pos)) do if area.owner == name or area.open then return true - elseif factions and area.faction_open then + elseif factions_avail and area.faction_open then local faction_name = factions.get_player_faction(area.owner) if faction_name ~= nil and faction_name == factions.get_player_faction(name) then return true diff --git a/chatcommands.lua b/chatcommands.lua index 9bc5c9c..ef35e7c 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -286,7 +286,7 @@ minetest.register_chatcommand("area_open", { }) -if factions then +if factions_avail then minetest.register_chatcommand("area_faction_open", { params = "", description = "Toggle an area open (anyone can interact) or closed to your faction", diff --git a/init.lua b/init.lua index 8179b28..d1df5a0 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,8 @@ -- Based on node_ownership -- License: LGPLv2+ +factions_avail = minetest.global_exists("factions") + areas = {} areas.adminPrivs = {areas=true}