From 286d7b6fbf5f26ba6e3ab98a6cd801976a2b5d69 Mon Sep 17 00:00:00 2001 From: Alden Peeters Date: Mon, 9 Sep 2019 17:58:38 -0400 Subject: [PATCH] Fixed bugs in faction code Also added faction indicator to HUD --- api.lua | 5 ++--- hud.lua | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api.lua b/api.lua index c98d262..e7f83d6 100644 --- a/api.lua +++ b/api.lua @@ -94,14 +94,13 @@ 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 then + elseif factions 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 end - else - owned = true end + owned = true end return not owned end diff --git a/hud.lua b/hud.lua index 24f5414..8ba6b8e 100644 --- a/hud.lua +++ b/hud.lua @@ -21,9 +21,10 @@ minetest.register_globalstep(function(dtime) local areaStrings = {} for id, area in pairs(areas:getAreasAtPos(pos)) do - table.insert(areaStrings, ("%s [%u] (%s%s)") + table.insert(areaStrings, ("%s [%u] (%s%s%s)") :format(area.name, id, area.owner, - area.open and ":open" or "")) + area.open and ":open" or "", + area.faction_open and ":faction" or "")) end for i, area in pairs(areas:getExternalHudEntries(pos)) do