diff --git a/boblogistics/changelog.txt b/boblogistics/changelog.txt index 3818a4bb9..6f84484c3 100644 --- a/boblogistics/changelog.txt +++ b/boblogistics/changelog.txt @@ -4,6 +4,7 @@ Date: ??? Bugfixes: - Fixed that Long-handed inserters were uncraftable when Inserter overhaul was disabled #113 - Fixed that techs Railway 2 and Armoured Railway could not be researched when Pyanodons Industry mod was enabled #117 + - Hid custom input "Change inserter long range" if setting "Inserter Overhaul" is disabled #143 - Fixed Inserter Entity Order #144 Changes: - Added support for Space Exploration mod #88 diff --git a/boblogistics/control.lua b/boblogistics/control.lua index 6b5282d1f..62609461b 100644 --- a/boblogistics/control.lua +++ b/boblogistics/control.lua @@ -357,19 +357,17 @@ function bobmods.logistics.long_range(entity, player) end end -script.on_event("bob-inserter-long", function(event) +function bobmods.logistics.check_range(event) local player = game.players[event.player_index] local entity = player.selected - if - not game.active_mods["bobinserters"] - and entity + if entity and entity.type == "inserter" and player.can_reach_entity(entity) and not global.bobmods.logistics.blacklist[entity.name] then bobmods.logistics.long_range(entity, player) end -end) +end script.on_configuration_changed(function(event) for i, player in pairs(game.players) do @@ -378,12 +376,24 @@ script.on_configuration_changed(function(event) for index, force in pairs(game.forces) do force.reset_technology_effects() end + + if settings.startup["bobmods-logistics-inserteroverhaul"].value == true and + not game.active_mods["bobinserters"] then + + script.on_event("bob-inserter-long", bobmods.logistics.check_range) + end end) script.on_init(function(event) for i, player in pairs(game.players) do bobmods.logistics.player_setup(player.index) end + + if settings.startup["bobmods-logistics-inserteroverhaul"].value == true and + not game.active_mods["bobinserters"] then + + script.on_event("bob-inserter-long", bobmods.logistics.check_range) + end end) script.on_event(defines.events.on_player_created, function(event) diff --git a/boblogistics/data.lua b/boblogistics/data.lua index 7043a5501..50c331276 100644 --- a/boblogistics/data.lua +++ b/boblogistics/data.lua @@ -5,14 +5,16 @@ if not bobmods.logistics then bobmods.logistics = {} end -data:extend({ - { - type = "custom-input", - name = "bob-inserter-long", - key_sequence = "SHIFT + L", - consuming = "none", - }, -}) +if settings.startup["bobmods-logistics-inserteroverhaul"].value == true then + data:extend({ + { + type = "custom-input", + name = "bob-inserter-long", + key_sequence = "SHIFT + L", + consuming = "none", + }, + }) +end require("prototypes.category")