Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning disbanded factions on every HUD update #81

Open
SwissalpS opened this issue Sep 18, 2024 · 2 comments
Open

Cleaning disbanded factions on every HUD update #81

SwissalpS opened this issue Sep 18, 2024 · 2 comments

Comments

@SwissalpS
Copy link
Contributor

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?

@SmallJoker
Copy link
Member

What do you think?

Who? Me? I don't want to watch all repositories, thus please fell free to @ me when an action is needed.

clean DB on boot and then rely on callbacks from [playerfactions]?

Having callbacks would surely help. But we're still at risk of out-of-sync without a full check when there's a server error where one of the mod's data was saved but not the other.

@SwissalpS
Copy link
Contributor Author

What do you think?

Who? Me? I don't want to watch all repositories, thus please fell free to @ me when an action is needed.

Anybody interested in participating on this repo. This is nothing urgent.

clean DB on boot and then rely on callbacks from [playerfactions]?

Having callbacks would surely help. But we're still at risk of out-of-sync without a full check when there's a server error where one of the mod's data was saved but not the other.

I imagine out-of-sync wouldn't last long. This isn't something that changes a lot and isn't likely to be used during time sensitive actions like battles. I could be mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants