mirror of
https://github.com/minetest-mods/areas.git
synced 2025-07-01 23:50:26 +02:00
Fixed bugs in faction code
Also added faction indicator to HUD
This commit is contained in:
5
api.lua
5
api.lua
@ -94,14 +94,13 @@ function areas:canInteract(pos, name)
|
|||||||
for _, area in pairs(self:getAreasAtPos(pos)) do
|
for _, area in pairs(self:getAreasAtPos(pos)) do
|
||||||
if area.owner == name or area.open then
|
if area.owner == name or area.open then
|
||||||
return true
|
return true
|
||||||
elseif factions then
|
elseif factions and area.faction_open then
|
||||||
local faction_name = factions.get_player_faction(area.owner)
|
local faction_name = factions.get_player_faction(area.owner)
|
||||||
if faction_name ~= nil and faction_name == factions.get_player_faction(name) then
|
if faction_name ~= nil and faction_name == factions.get_player_faction(name) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
|
||||||
owned = true
|
|
||||||
end
|
end
|
||||||
|
owned = true
|
||||||
end
|
end
|
||||||
return not owned
|
return not owned
|
||||||
end
|
end
|
||||||
|
5
hud.lua
5
hud.lua
@ -21,9 +21,10 @@ minetest.register_globalstep(function(dtime)
|
|||||||
local areaStrings = {}
|
local areaStrings = {}
|
||||||
|
|
||||||
for id, area in pairs(areas:getAreasAtPos(pos)) do
|
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,
|
:format(area.name, id, area.owner,
|
||||||
area.open and ":open" or ""))
|
area.open and ":open" or "",
|
||||||
|
area.faction_open and ":faction" or ""))
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, area in pairs(areas:getExternalHudEntries(pos)) do
|
for i, area in pairs(areas:getExternalHudEntries(pos)) do
|
||||||
|
Reference in New Issue
Block a user