troelsbjerre / Bottleneck

Factorio mod that tell you which assemblers are starved of ingredients
Other
26 stars 21 forks source link

Add interface to manage blacklist from other mods #75

Closed hreintke closed 4 years ago

hreintke commented 4 years ago

I always had local patches to Bottleneck to have entity names not use Bottleneck This PR allows to have it automated using

local function onload()
  remote.call("Bottleneck","manage_blacklist","ultimate-transport-belt-beltbox",true)
end

script.on_load(onload)
troelsbjerre commented 4 years ago

It's a little iffy to modify the blacklist once the mod is running. The blacklist only limits whether newly added entities get a signal, and thus entities will get signals based on what the blacklist was at the time of their creation. Bottleneck creates signals for all supported entities at initialization, so it would be up to initialization order whether the api call would get there in time. A heavy-handed (but robust) fix would be to have the manage_blacklist trigger a full rebuild, but maybe a custom name-specific rebuild would be a feasible approach.

Nexela commented 4 years ago

As it sits right now I am pretty sure this PR would cause desyncs. If I get a chance tonight I will look at adapting it.

On Mon, Feb 3, 2020, 2:08 PM Troels Bjerre Lund notifications@github.com wrote:

It's a little iffy to modify the blacklist once the mod is running. The blacklist only limits whether newly added entities get a signal, and thus entities will get signals based on what the blacklist was at the time of their creation. Bottleneck creates signals for all supported entities at initialization, so it would be up to initialization order whether the api call would get there in time. A heavy-handed (but robust) fix would be to have the manage_blacklist trigger a full rebuild, but maybe a custom name-specific rebuild would be a feasible approach.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/troelsbjerre/Bottleneck/pull/75?email_source=notifications&email_token=ADKTFYETIFN5BXRJ3LYW3CLRBBTSBA5CNFSM4KPH22ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKVAKAI#issuecomment-581567745, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKTFYB74JY3TR5HENPZGF3RBBTSBANCNFSM4KPH22ZA .

hreintke commented 4 years ago

I agree that it would be better to have the blacklist filled before the mod is running. Wanted to make the change as minimal as possible, that's why I did it this way. My idea was to add the blacklist entries in the on_load, when I am correct that is before actual start of the game. I was thinking on a full rebuild initiated by the remote.call to clean, but partial rebuild is better for sure.

Other option maybe ? Add the blacklist to settings, they can be set in settings.lua and updated by other mods.

If you indicate in which direction you like to go, I can do some testing/proof of concept

hreintke commented 4 years ago

Will keep my local patch for now. When I find a good way to implement I will open a new PR.