Skip to content

Commit

Permalink
Add stack inserter
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Oct 18, 2024
1 parent 10ad83d commit 75fcd76
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 21 deletions.
1 change: 1 addition & 0 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ acetylene=Acetylene
molten-glass=Molten glass
[entity-name]
py-stack-inserter=Stack inserter
distilator=Destructive distillation column MK 01
distilator-mk02=Destructive distillation column MK 02
distilator-mk03=Destructive distillation column MK 03
Expand Down
138 changes: 117 additions & 21 deletions prototypes/technologies/stacking-belts.lua
Original file line number Diff line number Diff line change
@@ -1,53 +1,149 @@
if not feature_flags.space_travel then return end

local MAX_BELT_STACK = 8

data.raw["utility-constants"].default.max_belt_stack_size = MAX_BELT_STACK

for _, stackable_prototype in pairs {"loader-1x1", "loader", "inserter"} do
for _, stackable in pairs(data.raw[stackable_prototype]) do
stackable.max_belt_stack_size = stackable.max_belt_stack_size or 1
if stackable.max_belt_stack_size ~= 1 then
stackable.max_belt_stack_size = MAX_BELT_STACK
end
end
end

for _, miner in pairs(data.raw["mining-drill"]) do
miner.drops_full_belt_stacks = true
end

local science_packs_that_unlock_belt_stacking = {
"py-science-pack-mk01",
"logistic-science-pack",
"py-science-pack-mk02",
"chemical-science-pack",
"py-science-pack-mk03",
"production-science-pack",
"py-science-pack-mk04",
"utility-science-pack",
["logistic-science-pack"] = "logistic-science-pack",
["py-science-pack-mk02"] = "py-science-pack-2",
["chemical-science-pack"] = "chemical-science-pack",
["py-science-pack-mk03"] = "py-science-pack-3",
["production-science-pack"] = "production-science-pack",
["py-science-pack-mk04"] = "py-science-pack-4",
["utility-science-pack"] = "utility-science-pack",
}

data:extend {py.merge(data.raw.inserter["bulk-inserter"], {
name = "py-stack-inserter",
wait_for_full_hand = true,
enter_drop_mode_if_held_stack_spoiled = true,
max_belt_stack_size = MAX_BELT_STACK,
use_easter_egg = false,
stack_size_bonus = (data.raw.inserter["bulk-inserter"].stack_size_bonus or 0) + 12,
hand_size = 2.25,
insert_position = {0, 1.7},
pickup_position = {0, -1.5},
collision_box = {{-0.15, -0.65}, {0.15, 0.65}},
selection_box = {{-0.4, -0.9}, {0.4, 0.9}},
energy_per_movement = "100kJ",
energy_per_rotation = "100kJ",
energy_source = {
type = "electric",
usage_priority = "secondary-input"
},
rotation_speed = data.raw.inserter.inserter.rotation_speed,
minable = {
mining_time = 0.2,
result = "py-stack-inserter"
},
platform_picture = {sheet = {
filename = "__pycoalprocessinggraphics__/graphics/entity/stack-inserter/stack-inserter-platform.png",
height = 79,
priority = "extra-high",
scale = 0.5,
shift = {0.046875, 0.203125},
width = 105
}},
hand_open_picture = {
filename = "__pycoalprocessinggraphics__/graphics/entity/stack-inserter/stack-inserter-hand-open.png",
height = 164,
priority = "extra-high",
scale = 0.5,
width = 72
},
hand_closed_picture = {
filename = "__pycoalprocessinggraphics__/graphics/entity/stack-inserter/stack-inserter-hand-closed.png",
height = 164,
priority = "extra-high",
scale = 0.5,
width = 72
},
hand_base_picture = {
filename = "__pycoalprocessinggraphics__/graphics/entity/stack-inserter/stack-inserter-hand-base.png",
height = 136,
priority = "extra-high",
scale = 0.5,
width = 32
},
fast_replaceable_group = "nil",
next_upgrade = "nil",
icon = "__pycoalprocessinggraphics__/graphics/icons/stack-inserter.png",
icon_size = 64
})}

ITEM {
icon = "__pycoalprocessinggraphics__/graphics/icons/stack-inserter.png",
icon_size = 64,
name = "py-stack-inserter",
place_result = "py-stack-inserter",
order = "h[stack-inserter]",
stack_size = 50,
subgroup = "inserter",
type = "item"
}

RECIPE {
type = "recipe",
name = "py-stack-inserter",
enabled = false,
result = "py-stack-inserter",
ingredients = {
{type = "item", name = "py-stack-inserter", amount = 1},
}
}

local i = 1
for _, science in pairs(science_packs_that_unlock_belt_stacking) do
for science, pack in pairs(science_packs_that_unlock_belt_stacking) do
if not data.raw.technology[science] then goto continue end

local prerequisites = {science}
if i > 1 then
prerequisites = {"transport-belt-capacity-" .. (i - 1)}
prerequisites = {science, "py-transport-belt-capacity-" .. (i - 1)}
end

local tech = {
type = "technology",
name = "transport-belt-capacity-" .. i,
name = "py-transport-belt-capacity-" .. i,
localised_name = {"technology-name.transport-belt-capacity"},
localised_description = {"technology-description.belt-capacity"},
icons = util.technology_icon_constant_stack_size("__pycoalprocessinggraphics__/graphics/technology/transport-belt-capacity.png"),
effects = {
{
type = "belt-stack-size-bonus",
modifier = 1
}
},
effects = {{
type = "belt-stack-size-bonus",
modifier = 1
}},
prerequisites = prerequisites,
unit = {
count = 2000,
ingredients =
{
{science, 1}
ingredients = {
{pack, 1}
},
time = 60
},
upgrade = true
}

data:extend{tech}
if i == 1 then
table.insert(tech.effects, {
type = "unlock-recipe",
recipe = "py-stack-inserter"
})
end

data:extend {tech}
i = i + 1

::continue::
Expand Down

0 comments on commit 75fcd76

Please sign in to comment.