Closed Nexela closed 7 years ago
Very nicely done! Exactly what I was hoping for. I fixed a small bug (toggling bottleneck-enabled only toggled about half of the signals) by resetting the update index on change of the setting.
Speaking of Bottleneck Logistics, I've played around with getting the "desired bottleneck behavior" in the mod, and it seems like it can be done without too much overhead in most cases, and approximated well in others. For instance, the following code gives some useful info for requester chests and isn't prohibitively expensive:
local function color_logistic_inputinventory(filters, inv) for ,filter in pairs(filters) do local icount = inv.get_item_count(filter.name) if icount == 0 then return "red" elseif icount < filter.count then return "green" end end return "yellow" end
local function update_signal(data) local entity = data.entity if entity.logistic_network then local point = entity.get_logistic_point()[1] if point.mode == defines.logistic_mode.requester then if point.filters then change_signal(data.signal, color_logistic_input_inventory(point.filters, entity.get_inventory(defines.inventory.chest))) else change_signal(data.signal, "yellow") end else change_signal(data.signal, "green") end else change_signal(data.signal, "red") end end
The idea is that red mean trouble, green means currently doing something constructive, and yellow means idle.
It might be worth while have toggling as a hotkey... It is a little cumbersome to get to the settings menu.
Unfortunately the settings and hotkeys would not sync
I have a few more changes incoming in a few minutes
Thank you so much for that example code, It is making its way into BL right now!
Check it out and let me know your thoughts. Don't push a release yet I need to update bottleneck logistics and might have to make more changes :)