Skip to content

Cleaning disbanded factions on every HUD update #81

@SwissalpS

Description

@SwissalpS

This seems like an inefficient way to clear out disbanded factions:

areas/hud.lua

Lines 25 to 36 in c2e3d07

-- Gather and clean up disbanded factions
local changed = false
for i, fac_name in ipairs(area.faction_open) do
if not factions.get_owner(fac_name) then
table.remove(area.faction_open, i)
changed = true
end
end
if #area.faction_open == 0 then
-- Prevent DB clutter, remove value
area.faction_open = nil
else

Wouldn't it make more sense to clean DB on boot and then rely on callbacks from [playerfactions]?
I guess the challenge here is that there are several forks of [playerfactions] around.
For the mt-mods fork I have proposed adding registration this way:
mt-mods/playerfactions@a73f7cb

The impact is probably not massive in the amount of factions there are per area, so I don't know if it is worth adding this feature with backward compat for forks that don't support it.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions