Show faction name in HUD
This commit is contained in:
parent
8d4a9ac877
commit
d324d534c3
|
@ -289,7 +289,7 @@ minetest.register_chatcommand("area_open", {
|
||||||
if areas.factions_available then
|
if areas.factions_available then
|
||||||
minetest.register_chatcommand("area_faction_open", {
|
minetest.register_chatcommand("area_faction_open", {
|
||||||
params = "<ID>",
|
params = "<ID>",
|
||||||
description = "Toggle an area open/closed for members in your faction."
|
description = "Toggle an area open/closed for members in your faction.",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local id = tonumber(param)
|
local id = tonumber(param)
|
||||||
if not id then
|
if not id then
|
||||||
|
|
5
hud.lua
5
hud.lua
|
@ -21,10 +21,13 @@ 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
|
||||||
|
if area.faction_open and (areas.faction_available == false or factions.get_player_faction(area.owner) == nil) then
|
||||||
|
area.faction_open = false
|
||||||
|
end
|
||||||
table.insert(areaStrings, ("%s [%u] (%s%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 ""))
|
area.faction_open and ":"..factions.get_player_faction(area.owner) or ""))
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, area in pairs(areas:getExternalHudEntries(pos)) do
|
for i, area in pairs(areas:getExternalHudEntries(pos)) do
|
||||||
|
|
Loading…
Reference in New Issue