minetest-mods / areas

A rewrite of the node_ownership Minetest mod with many new features.
GNU Lesser General Public License v2.1
51 stars 52 forks source link

Cleaning disbanded factions on every HUD update #81

Open SwissalpS opened 2 months ago

SwissalpS commented 2 months ago

This seems like an inefficient way to clear out disbanded factions: https://github.com/minetest-mods/areas/blob/c2e3d073be23f0fefd761a0c8b1cb55a53baa4c8/hud.lua#L25-L36

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: https://github.com/mt-mods/playerfactions/pull/11/commits/a73f7cbb90f195f35b0f5a919041f2ec179a1a31

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 commented 4 weeks ago

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 commented 3 weeks ago

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.