Remove wooden rails again

This commit is contained in:
Simon Brodtmann 2026-02-24 22:22:01 +01:00
parent 1eba1804d7
commit da1eb4d222
6 changed files with 31 additions and 899 deletions

View file

@ -753,54 +753,7 @@ if BI.Settings.BI_Game_Tweaks_Recipe then
if data.raw.item["stone-crushed"] then
thxbob.lib.recipe.remove_ingredient("rail", "stone")
thxbob.lib.recipe.add_new_ingredient("rail", { type = "item", name = "stone-crushed", amount = 6 })
thxbob.lib.recipe.remove_ingredient("bi-rail-wood", "stone")
thxbob.lib.recipe.add_new_ingredient("bi-rail-wood", { type = "item", name = "stone-crushed", amount = 6 })
end
-- vanilla rail update
--- Recipe
thxbob.lib.recipe.remove_ingredient("rail", "iron-stick")
thxbob.lib.recipe.add_new_ingredient("rail", { type = "item", name = "concrete", amount = 2 })
data.raw["legacy-straight-rail"]["legacy-straight-rail"].icon = ICONPATH_E .. "rail-concrete.png"
data.raw["straight-rail"]["straight-rail"].icon = ICONPATH_E .. "rail-concrete.png"
--- Wood Rail added to Tech
thxbob.lib.tech.add_recipe_unlock("railway", "bi-rail-wood")
thxbob.lib.tech.add_recipe_unlock("railway", "bi-rail-wood-to-concrete")
--- Update Vanilla Images - Look more like concrete
require("prototypes.Wood_Products.rail-pictures-vanilla")
data.raw["straight-rail"]["straight-rail"].pictures = new_rail_pictures_vanilla("straight")
data.raw["half-diagonal-rail"]["half-diagonal-rail"].pictures = new_rail_pictures_vanilla("half-diagonal")
data.raw["curved-rail-a"]["curved-rail-a"].pictures = new_rail_pictures_vanilla("curved-a")
data.raw["curved-rail-b"]["curved-rail-b"].pictures = new_rail_pictures_vanilla("curved-b")
--- remnants
data.raw["rail-remnants"]["straight-rail-remnants"].pictures = new_rail_remnants_pictures_vanilla("straight")
data.raw["rail-remnants"]["half-diagonal-rail-remnants"].pictures = new_rail_remnants_pictures_vanilla("half-diagonal")
data.raw["rail-remnants"]["curved-rail-a-remnants"].pictures = new_rail_remnants_pictures_vanilla("curved-a")
data.raw["rail-remnants"]["curved-rail-b-remnants"].pictures = new_rail_remnants_pictures_vanilla("curved-b")
--- Let me try and remove decoratives at the same time
data.raw["rail-planner"]["rail"].remove_decoratives = "true"
data.raw["straight-rail"]["straight-rail"].remove_decoratives = "true"
data.raw["half-diagonal-rail"]["half-diagonal-rail"].remove_decoratives = "true"
data.raw["curved-rail-a"]["curved-rail-a"].remove_decoratives = "true"
data.raw["curved-rail-b"]["curved-rail-b"].remove_decoratives = "true"
data.raw["rail-planner"]["rail"].removes_soft_decoratives = true
data.raw["straight-rail"]["straight-rail"].removes_soft_decoratives = true
data.raw["half-diagonal-rail"]["half-diagonal-rail"].removes_soft_decoratives = true
data.raw["curved-rail-a"]["curved-rail-a"].removes_soft_decoratives = true
data.raw["curved-rail-b"]["curved-rail-b"].removes_soft_decoratives = true
data.raw["rail-planner"]["bi-rail-wood"].remove_decoratives = "true"
data.raw["straight-rail"]["bi-straight-rail-wood"].remove_decoratives = "true"
data.raw["half-diagonal-rail"]["bi-half-diagonal-rail-wood"].remove_decoratives = "true"
data.raw["curved-rail-a"]["bi-curved-rail-a-wood"].remove_decoratives = "true"
data.raw["curved-rail-b"]["bi-curved-rail-b-wood"].remove_decoratives = "true"
data.raw["rail-planner"]["bi-rail-wood"].removes_soft_decoratives = true
data.raw["straight-rail"]["bi-straight-rail-wood"].removes_soft_decoratives = true
data.raw["half-diagonal-rail"]["bi-half-diagonal-rail-wood"].removes_soft_decoratives = true
data.raw["curved-rail-a"]["bi-curved-rail-a-wood"].removes_soft_decoratives = true
data.raw["curved-rail-b"]["bi-curved-rail-b-wood"].removes_soft_decoratives = true
end

View file

@ -69,7 +69,6 @@ require("prototypes.Wood_Products.recipe")
require("prototypes.Wood_Products.containers-entities")
require("prototypes.Wood_Products.containers-item")
require("prototypes.Wood_Products.containers-recipe")
require("prototypes.Wood_Products.rail")
if not mods["Natural_Evolution_Buildings"] then

View file

@ -5,7 +5,7 @@ local ICONPATH = BioInd.modRoot .. "/graphics/icons/"
log("BI.Settings.BI_Game_Tweaks_Disassemble: " .. tostring(BI.Settings.BI_Game_Tweaks_Disassemble))
if BI.Settings.BI_Game_Tweaks_Disassemble then
log("Enabling disassemble recipes!")
log("Enabling disassemble recipes!")
--- Bio Tweaks
data:extend({
-- Item subgroup
@ -20,8 +20,8 @@ if BI.Settings.BI_Game_Tweaks_Disassemble then
{
type = "recipe",
name = "bi-burner-mining-drill-disassemble",
localised_description = { "recipe-description.bi-disassemble-recipes" },
icons = { { icon = ICONPATH .. "burner-mining-drill_disassemble.png", icon_size = 64, } },
localised_description = {"recipe-description.bi-disassemble-recipes"},
icons = { {icon = ICONPATH .. "burner-mining-drill_disassemble.png", icon_size = 64, } },
category = "advanced-crafting",
subgroup = "bio-disassemble",
order = "a[Disassemble]-a[bi-burner-mining-drill-disassemble]",
@ -31,19 +31,20 @@ if BI.Settings.BI_Game_Tweaks_Disassemble then
allow_decomposition = false,
energy_required = 2,
ingredients = {
{ type = "item", name = "burner-mining-drill", amount = 1 },
{type = "item", name = "burner-mining-drill", amount = 1},
},
results = {
{ type = "item", name = "stone", amount = 4 },
{ type = "item", name = "iron-plate", amount = 4 }
{type="item", name="stone", amount=4},
{type="item", name="iron-plate", amount=4}
},
main_product = "",
},
----
{
type = "recipe",
name = "bi-burner-inserter-disassemble",
localised_description = { "recipe-description.bi-disassemble-recipes" },
icons = { { icon = ICONPATH .. "burner_inserter_disassemble.png", icon_size = 64, } },
localised_description = {"recipe-description.bi-disassemble-recipes"},
icons = { {icon = ICONPATH .. "burner_inserter_disassemble.png", icon_size = 64, } },
category = "advanced-crafting",
subgroup = "bio-disassemble",
order = "a[Disassemble]-b[bi-burner-inserter-disassemble]",
@ -53,18 +54,19 @@ if BI.Settings.BI_Game_Tweaks_Disassemble then
allow_decomposition = false,
energy_required = 2,
ingredients = {
{ type = "item", name = "burner-inserter", amount = 1 },
{type = "item", name = "burner-inserter", amount = 1},
},
results = {
{ type = "item", name = "iron-plate", amount = 2 },
{type="item", name="iron-plate", amount=2},
},
main_product = "",
},
----
{
type = "recipe",
name = "bi-long-handed-inserter-disassemble",
localised_description = { "recipe-description.bi-disassemble-recipes" },
icons = { { icon = ICONPATH .. "long_handed_inserter_disassemble.png", icon_size = 64, } },
localised_description = {"recipe-description.bi-disassemble-recipes"},
icons = { {icon = ICONPATH .. "long_handed_inserter_disassemble.png", icon_size = 64, } },
category = "advanced-crafting",
subgroup = "bio-disassemble",
order = "a[Disassemble]-c[bi-long-handed-inserter-disassemble]",
@ -74,20 +76,21 @@ if BI.Settings.BI_Game_Tweaks_Disassemble then
allow_decomposition = false,
energy_required = 2,
ingredients = {
{ type = "item", name = "long-handed-inserter", amount = 1 },
{type = "item", name = "long-handed-inserter", amount = 1},
},
results = {
{ type = "item", name = "iron-gear-wheel", amount = 1 },
{ type = "item", name = "iron-plate", amount = 1 },
{ type = "item", name = "electronic-circuit", amount = 1 },
{type="item", name="iron-gear-wheel", amount=1},
{type="item", name="iron-plate", amount=1},
{type="item", name="electronic-circuit", amount=1},
},
main_product = "",
},
---
{
type = "recipe",
name = "bi-stone-furnace-disassemble",
localised_description = { "recipe-description.bi-disassemble-recipes" },
icons = { { icon = ICONPATH .. "stone_furnace_disassemble.png", icon_size = 64, } },
localised_description = {"recipe-description.bi-disassemble-recipes"},
icons = { {icon = ICONPATH .. "stone_furnace_disassemble.png", icon_size = 64, } },
category = "advanced-crafting",
subgroup = "bio-disassemble",
order = "a[Disassemble]-d[bi-stone-furnace-disassemble]",
@ -97,18 +100,19 @@ if BI.Settings.BI_Game_Tweaks_Disassemble then
allow_decomposition = false,
energy_required = 2,
ingredients = {
{ type = "item", name = "stone-furnace", amount = 1 },
{type = "item", name = "stone-furnace", amount = 1},
},
results = {
{ type = "item", name = "stone", amount = 3 },
{type="item", name="stone", amount=3},
},
main_product = "",
},
---
{
type = "recipe",
name = "bi-steel-furnace-disassemble",
localised_description = { "recipe-description.bi-disassemble-recipes" },
icons = { { icon = ICONPATH .. "steel-furnace_disassemble.png", icon_size = 64, } },
localised_description = {"recipe-description.bi-disassemble-recipes"},
icons = { {icon = ICONPATH .. "steel-furnace_disassemble.png", icon_size = 64, } },
category = "advanced-crafting",
subgroup = "bio-disassemble",
order = "a[Disassemble]-e[bi-steel-furnace-disassemble]",
@ -118,38 +122,14 @@ if BI.Settings.BI_Game_Tweaks_Disassemble then
allow_decomposition = false,
energy_required = 2,
ingredients = {
{ type = "item", name = "steel-furnace", amount = 1 },
{type = "item", name = "steel-furnace", amount = 1},
},
results = {
{ type = "item", name = "steel-plate", amount = 4 },
{ type = "item", name = "stone-brick", amount = 4 }
{type="item", name="steel-plate", amount=4},
{type="item", name="stone-brick", amount=4}
},
main_product = "",
},
})
end
local SET = settings.startup["BI_Game_Tweaks_Production_Science"].value
if SET and not mods["Krastorio2"] then
data:extend({
{
type = "recipe",
name = "bi-production-science-pack",
enabled = false,
energy_required = 21,
ingredients = {
{ type = "item", name = "electric-furnace", amount = 1 },
{ type = "item", name = "productivity-module", amount = 1 },
{ type = "item", name = "bi-rail-wood", amount = 40 }
},
results = { { type = "item", name = "production-science-pack", amount = 3 } },
},
})
--~ BI_Functions.lib.allow_productivity("bi-production-science-pack")
--~ thxbob.lib.tech.add_recipe_unlock("production-science-pack", "bi-production-science-pack")
BioInd.writeDebug("Added alternative recipe for Production science packs.")
else
BioInd.writeDebug("Didn't add alternative recipe for Production science packs! (\"Krastorio\": %s\tSetting: %s",
{ (mods["Krastorio2"] and "active" or "not active"), (SET and "enabled" or "disabled") })
end

View file

@ -1,267 +0,0 @@
local util = require("util")
local ground_rail_render_layers =
{
stone_path_lower = "rail-stone-path-lower",
stone_path = "rail-stone-path",
tie = "rail-tie",
screw = "rail-screw",
metal = "rail-metal"
}
local rail_segment_visualisation_endings =
{
filename = "__base__/graphics/entity/rails/rail/rail-segment-visualisations-endings.png",
priority = "extra-high",
flags = { "low-object" },
width = 64,
height = 64,
scale = 0.5,
direction_count = 16,
frame_count = 6,
usage = "rail"
}
local function make_new_rail_pictures(keys, elems, max_variations)
local function make_sprite_definition(filename, elem, key, variation_count)
return
{
filename = filename,
priority = elem.priority or "extra-high",
flags = elem.mipmap and { "trilinear-filtering" } or { "low-object" },
draw_as_shadow = elem.draw_as_shadow,
allow_forced_downscale = elem.allow_forced_downscale,
width = key[3][1],
height = key[3][2],
x = key[2][1],
y = key[2][2],
scale = 0.5;
shift = util.by_pixel(key[4][1], key[4][2]),
variation_count = variation_count,
usage = "rail"
}
end
local res = {}
for _ , key in ipairs(keys) do
local part = {}
local variation_count = key[5] or 1
if max_variations then
variation_count = math.min(variation_count, max_variations)
end
if (variation_count > 0) then
for _ , elem in ipairs(elems) do
local layers = nil
local variations = variation_count;
if (elem[1] == "segment_visualisation_middle") then
variations = nil
end
if (type(elem[2]) == "table") then
layers = { layers = {} }
for _, subelem in ipairs(elem[2]) do
table.insert(layers.layers, make_sprite_definition(subelem[1], subelem, key, variations))
end
else
layers = make_sprite_definition(elem[2], elem, key, variations)
end
if (elem[1] ~= nil) then
part[elem[1]] = layers
else
part = layers
end
end
end
res[key[1]] = part
end
return res
end
function new_rail_pictures_vanilla(rail_type)
local keys
local NOT_USED_POSITION = {0, 0}
local NOT_USED_SIZE = {1, 1}
local NOT_USED_SHIFT = {0, 0}
if rail_type == "straight" then
keys =
{
{"north", { 0, 256 }, {256, 256}, {0,0}, 8},
{"northeast", { 0, 2048 }, {384, 384}, {0,0}, 3},
{"east", { 0, 0 }, {256, 256}, {0,0}, 8},
{"southeast", { 0, 896 }, {384, 384}, {0,0}, 3},
{"south", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"southwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"west", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"northwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0}
}
elseif rail_type == "half-diagonal" then
keys =
{
{"north", { 0, 1280 }, {384, 384}, {0,0}, 3},
{"northeast", { 0, 1664 }, {384, 384}, {0,0}, 3},
{"east", { 0, 2432 }, {384, 384}, {0,0}, 3},
{"southeast", { 0, 512 }, {384, 384}, {0,0}, 3},
{"south", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"southwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"west", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"northwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0}
}
elseif rail_type == "curved-a" then
keys =
{
{"north", { 2048, 3 * 512 }, {512, 512}, {0,0}, 4},-- piece 04
{"northeast", { 2048, 12 * 512 }, {512, 512}, {0,0}, 4},-- piece 13
{"east", { 2048, 7 * 512 }, {512, 512}, {0,0}, 4},-- piece 08
{"southeast", { 2048, 0 * 512 }, {512, 512}, {0,0}, 4},-- piece 01
{"south", { 2048, 11 * 512 }, {512, 512}, {0,0}, 4},-- piece 12
{"southwest", { 2048, 4 * 512 }, {512, 512}, {0,0}, 4},-- piece 05
{"west", { 2048, 15 * 512 }, {512, 512}, {0,0}, 4},-- piece 16
{"northwest", { 2048, 8 * 512 }, {512, 512}, {0,0}, 4},-- piece 09
}
elseif rail_type == "curved-b" then
keys =
{
{"north", { 2048, 2 * 512 }, {512, 512}, {0,0}, 4},-- piece 03
{"northeast", { 2048, 13 * 512 }, {512, 512}, {0,0}, 4},-- piece 14
{"east", { 2048, 6 * 512 }, {512, 512}, {0,0}, 4},-- piece 07
{"southeast", { 2048, 1 * 512 }, {512, 512}, {0,0}, 4},-- piece 02
{"south", { 2048, 10 * 512 }, {512, 512}, {0,0}, 4},-- piece 11
{"southwest", { 2048, 5 * 512 }, {512, 512}, {0,0}, 4},-- piece 06
{"west", { 2048, 14 * 512 }, {512, 512}, {0,0}, 4},-- piece 15
{"northwest", { 2048, 9 * 512 }, {512, 512}, {0,0}, 4},-- piece 10
}
end
local elems =
{
{ "metals", "__base__/graphics/entity/rails/rail/rail-metals.png", mipmap = true },
{ "backplates", "__base__/graphics/entity/rails/rail/rail-backplates.png", mipmap = true },
{ "ties", "__Bio_Industries_2__/graphics/entities/wood_products/rails/new_rail/rail-ties-concrete.png" },
{ "stone_path", "__base__/graphics/entity/rails/rail/rail-stone-path-inside.png" },
{ "stone_path_background", "__base__/graphics/entity/rails/rail/rail-stone-path.png" },
{ "segment_visualisation_middle", "__base__/graphics/entity/rails/rail/rail-segment-visualisations-middle.png" },
}
local res = make_new_rail_pictures(keys, elems)
res["rail_endings"] =
{
sheets =
{
{
filename = "__base__/graphics/entity/rails/rail/rail-endings-background.png",
priority = "high",
flags = { "low-object" },
width = 256,
height = 256,
scale = 0.5,
usage = "rail"
},
{
filename = "__base__/graphics/entity/rails/rail/rail-endings-foreground.png",
priority = "high",
flags = { "trilinear-filtering" },
width = 256,
height = 256,
scale = 0.5,
usage = "rail"
}
}
}
res["render_layers"] = ground_rail_render_layers
res["segment_visualisation_endings"] = rail_segment_visualisation_endings
return res
end
function new_rail_remnants_pictures_vanilla(rail_type)
local keys
local NOT_USED_POSITION = {0, 0}
local NOT_USED_SIZE = {1, 1}
local NOT_USED_SHIFT = {0, 0}
if rail_type == "straight" then
keys =
{
{"north", { 0, 256 }, {256, 256}, {0,0}, 8},
{"northeast", { 0, 2048 }, {384, 384}, {0,0}, 3},
{"east", { 0, 0 }, {256, 256}, {0,0}, 8},
{"southeast", { 0, 896 }, {384, 384}, {0,0}, 3},
{"south", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"southwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"west", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"northwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0}
}
elseif rail_type == "half-diagonal" then
keys =
{
{"north", { 0, 1280 }, {384, 384}, {0,0}, 3},
{"northeast", { 0, 1664 }, {384, 384}, {0,0}, 3},
{"east", { 0, 2432 }, {384, 384}, {0,0}, 3},
{"southeast", { 0, 512 }, {384, 384}, {0,0}, 3},
{"south", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"southwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"west", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"northwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0}
}
elseif rail_type == "curved-a" then
keys =
{
{"north", { 2048, 3 * 512 }, {512, 512}, {0,0}, 4},-- piece 04
{"northeast", { 2048, 12 * 512 }, {512, 512}, {0,0}, 4},-- piece 13
{"east", { 2048, 7 * 512 }, {512, 512}, {0,0}, 4},-- piece 08
{"southeast", { 2048, 0 * 512 }, {512, 512}, {0,0}, 4},-- piece 01
{"south", { 2048, 11 * 512 }, {512, 512}, {0,0}, 4},-- piece 12
{"southwest", { 2048, 4 * 512 }, {512, 512}, {0,0}, 4},-- piece 05
{"west", { 2048, 15 * 512 }, {512, 512}, {0,0}, 4},-- piece 16
{"northwest", { 2048, 8 * 512 }, {512, 512}, {0,0}, 4},-- piece 09
}
elseif rail_type == "curved-b" then
keys =
{
{"north", { 2048, 2 * 512 }, {512, 512}, {0,0}, 4},-- piece 03
{"northeast", { 2048, 13 * 512 }, {512, 512}, {0,0}, 4},-- piece 14
{"east", { 2048, 6 * 512 }, {512, 512}, {0,0}, 4},-- piece 07
{"southeast", { 2048, 1 * 512 }, {512, 512}, {0,0}, 4},-- piece 02
{"south", { 2048, 10 * 512 }, {512, 512}, {0,0}, 4},-- piece 11
{"southwest", { 2048, 5 * 512 }, {512, 512}, {0,0}, 4},-- piece 06
{"west", { 2048, 14 * 512 }, {512, 512}, {0,0}, 4},-- piece 15
{"northwest", { 2048, 9 * 512 }, {512, 512}, {0,0}, 4},-- piece 10
}
end
local elems =
{
{ "metals", "__base__/graphics/entity/rails/rail/remnants/rail-remnants-metals.png", mipmap = true, allow_forced_downscale = true },
{ "backplates", "__base__/graphics/entity/rails/rail/remnants/rail-remnants-backplates.png", mipmap = true, allow_forced_downscale = true },
{ "ties", "__Bio_Industries_2__/graphics/entities/wood_products/rails/new_rail/rail-remnants-ties-concrete.png" , allow_forced_downscale = true },
{ "stone_path", "__base__/graphics/entity/rails/rail/remnants/rail-remnants-stone-path-inside.png" , allow_forced_downscale = true },
{ "stone_path_background", "__base__/graphics/entity/rails/rail/remnants/rail-remnants-stone-path.png" , allow_forced_downscale = true }
}
local res = make_new_rail_pictures(keys, elems)
res["rail_endings"] =
{
sheets =
{
{
filename = "__base__/graphics/entity/rails/rail/rail-endings-background.png",
priority = "high",
flags = { "low-object" },
width = 256,
height = 256,
scale = 0.5,
usage = "rail"
},
{
filename = "__base__/graphics/entity/rails/rail/rail-endings-foreground.png",
priority = "high",
flags = { "trilinear-filtering" },
width = 256,
height = 256,
scale = 0.5,
usage = "rail"
}
}
}
res["render_layers"] = ground_rail_render_layers
return res
end

View file

@ -1,275 +0,0 @@
local util = require("util")
local wood_tint = {r = 183/255, g = 125/255, b = 62/255, a = 1}
local ground_rail_render_layers =
{
stone_path_lower = "rail-stone-path-lower",
stone_path = "rail-stone-path",
tie = "rail-tie",
screw = "rail-screw",
metal = "rail-metal"
}
local rail_segment_visualisation_endings =
{
filename = "__base__/graphics/entity/rails/rail/rail-segment-visualisations-endings.png",
priority = "extra-high",
flags = { "low-object" },
width = 64,
height = 64,
scale = 0.5,
direction_count = 16,
frame_count = 6,
-- tint = wood_tint,
usage = "rail"
}
local function make_new_rail_pictures_wood(keys, elems, max_variations)
local function make_sprite_definition_wood(filename, elem, key, variation_count)
return
{
filename = filename,
priority = elem.priority or "extra-high",
flags = elem.mipmap and { "trilinear-filtering" } or { "low-object" },
draw_as_shadow = elem.draw_as_shadow,
allow_forced_downscale = elem.allow_forced_downscale,
width = key[3][1],
height = key[3][2],
x = key[2][1],
y = key[2][2],
scale = 0.5;
shift = util.by_pixel(key[4][1], key[4][2]),
variation_count = variation_count,
-- tint = wood_tint,
usage = "rail"
}
end
local res = {}
for _ , key in ipairs(keys) do
local part = {}
local variation_count = key[5] or 1
if max_variations then
variation_count = math.min(variation_count, max_variations)
end
if (variation_count > 0) then
for _ , elem in ipairs(elems) do
local layers = nil
local variations = variation_count;
if (elem[1] == "segment_visualisation_middle") then
variations = nil
end
if (type(elem[2]) == "table") then
layers = { layers = {} }
for _, subelem in ipairs(elem[2]) do
table.insert(layers.layers, make_sprite_definition_wood(subelem[1], subelem, key, variations))
end
else
layers = make_sprite_definition_wood(elem[2], elem, key, variations)
end
if (elem[1] ~= nil) then
part[elem[1]] = layers
else
part = layers
end
end
end
res[key[1]] = part
end
return res
end
function new_rail_pictures_wood(rail_type)
local keys
local NOT_USED_POSITION = {0, 0}
local NOT_USED_SIZE = {1, 1}
local NOT_USED_SHIFT = {0, 0}
if rail_type == "straight" then
keys =
{
{"north", { 0, 256 }, {256, 256}, {0,0}, 8},
{"northeast", { 0, 2048 }, {384, 384}, {0,0}, 3},
{"east", { 0, 0 }, {256, 256}, {0,0}, 8},
{"southeast", { 0, 896 }, {384, 384}, {0,0}, 3},
{"south", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"southwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"west", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"northwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0}
}
elseif rail_type == "half-diagonal" then
keys =
{
{"north", { 0, 1280 }, {384, 384}, {0,0}, 3},
{"northeast", { 0, 1664 }, {384, 384}, {0,0}, 3},
{"east", { 0, 2432 }, {384, 384}, {0,0}, 3},
{"southeast", { 0, 512 }, {384, 384}, {0,0}, 3},
{"south", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"southwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"west", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"northwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0}
}
elseif rail_type == "curved-a" then
keys =
{
{"north", { 2048, 3 * 512 }, {512, 512}, {0,0}, 4},-- piece 04
{"northeast", { 2048, 12 * 512 }, {512, 512}, {0,0}, 4},-- piece 13
{"east", { 2048, 7 * 512 }, {512, 512}, {0,0}, 4},-- piece 08
{"southeast", { 2048, 0 * 512 }, {512, 512}, {0,0}, 4},-- piece 01
{"south", { 2048, 11 * 512 }, {512, 512}, {0,0}, 4},-- piece 12
{"southwest", { 2048, 4 * 512 }, {512, 512}, {0,0}, 4},-- piece 05
{"west", { 2048, 15 * 512 }, {512, 512}, {0,0}, 4},-- piece 16
{"northwest", { 2048, 8 * 512 }, {512, 512}, {0,0}, 4},-- piece 09
}
elseif rail_type == "curved-b" then
keys =
{
{"north", { 2048, 2 * 512 }, {512, 512}, {0,0}, 4},-- piece 03
{"northeast", { 2048, 13 * 512 }, {512, 512}, {0,0}, 4},-- piece 14
{"east", { 2048, 6 * 512 }, {512, 512}, {0,0}, 4},-- piece 07
{"southeast", { 2048, 1 * 512 }, {512, 512}, {0,0}, 4},-- piece 02
{"south", { 2048, 10 * 512 }, {512, 512}, {0,0}, 4},-- piece 11
{"southwest", { 2048, 5 * 512 }, {512, 512}, {0,0}, 4},-- piece 06
{"west", { 2048, 14 * 512 }, {512, 512}, {0,0}, 4},-- piece 15
{"northwest", { 2048, 9 * 512 }, {512, 512}, {0,0}, 4},-- piece 10
}
end
local elems =
{
{ "metals", "__base__/graphics/entity/rails/rail/rail-metals.png", mipmap = true },
{ "backplates", "__base__/graphics/entity/rails/rail/rail-backplates.png", mipmap = true },
{ "ties", "__Bio_Industries_2__/graphics/entities/wood_products/rails/new_rail/rail-ties-wood.png" },
{ "stone_path", "__base__/graphics/entity/rails/rail/rail-stone-path-inside.png" },
{ "stone_path_background", "__base__/graphics/entity/rails/rail/rail-stone-path.png" },
{ "segment_visualisation_middle", "__base__/graphics/entity/rails/rail/rail-segment-visualisations-middle.png" },
}
local res = make_new_rail_pictures_wood(keys, elems)
res["rail_endings"] =
{
sheets =
{
{
filename = "__base__/graphics/entity/rails/rail/rail-endings-background.png",
priority = "high",
flags = { "low-object" },
width = 256,
height = 256,
scale = 0.5,
-- tint = wood_tint,
usage = "rail"
},
{
filename = "__base__/graphics/entity/rails/rail/rail-endings-foreground.png",
priority = "high",
flags = { "trilinear-filtering" },
width = 256,
height = 256,
scale = 0.5,
-- tint = wood_tint,
usage = "rail"
}
}
}
res["render_layers"] = ground_rail_render_layers
res["segment_visualisation_endings"] = rail_segment_visualisation_endings
return res
end
function new_rail_remnants_pictures(rail_type)
local keys
local NOT_USED_POSITION = {0, 0}
local NOT_USED_SIZE = {1, 1}
local NOT_USED_SHIFT = {0, 0}
if rail_type == "straight" then
keys =
{
{"north", { 0, 256 }, {256, 256}, {0,0}, 8},
{"northeast", { 0, 2048 }, {384, 384}, {0,0}, 3},
{"east", { 0, 0 }, {256, 256}, {0,0}, 8},
{"southeast", { 0, 896 }, {384, 384}, {0,0}, 3},
{"south", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"southwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"west", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"northwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0}
}
elseif rail_type == "half-diagonal" then
keys =
{
{"north", { 0, 1280 }, {384, 384}, {0,0}, 3},
{"northeast", { 0, 1664 }, {384, 384}, {0,0}, 3},
{"east", { 0, 2432 }, {384, 384}, {0,0}, 3},
{"southeast", { 0, 512 }, {384, 384}, {0,0}, 3},
{"south", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"southwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"west", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0},
{"northwest", NOT_USED_POSITION, NOT_USED_SIZE, NOT_USED_SHIFT, 0}
}
elseif rail_type == "curved-a" then
keys =
{
{"north", { 2048, 3 * 512 }, {512, 512}, {0,0}, 4},-- piece 04
{"northeast", { 2048, 12 * 512 }, {512, 512}, {0,0}, 4},-- piece 13
{"east", { 2048, 7 * 512 }, {512, 512}, {0,0}, 4},-- piece 08
{"southeast", { 2048, 0 * 512 }, {512, 512}, {0,0}, 4},-- piece 01
{"south", { 2048, 11 * 512 }, {512, 512}, {0,0}, 4},-- piece 12
{"southwest", { 2048, 4 * 512 }, {512, 512}, {0,0}, 4},-- piece 05
{"west", { 2048, 15 * 512 }, {512, 512}, {0,0}, 4},-- piece 16
{"northwest", { 2048, 8 * 512 }, {512, 512}, {0,0}, 4},-- piece 09
}
elseif rail_type == "curved-b" then
keys =
{
{"north", { 2048, 2 * 512 }, {512, 512}, {0,0}, 4},-- piece 03
{"northeast", { 2048, 13 * 512 }, {512, 512}, {0,0}, 4},-- piece 14
{"east", { 2048, 6 * 512 }, {512, 512}, {0,0}, 4},-- piece 07
{"southeast", { 2048, 1 * 512 }, {512, 512}, {0,0}, 4},-- piece 02
{"south", { 2048, 10 * 512 }, {512, 512}, {0,0}, 4},-- piece 11
{"southwest", { 2048, 5 * 512 }, {512, 512}, {0,0}, 4},-- piece 06
{"west", { 2048, 14 * 512 }, {512, 512}, {0,0}, 4},-- piece 15
{"northwest", { 2048, 9 * 512 }, {512, 512}, {0,0}, 4},-- piece 10
}
end
local elems =
{
{ "metals", "__base__/graphics/entity/rails/rail/remnants/rail-remnants-metals.png", mipmap = true, allow_forced_downscale = true },
{ "backplates", "__base__/graphics/entity/rails/rail/remnants/rail-remnants-backplates.png", mipmap = true, allow_forced_downscale = true },
{ "ties", "__Bio_Industries_2__/graphics/entities/wood_products/rails/new_rail/rail-remnants-ties-wood.png" , allow_forced_downscale = true },
{ "stone_path", "__base__/graphics/entity/rails/rail/remnants/rail-remnants-stone-path-inside.png" , allow_forced_downscale = true },
{ "stone_path_background", "__base__/graphics/entity/rails/rail/remnants/rail-remnants-stone-path.png" , allow_forced_downscale = true }
}
local res = make_new_rail_pictures_wood(keys, elems)
res["rail_endings"] =
{
sheets =
{
{
filename = "__base__/graphics/entity/rails/rail/rail-endings-background.png",
priority = "high",
flags = { "low-object" },
width = 256,
height = 256,
scale = 0.5,
-- tint = wood_tint,
usage = "rail"
},
{
filename = "__base__/graphics/entity/rails/rail/rail-endings-foreground.png",
priority = "high",
flags = { "trilinear-filtering" },
width = 256,
height = 256,
scale = 0.5,
-- tint = wood_tint,
usage = "rail"
}
}
}
res["render_layers"] = ground_rail_render_layers
return res
end

View file

@ -1,258 +0,0 @@
require("prototypes.Wood_Products.rail-pictures-wood")
local BioInd = require('common')('Bio_Industries_2')
local ICONPATH_E = BioInd.modRoot .. "/graphics/icons/entity/"
local item_sounds = require("__base__.prototypes.item_sounds")
local hit_effects = require("__base__.prototypes.entity.hit-effects")
local tile_sounds = require("__base__.prototypes.tile.tile-sounds")
data:extend({
---- ITEM
{
type = "rail-planner",
name = "bi-rail-wood",
icons = { { icon = ICONPATH_E .. "rail-wood.png", icon_size = 64, } },
localised_name = { "item-name.bi-rail-wood" },
subgroup = "train-transport",
order = "a[rail]-0[rail]",
inventory_move_sound = item_sounds.train_inventory_move,
pick_sound = item_sounds.train_inventory_pickup,
drop_sound = item_sounds.train_inventory_move,
place_result = "bi-straight-rail-wood",
stack_size = 100,
rails = {
"bi-straight-rail-wood",
"bi-curved-rail-a-wood",
"bi-curved-rail-b-wood",
"bi-half-diagonal-rail-wood"
},
manual_length_limit = 22.5 -- 2*(Curved-A) + 2*(Curved-B) + their planner penalty + margin
},
---- Recipe
{
type = "recipe",
name = "bi-rail-wood",
localised_name = { "entity-name.bi-rail-wood" },
localised_description = { "entity-description.bi-rail-wood" },
icons = { { icon = ICONPATH_E .. "rail-wood.png", icon_size = 64, } },
enabled = false,
ingredients = {
{ type = "item", name = "wood", amount = 6 },
{ type = "item", name = "stone", amount = 1 },
{ type = "item", name = "steel-plate", amount = 1 },
{ type = "item", name = "iron-stick", amount = 1 },
},
results = { { type = "item", name = "bi-rail-wood", amount = 2 } },
main_product = "",
requester_paste_multiplier = 4,
--~ always_show_made_in = true,
--~ allow_decomposition = false,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Changed for 0.18.34/1.1.4
allow_decomposition = true, -- Changed for 0.18.34/1.1.4
subgroup = "transport",
order = "a[train-system]-a[rail]",
-- This is a custom property for use by "Krastorio 2" (it will change
-- ingredients/results; used for wood/wood pulp)
mod = "Bio_Industries",
},
{
type = "recipe",
name = "bi-rail-wood-to-concrete",
icons = { { icon = ICONPATH_E .. "rail-wood-to-concrete.png", icon_size = 64, } },
enabled = false,
ingredients = {
{ type = "item", name = "bi-rail-wood", amount = 2 },
{ type = "item", name = "stone-brick", amount = 6 },
},
results = { { type = "item", name = "rail", amount = 2 } }
},
--- Entity
{
type = "straight-rail",
name = "bi-straight-rail-wood",
order = "a[ground-rail]-a[bi-straight-rail-wood]",
icon = ICONPATH_E .. "straight-rail-wood.png",
localised_name = { "entity-name.bi-straight-rail-wood" },
collision_box = { { -1, -1 }, { 1, 1 } }, -- has custommly generated box, but the prototype needs something that is used to generate building smokes
flags = { "placeable-neutral", "player-creation", "building-direction-8-way" },
minable = { mining_time = 0.2, result = "bi-rail-wood", count = 1 },
max_health = 200,
corpse = "straight-rail-remnants",
dying_explosion = {
name = "rail-explosion"
},
resistances = {
{
type = "fire",
percent = 100
},
{
type = "acid",
percent = 80
}
},
-- collision box is hardcoded for rails as to avoid unexpected changes in the way rail blocks are merged
selection_box = { { -1.7, -0.8 }, { 1.7, 0.8 } },
damaged_trigger_effect = hit_effects.wall(),
pictures = new_rail_pictures_wood("straight"),
placeable_by = { item = "bi-rail-wood", count = 1 },
walking_sound = tile_sounds.walking.rails,
extra_planner_goal_penalty = -4,
factoriopedia_alternative = "straight-rail",
-- for upgrade planer (fast rail change wood/iron)
next_upgrade = "straight-rail",
fast_replaceable_group = "straight-rail",
},
{
type = "half-diagonal-rail",
name = "bi-half-diagonal-rail-wood",
order = "a[ground-rail]-b[bi-half-diagonal-rail-wood]",
deconstruction_alternative = "bi-straight-rail-wood",
icon = ICONPATH_E .. "curved-rail-wood.png",
localised_name = { "entity-name.bi-half-diagonal-rail-wood" },
collision_box = { { -0.75, -2.236 }, { 0.75, 2.236 } }, -- has custommly generated box, but the prototype needs something that is used to generate building smokes
tile_height = 2,
extra_planner_goal_penalty = -4,
flags = { "placeable-neutral", "player-creation", "building-direction-8-way" },
minable = { mining_time = 0.2, result = "bi-rail-wood", count = 2 },
max_health = 200,
corpse = "half-diagonal-rail-remnants",
dying_explosion = {
{
name = "rail-explosion",
offset = { 0.9, 2.2 }
},
{
name = "rail-explosion"
},
{
name = "rail-explosion",
offset = { -1.2, -2 }
}
},
resistances = {
{
type = "fire",
percent = 100
},
{
type = "acid",
percent = 80
}
},
-- collision box is hardcoded for rails as to avoid unexpected changes in the way rail blocks are merged
selection_box = { { -1.7, -0.8 }, { 1.7, 0.8 } },
damaged_trigger_effect = hit_effects.wall(),
pictures = new_rail_pictures_wood("half-diagonal"),
placeable_by = { item = "bi-rail-wood", count = 2 },
walking_sound = tile_sounds.walking.rails,
extra_planner_penalty = 0,
factoriopedia_alternative = "straight-rail",
-- for upgrade planer (fast rail change wood/iron)
next_upgrade = "half-diagonal-rail",
fast_replaceable_group = "half-diagonal-rail",
},
{
type = "curved-rail-a",
name = "bi-curved-rail-a-wood",
order = "a[ground-rail]-c[bi-curved-rail-a-wood]",
deconstruction_alternative = "bi-straight-rail-wood",
icon = ICONPATH_E .. "curved-rail-wood.png",
localised_name = { "entity-name.bi-curved-rail-a-wood" },
collision_box = { { -0.75, -2.516 }, { 0.75, 2.516 } }, -- has custommly generated box, but the prototype needs something that is used to generate building smokes
flags = { "placeable-neutral", "player-creation", "building-direction-8-way" },
minable = { mining_time = 0.2, result = "bi-rail-wood", count = 3 },
max_health = 200,
corpse = "curved-rail-a-remnants",
dying_explosion = {
{
name = "rail-explosion",
offset = { 0.9, 2.2 }
},
{
name = "rail-explosion"
},
{
name = "rail-explosion",
offset = { -1.2, -2 }
}
},
resistances = {
{
type = "fire",
percent = 100
},
{
type = "acid",
percent = 80
}
},
-- collision box is hardcoded for rails as to avoid unexpected changes in the way rail blocks are merged
selection_box = { { -1.7, -0.8 }, { 1.7, 0.8 } },
damaged_trigger_effect = hit_effects.wall(),
pictures = new_rail_pictures_wood("curved-a"),
placeable_by = { item = "bi-rail-wood", count = 3 },
walking_sound = tile_sounds.walking.rails,
extra_planner_penalty = 0.5,
deconstruction_marker_positions = rail_8shifts_vector(-0.248, -0.533),
factoriopedia_alternative = "straight-rail",
-- for upgrade planer (fast rail change wood/iron)
next_upgrade = "curved-rail-a",
fast_replaceable_group = "curved-rail-a",
},
{
type = "curved-rail-b",
name = "bi-curved-rail-b-wood",
order = "a[ground-rail]-d[bi-curved-rail-b-wood]",
deconstruction_alternative = "bi-straight-rail-wood",
icon = ICONPATH_E .. "curved-rail-wood.png",
localised_name = { "entity-name.bi-curved-rail-b-wood" },
collision_box = { { -0.75, -2.441 }, { 0.75, 2.441 } }, -- has custommly generated box, but the prototype needs something that is used to generate building smokes
flags = { "placeable-neutral", "player-creation", "building-direction-8-way" },
minable = { mining_time = 0.2, result = "bi-rail-wood", count = 3 },
max_health = 200,
corpse = "curved-rail-b-remnants",
dying_explosion = {
{
name = "rail-explosion",
offset = { 0.9, 2.2 }
},
{
name = "rail-explosion"
},
{
name = "rail-explosion",
offset = { -1.2, -2 }
}
},
resistances = {
{
type = "fire",
percent = 100
},
{
type = "acid",
percent = 80
}
},
-- collision box is hardcoded for rails as to avoid unexpected changes in the way rail blocks are merged
selection_box = { { -1.7, -0.8 }, { 1.7, 0.8 } },
damaged_trigger_effect = hit_effects.wall(),
pictures = new_rail_pictures_wood("curved-b"),
placeable_by = { item = "bi-rail-wood", count = 3 },
walking_sound = tile_sounds.walking.rails,
extra_planner_penalty = 0.5,
deconstruction_marker_positions = rail_8shifts_vector(-0.309, -0.155),
factoriopedia_alternative = "straight-rail",
-- for upgrade planer (fast rail change wood/iron)
next_upgrade = "curved-rail-b",
fast_replaceable_group = "curved-rail-b",
},
})