Bob's Adjustable Inserters


Adds hotkeys and a GUI to adjust inserter pickup and drop locations.

Tweaks
2 months ago
0.13 - 2.0
372K
Logistics

g Ctrl-z forgets inserter configuration

8 months ago
(updated 8 months ago)

"Enable inserter configuration mode" is checked. (reach override setting does not matter)
Delete an inserter with non-vanilla pickup/dropoff locations.
Use Ctrl-z to put the inserter back.
The custom P/D settings are lost and vanilla P/D settings are used.

Works as expected if "Enable inserter configuration mode" is NOT checked.

Ctrl-c or Ctrl-x followed by Ctrl-v works as expected regardless of either of the checkbox settings.

Something else I noticed. Only learned from investigating the topics here because I never use Reach Overrides:
IF(
inserters are created using Reach Overrides...
AND those inserters are put in a blueprint...
AND Reach Overrides is ENABLED when you paste the blueprint...
)
THEN
The inserters will use whatever "long handed" and "near-side" settings that are checked when the blueprint is placed, NOT what was saved in the blueprint.
WORK-AROUNDS
1. Never use Reach Overrides to place an inserter that will be in a blueprint.
2. Make sure Reach Overrides is NOT checked when placing blueprints.
Ideally, fix the code to not use current "Reach Override" settings when blueprints are placed.
This hasn't been an issue for me because of how I place inserters: Place one or two machines, place inserters around them, configure the inserters, copy/paste this "module" as needed for the production line. Then they all work as expected when creating/pasting blueprints. I never use Reach Overrides to place inserters.

8 months ago
(updated 8 months ago)

I couldn't resist the temptation to try and solve this...
I am not familiar with the mod. I found something that SEEMS to work. No guarantees for all cases.
I also learned that when you use Ctrl-c the game treats it as a blueprint in the cursor :-)

Add this code in control.lua.
[code]
function bobmods.logistics.set_positions(entity, player_index)
-- NEW
-- BEGIN gives debug output
local bp = game.players[player_index].is_cursor_blueprint()
local str = "bobmods.logistics.set_positions():: Holding blueprint = ".. tostring(bp) .. "."
if bp then
str = str .. " Early return... NOT"
end
game.print(str .. " Raising event to set \"Reach Override\" pickup/dropoff positions.")
if bp then
return
end
-- END gives debug output
-- or just use this line for no debug printing
if game.players[player_index].is_cursor_blueprint() then return end
-- NEW
if storage.bobmods.logistics[player_index].enabled then
[/code]

8 months ago

Wow, that was just... wrong :-(
If we want to use the Reach Override setting, we must be putting down a new inserter at that moment.
Instead of looking to NOT be holding a blueprint, let's make sure we ARE holding an inserter.

[code]
--NEW begin
function string:endswith(needle)
return needle == "" or self:sub(-#needle) == needle
end
-- NEW end

function bobmods.logistics.set_positions(entity, player_index)
-- NEW begin
local cs = ""
if game.players[player_index].cursor_stack.valid_for_read then
cs = game.players[player_index].cursor_stack.name
end
if not cs:endswith("inserter") then return end
-- NEW end
if storage.bobmods.logistics[player_index].enabled then
[/code]

New response