Skip to content

Commit

Permalink
Inserter length shortcut #143
Browse files Browse the repository at this point in the history
  • Loading branch information
KiwiHawk committed Dec 20, 2023
1 parent a707ac0 commit 045a872
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
1 change: 1 addition & 0 deletions boblogistics/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 15 additions & 5 deletions boblogistics/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
18 changes: 10 additions & 8 deletions boblogistics/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 045a872

Please sign in to comment.