Skip to content

Commit

Permalink
Updated for Factorio 2.0. (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
Synthlight authored Nov 11, 2024
1 parent ac47853 commit 6a02c75
Show file tree
Hide file tree
Showing 21 changed files with 145 additions and 225 deletions.
10 changes: 10 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
---------------------------------------------------------------------------------------------------
Version: 2.5.0
Date: 23. 10. 2024
Changes:
- Updated for Factorio 2.0.
- Added compatibility with Space Age, a 4th tier of loaders/beltboxes will be added if Space Age is active.
- Turbo loaders/beltboxes are NOT localized in other langs, only Eng.
- Removed the 'low' graphics as `hr_version` as the low/high split has been removed from the game.
- Not everything tested, but made sure loaders/beltboxes work.
- Migrations untested. I wouldn't recommend using an old save in 2.0 in the first place.
---------------------------------------------------------------------------------------------------
Version: 2.4.2
Date: 09. 05. 2021
Changes:
Expand Down
10 changes: 5 additions & 5 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ end
-- else if there's an inventory ahead but not behind, turn around and switch mode
-- else if no inventories and a belt ahead, turn around; also switch mode if belt is facing towards
local function on_built_entity(event)
local built = event.created_entity
local built = event.entity
-- invalid build? don't bother with faked "revived" property from pre-1.0 Nanobots/Bluebuild, those shenanigans can only be passed in script_raised_* events now
-- also no need to check entity type since we can filter for it on the event handler
-- also no need to check entity type since we can filter for it on the event handler
if not built or not built.valid then return end
local snap2inv = settings.get_player_settings(game.players[event.player_index])["deadlock-loaders-snap-to-inventories"].value
local snap2belt = settings.get_player_settings(game.players[event.player_index])["deadlock-loaders-snap-to-belts"].value
Expand Down Expand Up @@ -114,7 +114,7 @@ local function auto_unstack(item_name, item_count, sending_inventory, receiving_
local add_count = STACK_SIZE
-- if the base item's stack size is lower than the configured STACK_SIZE then
-- this should reward the lower of the two
local prototype = game.item_prototypes[string.sub(item_name, 16)]
local prototype = prototypes.item[string.sub(item_name, 16)]
if STACK_SIZE > prototype.stack_size then
add_count = prototype.stack_size
end
Expand Down Expand Up @@ -197,8 +197,8 @@ local function on_configuration_changed(config)
for tech_name, tech_table in pairs(force.technologies) do
if tech_table.researched then
-- find any beltboxes or loaders or stacks in effects and unlock
for _, effect_table in ipairs(tech_table.effects) do
if effect_table.type == "unlock-recipe" and (string.find(game.recipe_prototypes[effect_table.recipe].order, "%-deadlock%-") or string.find(game.recipe_prototypes[effect_table.recipe].name, "deadlock%-")) then
for _, effect_table in ipairs(tech_table.prototype.effects) do
if effect_table.type == "unlock-recipe" and (string.find(prototypes.recipe[effect_table.recipe].order, "%-deadlock%-") or string.find(prototypes.recipe[effect_table.recipe].name, "deadlock%-")) then
force.recipes[effect_table.recipe].enabled = true
end
end
Expand Down
Binary file removed graphics/entities/low/beltbox-base.png
Binary file not shown.
Binary file removed graphics/entities/low/beltbox-mask.png
Binary file not shown.
Binary file removed graphics/entities/low/beltbox-shadow.png
Binary file not shown.
Binary file removed graphics/entities/low/beltbox-working.png
Binary file not shown.
Binary file removed graphics/entities/low/loader-back.png
Binary file not shown.
Binary file removed graphics/entities/low/loader-base.png
Binary file not shown.
Binary file removed graphics/entities/low/loader-mask.png
Binary file not shown.
Binary file removed graphics/entities/low/loader-shadow.png
Binary file not shown.
Binary file added graphics/icons/square/stacked-tungsten-ore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "deadlock-beltboxes-loaders",
"version": "2.4.2",
"version": "2.5.0",
"title": "Deadlock's Stacking Beltboxes & Compact Loaders",
"author": "Deadlock989, Shane Madden",
"author": "Deadlock989, Shane Madden, MasterBuilder",
"homepage": "https://forums.factorio.com/viewtopic.php?f=94&t=57264",
"dependencies": [
"base >= 1.1",
"? ReStack"
"base >= 2.0",
"? ReStack",
"? space-age"
],
"description": "Adds minimalist 1x1 loaders and stacking beltboxes for 5x belt compression for ores, plates and some intermediate products",
"factorio_version": "1.1"
"factorio_version": "2.0"
}
2 changes: 2 additions & 0 deletions locale/en/deadlock-beltboxes-loaders.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
transport-belt-loader=Compact loader
fast-transport-belt-loader=Fast compact loader
express-transport-belt-loader=Express compact loader
turbo-transport-belt-loader=Turbo compact loader
transport-belt-beltbox=Stacking beltbox
fast-transport-belt-beltbox=Fast stacking beltbox
express-transport-belt-beltbox=Express stacking beltbox
turbo-transport-belt-beltbox=Turbo stacking beltbox

[entity-description]
deadlock-loader=Quickly transfers resources between belts and inventories. Rotate after placement to change input/output mode.
Expand Down
2 changes: 1 addition & 1 deletion migrations/deadlock-beltboxes-loaders_2.0.2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ for _, force in pairs(game.forces) do
force.reset_technologies()
for tech_name, technology in pairs(force.technologies) do
if technology.researched then
for _, effect in pairs(technology.effects) do
for _, effect in pairs(technology.prototype.effects) do
if effect.type == "unlock-recipe" then
force.recipes[effect.recipe].enabled = true
end
Expand Down
2 changes: 1 addition & 1 deletion migrations/logistics-recipes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ for _, force in pairs(game.forces) do
force.reset_technologies()
for tech_name, technology in pairs(force.technologies) do
if technology.researched then
for _, effect in pairs(technology.effects) do
for _, effect in pairs(technology.prototype.effects) do
if effect.type == "unlock-recipe" then
force.recipes[effect.recipe].enabled = true
end
Expand Down
80 changes: 19 additions & 61 deletions prototypes/create_beltbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ local function create_beltbox_entity(tier_table)
icon_size = 64,
icon_mipmaps = 4,
flags = { "placeable-neutral", "placeable-player", "player-creation" },
animation = {
layers = {
{
hr_version = {
graphics_set = {
animation = {
layers = {
{
filename = "__deadlock-beltboxes-loaders__/graphics/entities/high/beltbox-base.png",
animation_speed = 1 / crafting_speed,
priority = "high",
Expand All @@ -33,18 +33,7 @@ local function create_beltbox_entity(tier_table)
shift = {0, 0},
width = 96
},
filename = "__deadlock-beltboxes-loaders__/graphics/entities/low/beltbox-base.png",
animation_speed = 1 / crafting_speed,
priority = "high",
frame_count = 60,
line_length = 10,
height = 48,
scale = 1,
shift = {0, 0},
width = 48
},
{
hr_version = {
{
filename = "__deadlock-beltboxes-loaders__/graphics/entities/high/beltbox-mask.png",
animation_speed = 1 / crafting_speed,
priority = "high",
Expand All @@ -55,18 +44,7 @@ local function create_beltbox_entity(tier_table)
width = 96,
tint = tier_table.colour,
},
filename = "__deadlock-beltboxes-loaders__/graphics/entities/low/beltbox-mask.png",
animation_speed = 1 / crafting_speed,
priority = "high",
repeat_count = 60,
height = 48,
scale = 1,
shift = {0, 0},
width = 48,
tint = tier_table.colour,
},
{
hr_version = {
{
draw_as_shadow = true,
filename = "__deadlock-beltboxes-loaders__/graphics/entities/high/beltbox-shadow.png",
animation_speed = 1 / crafting_speed,
Expand All @@ -77,22 +55,11 @@ local function create_beltbox_entity(tier_table)
shift = {0.5, 0},
width = 144
},
draw_as_shadow = true,
filename = "__deadlock-beltboxes-loaders__/graphics/entities/low/beltbox-shadow.png",
animation_speed = 1 / crafting_speed,
frame_count = 60,
line_length = 10,
height = 48,
scale = 1,
shift = {0.5, 0},
width = 72
},
},
},
working_visualisations = {
{
animation = {
hr_version = {
working_visualisations = {
{
animation = {
animation_speed = 1 / crafting_speed,
blend_mode = "additive",
filename = "__deadlock-beltboxes-loaders__/graphics/entities/high/beltbox-working.png",
Expand All @@ -104,23 +71,14 @@ local function create_beltbox_entity(tier_table)
tint = brighter_colour(tier_table.colour),
width = 96
},
animation_speed = 1 / crafting_speed,
blend_mode = "additive",
filename = "__deadlock-beltboxes-loaders__/graphics/entities/low/beltbox-working.png",
frame_count = 30,
line_length = 10,
height = 48,
priority = "high",
tint = tier_table.colour,
width = 48
},
light = {
color = brighter_colour(tier_table.colour),
intensity = 0.4,
size = 3,
shift = {0, 0.25},
light = {
color = brighter_colour(tier_table.colour),
intensity = 0.4,
size = 3,
shift = {0, 0.25},
},
},
},
}
},
dying_explosion = "explosion",
corpse = "small-remnants",
Expand All @@ -138,7 +96,7 @@ local function create_beltbox_entity(tier_table)
crafting_speed = crafting_speed,
energy_source = {
type = "electric",
emissions_per_minute = 3 * 0.03125 / data.raw["transport-belt"][tier_table.transport_belt].speed,
emissions_per_minute = {pollution = 3 * 0.03125 / data.raw["transport-belt"][tier_table.transport_belt].speed},
usage_priority = "secondary-input",
drain = "15kW",
},
Expand All @@ -150,7 +108,7 @@ local function create_beltbox_entity(tier_table)
percent = 50
},
},
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 1.0 },
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 1.0 },
working_sound = {
match_speed_to_activity = true,
idle_sound = {
Expand Down Expand Up @@ -205,7 +163,7 @@ local function create_beltbox_recipe(tier_table)
order = string.format("b%s%s", (tier_table.order or tier_table.loader), "-deadlock-beltbox"),
enabled = false,
ingredients = tier_table.beltbox_ingredients,
result = tier_table.beltbox_item or tier_table.beltbox,
results = {{type = "item", name = tier_table.beltbox_item or tier_table.beltbox, amount = 1}},
energy_required = 3.0,
}
if not tier_table.beltbox_technology then
Expand Down
Loading

0 comments on commit 6a02c75

Please sign in to comment.