Adapted to integrate the new version of playerfactions (multi-factions mode)

This commit is contained in:
Supergoat666
2020-07-28 22:17:55 +02:00
parent 142a723eb2
commit 75a0c60c55
3 changed files with 72 additions and 14 deletions

18
api.lua
View File

@ -92,9 +92,21 @@ function areas:canInteract(pos, name)
if area.owner == name or area.open then
return true
elseif areas.factions_available 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
local faction_name = nil
if factions.version == nil or factions.version < 2 then
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
factions_names = area.factions_names
if factions_names ~= nil then
for _, fname in ipairs(factions_names) do
if factions.player_is_in_faction(fname, name) then
return true
end
end
end
end
end
owned = true