Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angel's Storage Options & Mass Transit fixes #1017

Open
wants to merge 4 commits into
base: dev2.0
Choose a base branch
from
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 angelsaddons-mobility/prototypes/recipes/recipes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ if angelsmods.addons.mobility.smeltingtrain.enabled then
name = "smelting-locomotive-tender",
energy_required = 10,
enabled = false,
results = { { type = "item", name = "smelting-locomotive-tender", amound = 1 } },
results = { { type = "item", name = "smelting-locomotive-tender", amount = 1 } },
}, {
{ type = "item", name = "locomotive", amounts = { 1, 0, 0, 0, 0 } },
{ type = "item", name = "engine-unit", amounts = { 25, "+5", 0, 0, 0 } },
Expand Down
68 changes: 36 additions & 32 deletions angelsaddons-mobility/prototypes/train-functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ end
---Appends the speed cap to the `localised_description` of the given `train` prototype.
---@param train_prototype data.CargoWagonPrototype|data.FluidWagonPrototype|data.ArtilleryWagonPrototype
local function append_speed_cap_to_train_locale_description(train_prototype)
if not train_prototype then return end
if not train_prototype then
return
end

-- Convert the tile/tick speed to km/h, discarding any digits after the decimal.
local speed_cap = tostring(math.floor(train_prototype.max_speed * 216 * 100) / 100)
Expand Down Expand Up @@ -290,7 +292,7 @@ local function generate_train_recipe(ref_recipe, tiered_ingredients, technology_
add_recipe_unlock(technology_name, recipe_name)
end
else
ref_recipe.ingredients = generate_tiered_ingredients(1, ref_recipe.ingredients)
ref_recipe.ingredients = generate_tiered_ingredients(1, tiered_ingredients)
table.insert(recipes, ref_recipe)

add_recipe_unlock(technology_name, ref_recipe.name)
Expand All @@ -300,23 +302,23 @@ local function generate_train_recipe(ref_recipe, tiered_ingredients, technology_
end

local add_tier_number = mods["angelsrefining"] and angelsmods.functions.add_number_icon_layer
or function(icon_layers, number_tier, number_tint)
local icon_size_scale = ((icon_layers[1] or {}).icon_size or 32) * ((icon_layers[1] or {}).scale or 1) / 32
local new_icon_layers = table.deepcopy(icon_layers)
table.insert(new_icon_layers, {
icon = "__angelsaddons-mobility__/graphics/icons/numerals/num-" .. number_tier .. "-outline.png",
icon_size = 64,
tint = { 0, 0, 0, 255 },
scale = 0.5 * icon_size_scale,
})
table.insert(new_icon_layers, {
icon = "__angelsaddons-mobility__/graphics/icons/numerals/num-" .. number_tier .. ".png",
icon_size = 64,
tint = number_tint,
scale = 0.5 * icon_size_scale,
})
return new_icon_layers
end
or function(icon_layers, number_tier, number_tint)
local icon_size_scale = ((icon_layers[1] or {}).icon_size or 32) * ((icon_layers[1] or {}).scale or 1) / 32
local new_icon_layers = table.deepcopy(icon_layers)
table.insert(new_icon_layers, {
icon = "__angelsaddons-mobility__/graphics/icons/numerals/num-" .. number_tier .. "-outline.png",
icon_size = 64,
tint = { 0, 0, 0, 255 },
scale = 0.5 * icon_size_scale,
})
table.insert(new_icon_layers, {
icon = "__angelsaddons-mobility__/graphics/icons/numerals/num-" .. number_tier .. ".png",
icon_size = 64,
tint = number_tint,
scale = 0.5 * icon_size_scale,
})
return new_icon_layers
end

---Generates a tiered train item from the given `ref_item`.
---@param ref_item data.ItemWithEntityDataPrototype The item prototype that defines the common base item for all tiers.
Expand All @@ -339,12 +341,13 @@ local function generate_train_items(ref_item)
copy.localised_name = { "", { "item-name." .. ref_item.name }, " MK" .. i }
copy.localised_description = { "item-description." .. ref_item.name }
copy.place_result = name
copy.icons = ref_item.icons or {
{
icon = ref_item.icon,
icon_size = ref_item.icon_size,
},
}
copy.icons = ref_item.icons
or {
{
icon = ref_item.icon,
icon_size = ref_item.icon_size,
},
}
copy.icon = nil
copy.icon_size = nil
copy.icons = add_tier_number(copy.icons, i, angelsmods.addons.mobility[train_type].number_tint)
Expand Down Expand Up @@ -381,12 +384,13 @@ local function generate_train_entities(ref_entity)

copy.name = name
copy.localised_name = { "", { "entity-name." .. ref_entity.name }, " MK" .. i }
copy.icons = ref_entity.icons or {
{
icon = ref_entity.icon,
icon_size = ref_entity.icon_size,
},
}
copy.icons = ref_entity.icons
or {
{
icon = ref_entity.icon,
icon_size = ref_entity.icon_size,
},
}
copy.icon = nil
copy.icon_size = nil
copy.icons = add_tier_number(copy.icons, i, angelsmods.addons.mobility[train_type].number_tint)
Expand Down Expand Up @@ -501,7 +505,7 @@ local function update_equipment_grid(equipment_grid_name, categories_to_add, cat
for _, equipment_category in pairs(categories_to_remove) do
local index = flipped_categories[equipment_category]
if index then
categories[index] = nil
table.remove(categories, index)
end
end

Expand Down
5 changes: 5 additions & 0 deletions angelsaddons-storage/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ angelsmods.addons.storage.silos = angelsmods.addons.storage.silos or settings.st
angelsmods.addons.storage.oresilos = angelsmods.addons.storage.oresilos
or settings.startup["angels-enable-oresilos"].value

--LOAD FUNCTIONS
angelsmods.functions = angelsmods.functions or {}

-- Helper functions
require("prototypes.angels-functions")
--categories
require("prototypes.storage-categories")
--buildings
Expand Down
22 changes: 22 additions & 0 deletions angelsaddons-storage/prototypes/angels-functions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-------------------------------------------------------------------------------
-- SET ELEVATED RAIL COLLISION FOR BUILDINGS --------------------------------------------
-------------------------------------------------------------------------------
function angelsmods.functions.set_building_collision_mask(b_type, layers_to_add)
-- Function can also be used for adding other collision layers

if b_type == "asm" then
b_type = "assembling-machine"
end

local mask_util = require("__core__/lualib/collision-mask-util")

-- Default layers for buildings that elevated rails can pass over freely
local collision_mask = mask_util.get_default_mask(b_type)

-- Add elevated rail collision layer (and any other layers if applicable)
for _, layer in pairs(layers_to_add) do
collision_mask.layers[layer] = true
end

return collision_mask
end
12 changes: 6 additions & 6 deletions angelsaddons-storage/prototypes/buildings/fluid-tanks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ if angelsmods.addons.storage.pressuretank then
volume = 35000,
pipe_covers = pipecoverspictures(),
pipe_connections = {
{ position = { 0, -2.3 }, direction = defines.direction.north },
{ position = { 2.3, 0 }, direction = defines.direction.east },
{ position = { -2.3, 0 }, direction = defines.direction.west },
{ position = { 0, 2.3 }, direction = defines.direction.south },
{ position = { 0, -2 }, direction = defines.direction.north },
{ position = { 2, 0 }, direction = defines.direction.east },
{ position = { -2, 0 }, direction = defines.direction.west },
{ position = { 0, 2 }, direction = defines.direction.south },
},
},
window_bounding_box = { { -0.125, 0.6875 }, { 0.1875, 1.1875 } },
Expand Down Expand Up @@ -120,8 +120,8 @@ if angelsmods.addons.storage.inlinetank and not mods["angelspetrochem"] then
volume = 20000,
pipe_covers = pipecoverspictures(),
pipe_connections = {
{ position = { 0.5, -0.9 }, direction = defines.direction.north },
{ position = { 0.5, 0.9 }, direction = defines.direction.south },
{ position = { 0.5, -0.5 }, direction = defines.direction.north },
{ position = { 0.5, 0.5 }, direction = defines.direction.south },
},
},
window_bounding_box = { { -0.125, 0.6875 }, { 0.1875, 1.1875 } },
Expand Down
2 changes: 1 addition & 1 deletion angelsaddons-storage/prototypes/buildings/silos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if angelsmods.addons.storage.silos or angelsmods.addons.storage.oresilos then
icon = "__angelsaddons-storage__/graphics/icons/silo.png",
icon_size = 32,
flags = { "placeable-neutral", "player-creation" },
collision_mask = angelsmods.functions.set_building_collision_mask('container', {'elevated_rail'}),
collision_mask = angelsmods.functions.set_building_collision_mask("container", { "elevated_rail" }),
minable = { mining_time = 1, result = "silo" },
max_health = 300,
corpse = "small-remnants",
Expand Down
2 changes: 1 addition & 1 deletion angelsaddons-storage/prototypes/buildings/warehouses.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if angelsmods.addons.storage.warehouses then
icon = "__angelsaddons-storage__/graphics/icons/warehouse.png",
icon_size = 32,
flags = { "placeable-neutral", "player-creation" },
collision_mask = angelsmods.functions.set_building_collision_mask('container', {'elevated_rail'}),
collision_mask = angelsmods.functions.set_building_collision_mask("container", { "elevated_rail" }),
minable = { mining_time = 1, result = "angels-warehouse" },
max_health = 300,
corpse = "small-remnants",
Expand Down
10 changes: 2 additions & 8 deletions angelsaddons-storage/prototypes/overrides/silos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,11 @@ if angelsmods.addons.storage.silos then
--LOGISTICS
if mods["boblogistics"] then
else
table.insert(
data.raw.technology["logistic-silos"].unit.ingredients,
{ "utility-science-pack", 1 }
)
table.insert(data.raw.technology["logistic-silos"].unit.ingredients, { "utility-science-pack", 1 })
end

--TECHNOLOGY
if mods["bobtech"] and bobmods.tech.advanced_logistic_science then
table.insert(
data.raw.technology["logistic-silos"].unit.ingredients,
{ "advanced-logistic-science-pack", 1 }
)
table.insert(data.raw.technology["logistic-silos"].unit.ingredients, { "advanced-logistic-science-pack", 1 })
end
end
5 changes: 1 addition & 4 deletions angelsaddons-storage/prototypes/overrides/warehouses.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ if angelsmods.addons.storage.warehouses then
--LOGISTICS
if mods["boblogistics"] then
else
table.insert(
data.raw.technology["angels-logistic-warehouses"].unit.ingredients,
{ "utility-science-pack", 1 }
)
table.insert(data.raw.technology["angels-logistic-warehouses"].unit.ingredients, { "utility-science-pack", 1 })
end

--TECHNOLOGY
Expand Down
26 changes: 13 additions & 13 deletions angelsaddons-storage/prototypes/recipes/silos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if angelsmods.addons.storage.silos or angelsmods.addons.storage.oresilos then
{ type = "item", name = "steel-plate", amount = 10 },
{ type = "item", name = "stone-brick", amount = 20 },
},
results = {{ type = "item", name = "silo", amount = 1 }},
results = { { type = "item", name = "silo", amount = 1 } },
},
})
end
Expand All @@ -31,7 +31,7 @@ if angelsmods.addons.storage.oresilos then
ingredients = {
{ type = "item", name = "silo", amount = 1 },
},
results = {{ type = "item", name = "silo-ore1", amount = 1 }},
results = { { type = "item", name = "silo-ore1", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -41,7 +41,7 @@ if angelsmods.addons.storage.oresilos then
ingredients = {
{ type = "item", name = "silo", amount = 1 },
},
results = {{ type = "item", name = "silo-ore2", amount = 1 }},
results = { { type = "item", name = "silo-ore2", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -51,7 +51,7 @@ if angelsmods.addons.storage.oresilos then
ingredients = {
{ type = "item", name = "silo", amount = 1 },
},
results = {{ type = "item", name = "silo-ore3", amount = 1 }},
results = { { type = "item", name = "silo-ore3", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -61,7 +61,7 @@ if angelsmods.addons.storage.oresilos then
ingredients = {
{ type = "item", name = "silo", amount = 1 },
},
results = {{ type = "item", name = "silo-ore4", amount = 1 }},
results = { { type = "item", name = "silo-ore4", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -71,7 +71,7 @@ if angelsmods.addons.storage.oresilos then
ingredients = {
{ type = "item", name = "silo", amount = 1 },
},
results = {{ type = "item", name = "silo-ore5", amount = 1 }},
results = { { type = "item", name = "silo-ore5", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -81,7 +81,7 @@ if angelsmods.addons.storage.oresilos then
ingredients = {
{ type = "item", name = "silo", amount = 1 },
},
results = {{ type = "item", name = "silo-ore6", amount = 1 }},
results = { { type = "item", name = "silo-ore6", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -91,7 +91,7 @@ if angelsmods.addons.storage.oresilos then
ingredients = {
{ type = "item", name = "silo", amount = 1 },
},
results = {{ type = "item", name = "silo-coal", amount = 1 }},
results = { { type = "item", name = "silo-coal", amount = 1 } },
},
})
end
Expand All @@ -111,7 +111,7 @@ if angelsmods.addons.storage.silos then
{ type = "item", name = "steel-plate", amount = 10 },
{ type = "item", name = mods["angelsindustries"] and "electronic-circuit" or "advanced-circuit", amount = 10 },
},
results = {{ type = "item", name = "silo-passive-provider", amount = 1 }},
results = { { type = "item", name = "silo-passive-provider", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -123,7 +123,7 @@ if angelsmods.addons.storage.silos then
{ type = "item", name = "steel-plate", amount = 10 },
{ type = "item", name = "advanced-circuit", amount = 10 },
},
results = {{ type = "item", name = "silo-active-provider", amount = 1 }},
results = { { type = "item", name = "silo-active-provider", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -135,7 +135,7 @@ if angelsmods.addons.storage.silos then
{ type = "item", name = "steel-plate", amount = 10 },
{ type = "item", name = mods["angelsindustries"] and "electronic-circuit" or "advanced-circuit", amount = 10 },
},
results = {{ type = "item", name = "silo-requester", amount = 1 }},
results = { { type = "item", name = "silo-requester", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -147,7 +147,7 @@ if angelsmods.addons.storage.silos then
{ type = "item", name = "steel-plate", amount = 10 },
{ type = "item", name = mods["angelsindustries"] and "electronic-circuit" or "advanced-circuit", amount = 10 },
},
results = {{ type = "item", name = "silo-storage", amount = 1 }},
results = { { type = "item", name = "silo-storage", amount = 1 } },
},
{
type = "recipe",
Expand All @@ -159,7 +159,7 @@ if angelsmods.addons.storage.silos then
{ type = "item", name = "steel-plate", amount = 10 },
{ type = "item", name = "advanced-circuit", amount = 10 },
},
results = {{ type = "item", name = "silo-buffer", amount = 1 }},
results = { { type = "item", name = "silo-buffer", amount = 1 } },
},
})
end
Loading