Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"settings",
"rcon",
"rendering",
"global",
"storage",
"log",
"defines",
"serpent",
Expand Down
34 changes: 17 additions & 17 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ remote.add_interface("loader-redux", {
-- add loader name if it doesn't already exist
add_loader = function(name)
if name then
global.supported_loaders = global.supported_loaders or {} -- allows on_init of API subscribers be called before on_configuration_changed resets everything
global.supported_loaders[name] = true
global.supported_loader_names = {}
for k, v in pairs(global.supported_loaders) do
table.insert(global.supported_loader_names, k)
storage.supported_loaders = storage.supported_loaders or {} -- allows on_init of API subscribers be called before on_configuration_changed resets everything
storage.supported_loaders[name] = true
storage.supported_loader_names = {}
for k, v in pairs(storage.supported_loaders) do
table.insert(storage.supported_loader_names, k)
end
log("global.supported_loaders: "..serpent.block(global.supported_loaders) )
log("storage.supported_loaders: "..serpent.block(storage.supported_loaders) )
end
end,

-- remove loader name
remove_loader = function(name)
if name then
global.supported_loaders = global.supported_loaders or {} -- allows on_init of API subscribers be called before on_configuration_changed resets everything
global.supported_loaders[name] = nil
global.supported_loader_names = {}
for k, v in pairs(global.supported_loaders) do
table.insert(global.supported_loader_names, k)
storage.supported_loaders = storage.supported_loaders or {} -- allows on_init of API subscribers be called before on_configuration_changed resets everything
storage.supported_loaders[name] = nil
storage.supported_loader_names = {}
for k, v in pairs(storage.supported_loaders) do
table.insert(storage.supported_loader_names, k)
end
log("global.supported_loaders: "..serpent.block(global.supported_loaders) )
log("storage.supported_loaders: "..serpent.block(storage.supported_loaders) )
end
end
})
Expand All @@ -54,8 +54,8 @@ end)

--Snap loaders on built or correct existing loaders when building next to them.
script.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity}, function(event)
local entity = event.created_entity
if entity.type == "loader" and global.supported_loaders[entity.name] then
local entity = event.entity
if entity.type == "loader" and storage.supported_loaders[entity.name] then
if use_snapping then
snapping.snap_loader(entity, event)
end
Expand All @@ -76,7 +76,7 @@ end)
---- Bootstrap ----

function init_supported_loaders()
global.supported_loaders = {} -- clean old prototype names, API subscribers should be called afterwards
storage.supported_loaders = {} -- clean old prototype names, API subscribers should be called afterwards
remote.call("loader-redux", "add_loader", "loader")
remote.call("loader-redux", "add_loader", "fast-loader")
remote.call("loader-redux", "add_loader", "express-loader")
Expand All @@ -91,6 +91,6 @@ end)
script.on_configuration_changed(function(data)
init_supported_loaders()
-- wipe unused globals
global.wagons = nil
global.loader_wagon_map = nil
storage.wagons = nil
storage.loader_wagon_map = nil
end)
Binary file removed graphics/entity/hr-loader-base.png
Binary file not shown.
Binary file removed graphics/entity/hr-loader-front-patch.png
Binary file not shown.
Binary file removed graphics/entity/hr-loader-lights.png
Binary file not shown.
Binary file removed graphics/entity/hr-loader-mask.png
Binary file not shown.
Binary file removed graphics/entity/hr-loader-shadow.png
Binary file not shown.
Binary file modified graphics/entity/loader-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/entity/loader-front-patch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/entity/loader-lights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/entity/loader-mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/entity/loader-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "LoaderRedux",
"version": "1.9.1",
"version": "2.0.0",
"title": "Loader Redux",
"author": "Optera",
"contact": "https://forums.factorio.com/memberlist.php?mode=viewprofile&u=21729",
"homepage": "https://forums.factorio.com/viewtopic.php?f=97&t=48412",
"description": "Adds Loaders capable of snapping to belts. Graphics from Arch666Angel and Kirazy.",
"factorio_version": "1.1",
"dependencies": ["base >= 1.1.75", "flib >= 0.6.0"]
"factorio_version": "2.1",
"dependencies": ["base >= 2.0.0", "flib >= 0.6.0"]
}
Loading