Skip to content

Commit 045a872

Browse files
committed
Inserter length shortcut #143
1 parent a707ac0 commit 045a872

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

boblogistics/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Date: ???
44
Bugfixes:
55
- Fixed that Long-handed inserters were uncraftable when Inserter overhaul was disabled #113
66
- Fixed that techs Railway 2 and Armoured Railway could not be researched when Pyanodons Industry mod was enabled #117
7+
- Hid custom input "Change inserter long range" if setting "Inserter Overhaul" is disabled #143
78
- Fixed Inserter Entity Order #144
89
Changes:
910
- Added support for Space Exploration mod #88

boblogistics/control.lua

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,19 +357,17 @@ function bobmods.logistics.long_range(entity, player)
357357
end
358358
end
359359

360-
script.on_event("bob-inserter-long", function(event)
360+
function bobmods.logistics.check_range(event)
361361
local player = game.players[event.player_index]
362362
local entity = player.selected
363-
if
364-
not game.active_mods["bobinserters"]
365-
and entity
363+
if entity
366364
and entity.type == "inserter"
367365
and player.can_reach_entity(entity)
368366
and not global.bobmods.logistics.blacklist[entity.name]
369367
then
370368
bobmods.logistics.long_range(entity, player)
371369
end
372-
end)
370+
end
373371

374372
script.on_configuration_changed(function(event)
375373
for i, player in pairs(game.players) do
@@ -378,12 +376,24 @@ script.on_configuration_changed(function(event)
378376
for index, force in pairs(game.forces) do
379377
force.reset_technology_effects()
380378
end
379+
380+
if settings.startup["bobmods-logistics-inserteroverhaul"].value == true and
381+
not game.active_mods["bobinserters"] then
382+
383+
script.on_event("bob-inserter-long", bobmods.logistics.check_range)
384+
end
381385
end)
382386

383387
script.on_init(function(event)
384388
for i, player in pairs(game.players) do
385389
bobmods.logistics.player_setup(player.index)
386390
end
391+
392+
if settings.startup["bobmods-logistics-inserteroverhaul"].value == true and
393+
not game.active_mods["bobinserters"] then
394+
395+
script.on_event("bob-inserter-long", bobmods.logistics.check_range)
396+
end
387397
end)
388398

389399
script.on_event(defines.events.on_player_created, function(event)

boblogistics/data.lua

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ if not bobmods.logistics then
55
bobmods.logistics = {}
66
end
77

8-
data:extend({
9-
{
10-
type = "custom-input",
11-
name = "bob-inserter-long",
12-
key_sequence = "SHIFT + L",
13-
consuming = "none",
14-
},
15-
})
8+
if settings.startup["bobmods-logistics-inserteroverhaul"].value == true then
9+
data:extend({
10+
{
11+
type = "custom-input",
12+
name = "bob-inserter-long",
13+
key_sequence = "SHIFT + L",
14+
consuming = "none",
15+
},
16+
})
17+
end
1618

1719
require("prototypes.category")
1820

0 commit comments

Comments
 (0)