Remove rails

This commit is contained in:
Simon Brodtmann 2025-07-05 15:49:26 +02:00
parent 9f00230657
commit 6ea21083ea
14 changed files with 4 additions and 1635 deletions

View file

@ -18,29 +18,6 @@ BioInd.writeDebug("Removed %g tree prototypes. Number of trees to ignore now: %g
BI.Settings.BI_Game_Tweaks_Emissions_Multiplier = settings.startup["BI_Game_Tweaks_Emissions_Multiplier"].value
-- Moved to data-updates.lua for 0.18.34/1.1.4!
--~ ---- Game Tweaks ---- Recipes
--~ if BI.Settings.BI_Game_Tweaks_Recipe then
--~ --- Concrete Recipe Tweak
--~ thxbob.lib.recipe.remove_ingredient("concrete", "iron-ore")
--~ thxbob.lib.recipe.add_new_ingredient("concrete", {type = "item", name = "iron-stick", amount = 2})
--~ --- Stone Wall
--~ thxbob.lib.recipe.add_new_ingredient("stone-wall", {type = "item", name = "iron-stick", amount = 1})
--~ --- Rail (Remove Stone and Add Crushed Stone)
--~ 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 recipe update
--~ thxbob.lib.recipe.add_new_ingredient("rail", {type = "item", name = "concrete", amount = 6})
--~ end
---- Game Tweaks ---- Tree
if BI.Settings.BI_Game_Tweaks_Tree then

View file

@ -16,94 +16,12 @@ for var, name in pairs({
end
--~ BioInd.show("data.raw.recipe[\"bi-sulfur\"]", data.raw.recipe["bi-sulfur"])
BioInd.show("BI.Settings.BI_Easy_Bio_Gardens", BI.Settings.BI_Easy_Bio_Gardens)
local ICONPATH = "__Bio_Industries_2__/graphics/icons/"
----Update the Wood Pipe Images
require("prototypes.Wood_Products.pipes")
--- Update the images of Wooden rail bridges and their remnants
require("prototypes.Wood_Products.wooden_rail_bridge_update")
--~ --- Bridge Rail Remnants
--~ require("prototypes.Wood_Products.update_bridge_rails_remnants")
require("prototypes.Wood_Products.tint_rails_remnants_function")
-- Concrete Rail
---- Update Standard Rails to use and look like concrete
set_tint_to_rails(
{
data.raw["straight-rail"]["straight-rail"],
data.raw["curved-rail"]["curved-rail"]
},
{r = 183/255, g = 183/255, b = 183/255, a = 1}
) -- concrete
set_tint_to_remnants(
{
data.raw["rail-remnants"]["straight-rail-remnants"],
data.raw["rail-remnants"]["curved-rail-remnants"]
},
{r = 183/255, g = 183/255, b = 183/255, a = 1}
) -- concrete
-- Wood Rail
set_tint_to_rails(
{
data.raw["straight-rail"]["bi-straight-rail-wood"],
data.raw["curved-rail"]["bi-curved-rail-wood"]
},
{r = 183/255, g = 125/255, b = 62/255, a = 1}
) -- wood
set_tint_to_remnants(
{
data.raw["rail-remnants"]["straight-rail-remnants-wood"],
data.raw["rail-remnants"]["curved-rail-remnants-wood"]
},
{r = 183/255, g = 125/255, b = 62/255, a = 1}
) -- wood
--- Power Rail
set_tint_to_rails(
{
data.raw["straight-rail"]["straight-rail"],
data.raw["curved-rail"]["curved-rail"]
},
{r = 150/255, g = 150/255, b = 150/255, a = 1}
) -- mix
-- vanilla rail icon & images update
data.raw["straight-rail"]["straight-rail"].icon = ICONPATH .. "straight-rail-concrete.png"
data.raw["straight-rail"]["straight-rail"].icon_size = 64
data.raw["straight-rail"]["straight-rail"].icon_mipmaps = 4
data.raw["curved-rail"]["curved-rail"].icon = ICONPATH .. "curved-rail-concrete.png"
data.raw["curved-rail"]["curved-rail"].icon_size = 64
data.raw["curved-rail"]["curved-rail"].icon_mipmaps = 4
data.raw["rail-planner"]["rail"].icon = ICONPATH .. "rail-concrete.png"
data.raw["rail-planner"]["rail"].icon_size = 64
data.raw["rail-planner"]["rail"].icon_mipmaps = 4
--- Wood Rail added to Tech
thxbob.lib.tech.add_recipe_unlock("railway", "bi-rail-wood")
--- If Bob, move Vanilla Rail to Rail 2, also add Power Rail.
if data.raw.technology["bob-railway-2"] then
thxbob.lib.tech.remove_recipe_unlock ("railway", "rail")
thxbob.lib.tech.add_recipe_unlock("bob-railway-2", "rail")
thxbob.lib.tech.add_recipe_unlock("bob-railway-2", "bi-rail-wood-to-concrete")
thxbob.lib.tech.add_recipe_unlock("bob-railway-2", "bi-rail-wood-bridge")
thxbob.lib.tech.add_recipe_unlock("bob-railway-2", "bi-rail-power")
thxbob.lib.tech.add_recipe_unlock("bob-railway-2", "bi-power-to-rail-pole")
else
thxbob.lib.tech.add_recipe_unlock("railway", "bi-rail-wood-to-concrete")
thxbob.lib.tech.add_recipe_unlock("rail-signals", "bi-rail-wood-bridge")
thxbob.lib.tech.add_recipe_unlock("rail-signals", "bi-rail-power")
thxbob.lib.tech.add_recipe_unlock("rail-signals", "bi-power-to-rail-pole")
end
-- Damage Bonus to Ammo
-- Don't duplicate what NE does
if not mods["Natural_Evolution_Buildings"] then
@ -810,16 +728,10 @@ BioInd.writeDebug("Removed technology " .. "bi-tech-coal-processing-" .. i)
end
end
-- Moved here from data-final-fixes.lua for 0.18.34/1.1.4! (Fixes https://mods.factorio.com/mod/Bio_Industries_2/discussion/5ff517c391699300236170a2)
-- "Transport drones" ruins rails by removing object-layer from the collision mask. That
-- causes problems for our "Wooden rail bridges" as they will also pass through cliffs.
require("prototypes.Wood_Products.rail_updates")
-- Compatibility with Industrial Revolution
require("prototypes.Industrial_Revolution")
------------------------------------------------------------------------------------
-- Add icons to our prototypes
BioInd.BI_add_icons()

View file

@ -166,33 +166,4 @@ log("Enabling disassemble recipes!")
main_product = "",
},
})
end
-- Add alternative Production Science Pack using Wooden rails instead of regular rails.
-- This will only be created if "Krastorio 2" IS NOT active (new recipe would break the
-- balance then) and if the setting for the recipe IS enabled.
local KRAS = (mods["Krastorio2"] or mods["Krastorio"]) and true or false
local SET = settings.startup["BI_Game_Tweaks_Production_Science"].value
if SET and not KRAS 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}
},
result_count = 3,
result = "production-science-pack"
},
})
--~ 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", {(KRAS and "active" or "not active"), (SET and "enabled" or "disabled")})
end
end

View file

@ -1,74 +0,0 @@
local BioInd = require('common')('Bio_Industries')
--~ local ICONPATH = BioInd.modRoot .. "__base__/graphics/icons/"
local ICONPATH = "__base__/graphics/icons/"
--~ local BIGICONS = BioInd.check_base_version("0.18.0")
--[[
destroyed_rail_pictures_c = function()
return rail_pictures_internal({{"metals", "metals-remnants", mipmap = true, variations = 3, priority = "high"},
{"backplates", "backplates-remnants", mipmap = true, variations = 3, priority = "high"},
{"ties", "ties-remnants", variations = 3, priority = "high"},
{"stone_path", "stone-path-remnants", variations = 3, priority = "high"},
{"stone_path_background", "stone-path-background-remnants", variations = 3, priority = "high"}})
end
]]
data:extend(
{
{
type = "rail-remnants",
name = "straight-rail-remnants",
localised_name = {"entity-name.rail-remnants"},
localised_description = {"entity_description.rail-remnants"},
icon = ICONPATH .. "straight-rail-remnants.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "straight-rail-remnants.png",
icon_size = 64,
}
},
flags = {"placeable-neutral", "building-direction-8-way", "not-on-map"},
subgroup = "remnants",
order = "d[remnants]-b[rail]-a[straight]",
collision_box = {{-0.7, -0.8}, {0.7, 0.8}},
selection_box = {{-0.6, -0.8}, {0.6, 0.8}},
selectable_in_game = false,
tile_width = 2,
tile_height = 2,
bending_type = "straight",
pictures = destroyed_rail_pictures(),
--pictures = destroyed_rail_pictures_c(),
time_before_removed = 60 * 60 * 45,
time_before_shading_off = 60 * 60 * 1
},
{
type = "rail-remnants",
name = "curved-rail-remnants",
localised_name = {"entity-name.rail-remnants"},
localised_description = {"entity_description.rail-remnants"},
icon = ICONPATH .. "curved-rail-remnants.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "curved-rail-remnants.png",
icon_size = 64,
}
},
flags = {"placeable-neutral", "building-direction-8-way", "not-on-map"},
subgroup = "remnants",
order = "d[remnants]-b[rail]-b[curved]",
collision_box = {{-1, -1}, {1, 1}},
selection_box = {{-1.7, -0.8}, {1.7, 0.8}},
selectable_in_game = false,
tile_width = 4,
tile_height = 8,
bending_type = "turn",
pictures = destroyed_rail_pictures(),
--pictures = destroyed_rail_pictures_c(),
time_before_removed = 60 * 60 * 45,
time_before_shading_off = 60 * 60 * 1
},
})

View file

@ -1,129 +0,0 @@
local BioInd = require('common')('Bio_Industries')
local ICONPATH = "__base__/graphics/icons/"
--~ local BIGICONS = BioInd.check_base_version("0.18.0")
--[[
destroyed_rail_pictures = function()
return rail_pictures_internal({{"metals", "metals-remnants", mipmap = true, variations = 3, priority = "high"},
{"backplates", "backplates-remnants", mipmap = true, variations = 3, priority = "high"},
{"ties", "ties-remnants", variations = 3, priority = "high"},
{"stone_path", "stone-path-remnants", variations = 3, priority = "high"},
{"stone_path_background", "stone-path-background-remnants", variations = 3, priority = "high"}})
end
]]
data:extend(
{
{
type = "rail-remnants",
name = "straight-rail-remnants-wood",
localised_name = {"entity-name.rail-remnants-wood"},
localised_description = {"entity_description.rail-remnants-wood"},
icon = ICONPATH .. "straight-rail-remnants.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "straight-rail-remnants.png",
icon_size = 64,
}
},
flags = {"placeable-neutral", "building-direction-8-way", "not-on-map"},
subgroup = "remnants",
order = "d[remnants]-b[rail]-a[straight]",
collision_box = {{-0.7, -0.8}, {0.7, 0.8}},
selection_box = {{-0.6, -0.8}, {0.6, 0.8}},
selectable_in_game = false,
tile_width = 2,
tile_height = 2,
bending_type = "straight",
--pictures = destroyed_rail_pictures_w(),
pictures = destroyed_rail_pictures(),
time_before_removed = 60 * 60 * 45,
time_before_shading_off = 60 * 60 * 1
},
{
type = "rail-remnants",
name = "curved-rail-remnants-wood",
localised_name = {"entity-name.rail-remnants-wood"},
localised_description = {"entity_description.rail-remnants-wood"},
icon = ICONPATH .. "curved-rail-remnants.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "curved-rail-remnants.png",
icon_size = 64,
}
},
flags = {"placeable-neutral", "building-direction-8-way", "not-on-map"},
subgroup = "remnants",
order = "d[remnants]-b[rail]-b[curved]",
collision_box = {{-0.75, -0.55}, {0.75, 1.6}},
secondary_collision_box = {{-0.65, -2.43}, {0.65, 2.43}},
selection_box = {{-1.7, -0.8}, {1.7, 0.8}},
selectable_in_game = false,
tile_width = 4,
tile_height = 8,
bending_type = "turn",
--pictures = destroyed_rail_pictures_w(),
pictures = destroyed_rail_pictures(),
time_before_removed = 60 * 60 * 45,
time_before_shading_off = 60 * 60 * 1
},
{
type = "rail-remnants",
name = "straight-rail-remnants-wood-bridge",
localised_name = {"entity-name.rail-remnants-wood-bridge"},
localised_description = {"entity_description.rail-remnants-wood-bridge"},
icon = ICONPATH .. "straight-rail-remnants.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "straight-rail-remnants.png",
icon_size = 64,
}
},
flags = {"placeable-neutral", "building-direction-8-way", "not-on-map"},
subgroup = "remnants",
order = "d[remnants]-b[rail]-a[straight]",
collision_box = {{-0.7, -0.8}, {0.7, 0.8}},
selection_box = {{-0.6, -0.8}, {0.6, 0.8}},
selectable_in_game = false,
tile_width = 2,
tile_height = 2,
bending_type = "straight",
--pictures = destroyed_rail_pictures_w(),
pictures = destroyed_rail_pictures(),
time_before_removed = 60 * 60 * 45,
time_before_shading_off = 60 * 60 * 1
},
{
type = "rail-remnants",
name = "curved-rail-remnants-wood-bridge",
localised_name = {"entity-name.rail-remnants-wood-bridge"},
localised_description = {"entity_description.rail-remnants-wood-bridge"},
icon = ICONPATH .. "curved-rail-remnants.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "curved-rail-remnants.png",
icon_size = 64,
}
},
flags = {"placeable-neutral", "building-direction-8-way", "not-on-map"},
subgroup = "remnants",
order = "d[remnants]-b[rail]-b[curved]",
collision_box = {{-0.75, -0.55}, {0.75, 1.6}},
secondary_collision_box = {{-0.65, -2.43}, {0.65, 2.43}},
selection_box = {{-1.7, -0.8}, {1.7, 0.8}},
selectable_in_game = false,
tile_width = 4,
tile_height = 8,
bending_type = "turn",
--pictures = destroyed_rail_pictures_w(),
pictures = destroyed_rail_pictures(),
time_before_removed = 60 * 60 * 45,
time_before_shading_off = 60 * 60 * 1
},
})

View file

@ -727,284 +727,6 @@ data:extend({
},
})
local RAIL_FLAGS = {
"placeable-neutral",
"player-creation",
"building-direction-8-way",
"fast-replaceable-no-cross-type-while-moving"
}
---- Rail straight (Wood)
data:extend({
{
type = "straight-rail",
name = "bi-straight-rail-wood",
localised_name = {"entity-name.bi-rail-wood"},
localised_description = {"entity-description.bi-rail-wood"},
icon = ICONPATH .. "straight-rail-wood.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "straight-rail-wood.png",
icon_size = 64,
}
},
--~ flags = {
--~ "placeable-neutral",
--~ "player-creation",
--~ "building-direction-8-way",
--~ "fast-replaceable-no-cross-type-while-moving",
--~ },
flags = RAIL_FLAGS,
--~ collision_mask = {"object-layer"},
--~ collision_mask = BioInd.RAIL_MASK,
minable = {mining_time = 0.25, result = "bi-rail-wood"},
max_health = 60,
corpse = "straight-rail-remnants-wood",
resistances = {
{
type = "fire",
percent = 80
},
{
type = "acid",
percent = 60
}
},
collision_box = {{-0.7, -0.8}, {0.7, 0.8}},
selection_box = {{-0.7, -0.8}, {0.7, 0.8}},
rail_category = "regular",
--fast_replaceable_group = "rail",
--next_upgrade = "straight-rail",
pictures = rail_pictures(),
},
})
---- Rail curved (Wood)
data:extend({
{
type = "curved-rail",
name = "bi-curved-rail-wood",
localised_name = {"entity-name.bi-rail-wood"},
localised_description = {"entity-description.bi-rail-wood"},
icon = ICONPATH .. "curved-rail-wood.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "curved-rail-wood.png",
icon_size = 64,
}
},
--~ flags = {
--~ "placeable-neutral",
--~ "player-creation",
--~ "building-direction-8-way",
--~ "fast-replaceable-no-cross-type-while-moving"
--~ },
flags = RAIL_FLAGS,
--~ collision_mask = {"object-layer"},
--~ collision_mask = BioInd.RAIL_MASK,
minable = {mining_time = 0.25, result = "bi-rail-wood", count = 4},
max_health = 120,
corpse = "curved-rail-remnants-wood",
resistances = {
{
type = "fire",
percent = 80
},
{
type = "acid",
percent = 60
}
},
collision_box = {{-0.75, -0.55}, {0.75, 1.6}},
secondary_collision_box = {{-0.65, -2.43}, {0.65, 2.43}},
selection_box = {{-1.7, -0.8}, {1.7, 0.8}},
rail_category = "regular",
pictures = rail_pictures(),
placeable_by = { item = "bi-rail-wood", count = 4}
},
})
--Wooden straight rail for Bridge
data:extend({
{
type = "straight-rail",
name = "bi-straight-rail-wood-bridge",
localised_name = {"entity-name.bi-rail-wood-bridge"},
localised_description = {"entity-description.bi-rail-wood-bridge"},
icon = ICONPATH .. "straight-rail-wood.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "straight-rail-wood.png",
icon_size = 64,
}
},
flags = {"placeable-neutral", "player-creation", "building-direction-8-way"},
--~ collision_mask = {"object-layer"},
--~ collision_mask = { "item-layer", "object-layer"},
--~ collision_mask = {"ground-tile", "floor-layer", "object-layer", "consider-tile-transitions"},
--~ collision_mask = BioInd.RAIL_BRIDGE_MASK,
minable = {mining_time = 0.5, result = "bi-rail-wood-bridge"},
max_health = 60,
corpse = "straight-rail-remnants-wood-bridge",
collision_box = {{-0.7, -0.8}, {0.7, 0.8}},
selection_box = {{-0.7, -0.8}, {0.7, 0.8}},
rail_category = "regular",
pictures = rail_pictures(),
},
})
--Wooden curved rail for Bridge
data:extend({
{
type = "curved-rail",
name = "bi-curved-rail-wood-bridge",
localised_name = {"entity-name.bi-rail-wood-bridge"},
localised_description = {"entity-description.bi-rail-wood-bridge"},
icon = ICONPATH .. "rail-wood.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-wood.png",
icon_size = 64,
}
},
flags = {
"placeable-neutral",
"player-creation",
"building-direction-8-way"
},
--~ collision_mask = {"object-layer"},
--~ collision_mask = { "floor-layer", "item-layer", "object-layer"},
--~ collision_mask = {"ground-tile", "floor-layer", "object-layer", "consider-tile-transitions"},
--~ collision_mask = BioInd.RAIL_BRIDGE_MASK,
minable = {mining_time = 0.5, result = "bi-rail-wood-bridge", count = 4},
max_health = 120,
corpse = "curved-rail-remnants-wood-bridge",
collision_box = {{-0.75, -0.55}, {0.75, 1.6}},
secondary_collision_box = {{-0.65, -2.43}, {0.65, 2.43}},
selection_box = {{-1.7, -0.8}, {1.7, 0.8}},
rail_category = "regular",
pictures = rail_pictures(),
placeable_by = { item = "bi-rail-wood-bridge", count = 4}
},
})
--- Power straight Rail
data:extend({
{
type = "straight-rail",
name = "bi-straight-rail-power",
localised_name = {"entity-name.bi-rail-power"},
localised_description = {"entity-description.bi-rail-power"},
icon = ICONPATH .. "rail-concrete-power.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-concrete-power.png",
icon_size = 64,
}
},
flags = {
"placeable-neutral",
"player-creation",
"building-direction-8-way"
},
--~ collision_mask = {"object-layer"},
--~ collision_mask = BioInd.RAIL_MASK,
minable = {mining_time = 0.5, result = "bi-rail-power"},
max_health = 60,
corpse = "straight-rail-remnants",
collision_box = {{-0.7, -0.8}, {0.7, 0.8}},
selection_box = {{-0.7, -0.8}, {0.7, 0.8}},
rail_category = "regular",
pictures = rail_pictures(),
},
})
--- Power curved Rail
data:extend({
{
type = "curved-rail",
name = "bi-curved-rail-power",
icon = ICONPATH .. "rail-concrete-power.png",
localised_name = {"entity-name.bi-rail-power"},
localised_description = {"entity-description.bi-rail-power"},
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-concrete-power.png",
icon_size = 64,
}
},
flags = {
"placeable-neutral",
"player-creation",
"building-direction-8-way",
},
--~ collision_mask = {"object-layer"},
--~ collision_mask = BioInd.RAIL_MASK,
minable = {mining_time = 0.5, result = "bi-rail-power", count = 4},
max_health = 120,
corpse = "curved-rail-remnants",
collision_box = {{-0.75, -0.55}, {0.75, 1.6}},
secondary_collision_box = {{-0.65, -2.43}, {0.65, 2.43}},
selection_box = {{-1.7, -0.8}, {1.7, 0.8}},
rail_category = "regular",
pictures = rail_pictures(),
placeable_by = { item = "bi-rail-power", count = 4}
},
})
--~ ------- Power Rail Pole - Hidden
--~ local hidden_pole = table.deepcopy(data.raw["electric-pole"]["small-electric-pole"])
--~ hidden_pole.name = "bi-power-rail-hidden-pole"
--~ hidden_pole.flags = {
--~ "not-deconstructable",
--~ "not-on-map",
--~ "placeable-off-grid",
--~ "not-repairable",
--~ "not-blueprintable",
--~ }
--~ hidden_pole.selectable_in_game = false
--~ hidden_pole.draw_copper_wires = BioInd.is_debug
--~ hidden_pole.max_health = 1
--~ hidden_pole.resistances = {{type = "fire", percent = 100}}
--~ hidden_pole.collision_mask = {}
--~ hidden_pole.collision_box = {{-0, -0}, {0, 0}}
--~ hidden_pole.selection_box = {{0, 0}, {0, 0}}
--~ hidden_pole.maximum_wire_distance = 9
--~ hidden_pole.supply_area_distance = 2
--~ hidden_pole.pictures = BioInd.is_debug and hidden_pole.pictures or {
--~ filename = ICONPATH .. "empty.png",
--~ priority = "low",
--~ width = 1,
--~ height = 1,
--~ frame_count = 1,
--~ axially_symmetrical = false,
--~ direction_count = 1,
--~ }
--~ hidden_pole.connection_points = BioInd.is_debug and hidden_pole.connection_points or {
--~ {
--~ shadow = {},
--~ wire = { copper_wire_tweak = {-0, -0} }
--~ }
--~ }
--~ hidden_pole.radius_visualisation_picture = BioInd.is_debug and
--~ hidden_pole.radius_visualisation_picture or {
--~ filename = ICONPATH .. "empty.png",
--~ width = 1,
--~ height = 1,
--~ priority = "low"
--~ }
--~ data:extend({hidden_pole})
---- Wood Pipe
data:extend({
{
@ -1135,25 +857,4 @@ data:extend({
},
},
},
})
------ Power to Rail Pole
-- Changed to medium-electric pole so the built entity resembles the icon (0.18.1)
--~ local my_pole = util.table.deepcopy(data.raw["electric-pole"]["small-electric-pole"])
local my_pole = util.table.deepcopy(data.raw["electric-pole"]["medium-electric-pole"])
my_pole.name = "bi-power-to-rail-pole"
my_pole.icon = ICONPATH .. "electric-to-rail.png"
my_pole.icon_size = 64
my_pole.icons = {
{
icon = ICONPATH .. "electric-to-rail.png",
icon_size = 64,
}
}
my_pole.icon_mipmaps = 1
my_pole.minable = {mining_time = 1, result = "bi-power-to-rail-pole"}
--~ my_pole.maximum_wire_distance = 4
my_pole.maximum_wire_distance = BioInd.POWER_TO_RAIL_WIRE_DISTANCE
my_pole.supply_area_distance = 3.5 -- 3 doesn't look right, 2.5 is too small
my_pole.pictures.tint = {r = 183/255, g = 125/255, b = 62/255, a = 1}
data:extend({my_pole})
})

View file

@ -70,72 +70,6 @@ data:extend({
stack_size = 50
},
--- Wood Rail Planner
{
type = "rail-planner",
name = "bi-rail-wood",
localised_name = {"entity-name.bi-rail-wood"},
localised_description = {"entity-description.bi-rail-wood"},
icon = ICONPATH .. "rail-wood.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-wood.png",
icon_size = 64,
}
},
subgroup = "transport",
order = "a[train-system]-a[rail]",
place_result = "bi-straight-rail-wood",
stack_size = 100,
straight_rail = "bi-straight-rail-wood",
curved_rail = "bi-curved-rail-wood"
},
--- Wooden Bridge Rail
{
type = "rail-planner",
name = "bi-rail-wood-bridge",
localised_name = {"entity-name.bi-rail-wood-bridge"},
localised_description = {"entity-description.bi-rail-wood-bridge"},
icon = ICONPATH .. "rail-wood-bridge.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-wood-bridge.png",
icon_size = 64,
}
},
subgroup = "transport",
order = "a[train-system]-aa[rail]",
place_result = "bi-straight-rail-wood-bridge",
stack_size = 100,
straight_rail = "bi-straight-rail-wood-bridge",
curved_rail = "bi-curved-rail-wood-bridge"
},
--- Electric Rail Planner
{
type = "rail-planner",
name = "bi-rail-power",
localised_name = {"entity-name.bi-rail-power"},
localised_description = {"entity-description.bi-rail-power"},
icon = ICONPATH .. "rail-concrete-power.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-concrete-power.png",
icon_size = 64,
}
},
subgroup = "transport",
order = "a[train-system]-ab[rail]",
place_result = "bi-straight-rail-power",
stack_size = 100,
straight_rail = "bi-straight-rail-power",
curved_rail = "bi-curved-rail-power"
},
--- Wood Pipe
{
type = "item",
@ -179,26 +113,4 @@ data:extend({
fuel_category = "chemical",
stack_size = 50
},
---- Power pole to connect Rail to Power Grid
{
type = "item",
name = "bi-power-to-rail-pole",
localised_name = {"entity-name.bi-power-to-rail-pole"},
localised_description = {"entity-description.bi-power-to-rail-pole"},
icon = ICONPATH .. "electric-to-rail.png",
icon_size = 64,
icon_mipmaps = 1,
icons = {
{
icon = ICONPATH .. "electric-to-rail.png",
icon_size = 64,
}
},
subgroup = "transport",
order = "a[train-system]-ac[rail]",
place_result = "bi-power-to-rail-pole",
stack_size = 50
},
})

View file

@ -1,96 +0,0 @@
local BioInd = require('common')('Bio_Industries')
local vanilla, rail_group, bridge_group
-- "Transport drones" ruins rails by removing object-layer from the collision mask. That
-- causes problems for our "Wooden rail bridges" as they will also pass through cliffs.
local BI_rails = {
["bi-straight-rail-wood"] = true,
["bi-curved-rail-wood"] = true,
["bi-straight-rail-power"] = true,
["bi-curved-rail-power"] = true,
--~ ["bi-straight-rail-wood-bridge"] = true,
--~ ["bi-curved-rail-wood-bridge"] = true,
}
-- We may need to adjust the collision_masks of bridges, so we want to be able to check
-- if all layers are set. Let's make a lookup list of the layers we need for bridges!
local bridge_collision_layers = {}
for _, layer in ipairs(BioInd.RAIL_BRIDGE_MASK) do
bridge_collision_layers[layer] = true
end
-- Name patterns for bridges from other mods should be inserted here.
local bridge_name_patterns = {
"bi%-.+-rail%-wood%-bridge",
-- Beautiful Bridge Railway
"bbr%-[^-]+%-rail%-.+",
}
-- Make lookup lists of all bridges in the game!
local bridges = {
curved = {},
straight = {},
}
for f, form in ipairs({"straight", "curved"}) do
for r, rail in pairs(data.raw[form .. "-rail"]) do
for p, pattern in ipairs(bridge_name_patterns) do
if r:match(pattern) then
bridges[form][r] = true
end
end
end
end
BioInd.show("bridges", bridges)
local mask, found_layer
for f, form in ipairs({"straight", "curved"}) do
vanilla = data.raw[form .. "-rail"][form .. "-rail"]
rail_group = vanilla and vanilla.fast_replaceable_group or "rail"
vanilla.fast_replaceable_group = rail_group
vanilla.collision_mask = BioInd.RAIL_MASK
for rail_name, rail in pairs(data.raw[form .. "-rail"]) do
-- Look for our own rails
if BI_rails[rail_name] then
-- Add collision masks to our rails
rail.collision_mask = BioInd.RAIL_MASK
BioInd.writeDebug("Set collision_mask of %s to %s", {rail_name, rail.collision_mask})
-- Add fast_replaceable_group to our rails
rail.fast_replaceable_group = rail_group
end
-- Look for all known bridges
if bridges[form][rail_name] then
BioInd.show("Bridge found", rail_name)
rail.collision_mask = rail.collision_mask or {}
-- Adjust or create collision mask
for need_layer, _ in pairs(bridge_collision_layers) do
found_layer = false
for l, layer in ipairs(rail.collision_mask) do
-- Stop if the layer we're looking for already is in the collision mask!
if need_layer == layer then
found_layer = true
break
end
end
-- Add layer to collision mask
if not found_layer then
table.insert(rail.collision_mask, need_layer)
BioInd.writeDebug("Added %s to collision mask of %s", {need_layer, rail_name})
end
end
BioInd.show("Collision mask", rail.collision_mask)
-- Add fast_replaceable_group to the bridges
rail.fast_replaceable_group = rail_group
end
end
end

View file

@ -153,213 +153,6 @@ data:extend({
mod = "Bio_Industries_2",
},
--- Wooden Rail
{
type = "recipe",
name = "bi-rail-wood",
localised_name = {"entity-name.bi-rail-wood"},
localised_description = {"entity-description.bi-rail-wood"},
icon = ICONPATH .. "rail-wood.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-wood.png",
icon_size = 64,
}
},
normal = {
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,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.4
},
expensive = {
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=1}},
main_product = "",
requester_paste_multiplier = 4,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.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",
},
--- Wooden Rail to Concrete Rail
{
type = "recipe",
name = "bi-rail-wood-to-concrete",
icon = ICONPATH .. "rail-wood-to-concrete.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-wood-to-concrete.png",
icon_size = 64,
}
},
normal = {
enabled = false,
ingredients = {
{type="item", name="bi-rail-wood", amount=3},
{type="item", name="stone-brick", amount=10},
},
results = {{type="item", name="rail", amount=2}},
main_product = "",
requester_paste_multiplier = 4,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.4
},
expensive = {
enabled = false,
ingredients = {
{type="item", name="bi-rail-wood", amount=2},
{type="item", name="stone-brick", amount=10},
},
results = {{type="item", name="rail", amount=1}},
main_product = "",
requester_paste_multiplier = 4,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.4
},
subgroup = "transport",
order = "a[train-system]-aa1[rail-upgrade]",
--~ 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
},
--- Wooden Bridge Rail
{
type = "recipe",
name = "bi-rail-wood-bridge",
localised_name = {"entity-name.bi-rail-wood-bridge"},
localised_description = {"entity-description.bi-rail-wood-bridge"},
name = "bi-rail-wood-bridge",
icon = ICONPATH .. "rail-wood-bridge.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-wood-bridge.png",
icon_size = 64,
}
},
normal = {
enabled = false,
ingredients = {
{type="item", name="bi-rail-wood", amount=1},
{type="item", name="steel-plate", amount=1},
{type="item", name="wood", amount=32}
},
results = {{type="item", name="bi-rail-wood-bridge", amount=2}},
main_product = "",
requester_paste_multiplier = 4,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.4
},
expensive = {
enabled = false,
ingredients = {
{type="item", name="bi-rail-wood", amount=1},
{type="item", name="steel-plate", amount=1},
{type="item", name="wood", amount=32}
},
results = {{type="item", name="bi-rail-wood-bridge", amount=1}},
main_product = "",
requester_paste_multiplier = 4,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.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]-aa[rail]",
-- This is a custom property for use by "Krastorio 2" (it will change
-- ingredients/results; used for wood/wood pulp)
mod = "Bio_Industries",
},
--- Power Rail
{
type = "recipe",
name = "bi-rail-power",
localised_name = {"entity-name.bi-rail-power"},
localised_description = {"entity-description.bi-rail-power"},
icon = ICONPATH .. "rail-concrete-power.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "rail-concrete-power.png",
icon_size = 64,
}
},
normal = {
enabled = false,
ingredients = {
{type="item", name="rail", amount=2},
{type="item", name="copper-cable", amount=4},
},
results = {{type="item", name="bi-rail-power", amount=2}},
main_product = "",
requester_paste_multiplier = 4,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.4
},
expensive = {
enabled = false,
ingredients = {
{type="item", name="rail", amount=1},
{type="item", name="copper-cable", amount=4},
},
results = {{type="item", name="bi-rail-power", amount=1}},
main_product = "",
requester_paste_multiplier = 4,
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.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]-ab[rail]",
},
--- Wood Pipe
{
type = "recipe",
@ -462,218 +255,4 @@ data:extend({
subgroup = "energy-pipe-distribution",
order = "a[pipe]-1b[pipe-to-ground]",
},
--- Rail to Power Pole
{
type = "recipe",
name = "bi-power-to-rail-pole",
localised_name = {"entity-name.bi-power-to-rail-pole"},
localised_description = {"entity-description.bi-power-to-rail-pole"},
icon = ICONPATH .. "electric-to-rail.png",
icon_size = 64,
icon_mipmaps = 1,
icons = {
{
icon = ICONPATH .. "electric-to-rail.png",
icon_size = 64,
}
},
normal = {
enabled = false,
ingredients = {
{type="item", name="copper-cable", amount=2},
{type="item", name="medium-electric-pole", amount=1},
},
results = {{type="item", name="bi-power-to-rail-pole", amount=1}},
main_product = "",
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.4
},
expensive = {
enabled = false,
ingredients = {
{type="item", name="copper-cable", amount=4},
{type="item", name="medium-electric-pole", amount=1},
},
results = {{type="item", name="bi-power-to-rail-pole", amount=1}},
main_product = "",
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.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]-ac[rail]",
},
--~ --- Large Wooden Chest
--~ {
--~ type = "recipe",
--~ name = "bi-wooden-chest-large",
--~ localised_name = {"entity-name.bi-wooden-chest-large"},
--~ localised_description = {"entity-description.bi-wooden-chest-large"},
--~ icon = ICONPATH .. "large_wooden_chest_icon.png",
--~ icon_size = 64,
--~ icons = {
--~ {
--~ icon = ICONPATH .. "large_wooden_chest_icon.png",
--~ icon_size = 64,
--~ }
--~ },
--~ normal = {
--~ energy_required = 2,
--~ enabled = false,
--~ ingredients = {
--~ {type="item", name="copper-plate", amount=16},
--~ {type="item", name="resin", amount=24},
--~ {type="item", name="wooden-chest", amount=8}
--~ },
--~ result = "bi-wooden-chest-large",
--~ result_count = 1,
--~ main_product = "",
--~ requester_paste_multiplier = 4,
--~ allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
--~ always_show_made_in = false, -- Added for 0.18.34/1.1.4
--~ allow_decomposition = true, -- Added for 0.18.34/1.1.4
--~ },
--~ expensive = {
--~ energy_required = 4,
--~ enabled = false,
--~ ingredients = {
--~ {type="item", name="copper-plate", amount=24},
--~ {type="item", name="resin", amount=32},
--~ {type="item", name="wooden-chest", amount=8}
--~ },
--~ result = "bi-wooden-chest-large",
--~ result_count = 1,
--~ main_product = "",
--~ requester_paste_multiplier = 4,
--~ allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
--~ always_show_made_in = false, -- Added for 0.18.34/1.1.4
--~ allow_decomposition = true, -- Added for 0.18.34/1.1.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 = "storage",
--~ order = "a[items]-aa[wooden-chest]",
--~ },
--~ --- Huge Wooden Chest
--~ {
--~ type = "recipe",
--~ name = "bi-wooden-chest-huge",
--~ localised_name = {"entity-name.bi-wooden-chest-huge"},
--~ localised_description = {"entity-description.bi-wooden-chest-huge"},
--~ icon = ICONPATH .. "huge_wooden_chest_icon.png",
--~ icon_size = 64,
--~ icons = {
--~ {
--~ icon = ICONPATH .. "huge_wooden_chest_icon.png",
--~ icon_size = 64,
--~ }
--~ },
--~ normal = {
--~ energy_required = 2,
--~ enabled = false,
--~ ingredients = {
--~ {type="item", name="iron-stick", amount=32},
--~ {type="item", name="stone-brick", amount=32},
--~ {type="item", name="bi-wooden-chest-large", amount=16}
--~ },
--~ result = "bi-wooden-chest-huge",
--~ result_count = 1,
--~ main_product = "",
--~ requester_paste_multiplier = 4,
--~ allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
--~ always_show_made_in = false, -- Added for 0.18.34/1.1.4
--~ allow_decomposition = true, -- Added for 0.18.34/1.1.4
--~ },
--~ expensive = {
--~ energy_required = 4,
--~ enabled = false,
--~ ingredients = {
--~ {type="item", name="iron-stick", amount=48},
--~ {type="item", name="stone-brick", amount=48},
--~ {type="item", name="bi-wooden-chest-large", amount=16}
--~ },
--~ result = "bi-wooden-chest-huge",
--~ result_count = 1,
--~ main_product = "",
--~ requester_paste_multiplier = 4,
--~ allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
--~ always_show_made_in = false, -- Added for 0.18.34/1.1.4
--~ allow_decomposition = true, -- Added for 0.18.34/1.1.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 = "storage",
--~ order = "a[items]-ab[wooden-chest]",
--~ },
--~ --- Giga Wooden Chest
--~ {
--~ type = "recipe",
--~ name = "bi-wooden-chest-giga",
--~ localised_name = {"entity-name.bi-wooden-chest-giga"},
--~ localised_description = {"entity-description.bi-wooden-chest-giga"},
--~ icon = ICONPATH .. "giga_wooden_chest_icon.png",
--~ icon_size = 64,
--~ icons = {
--~ {
--~ icon = ICONPATH .. "giga_wooden_chest_icon.png",
--~ icon_size = 64,
--~ }
--~ },
--~ normal = {
--~ energy_required = 4,
--~ enabled = false,
--~ ingredients = {
--~ {type="item", name="steel-plate", amount=32},
--~ {type="item", name="concrete", amount=32},
--~ {type="item", name="bi-wooden-chest-huge", amount=16}
--~ },
--~ result = "bi-wooden-chest-giga",
--~ result_count = 1,
--~ main_product = "",
--~ requester_paste_multiplier = 4,
--~ allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
--~ always_show_made_in = false, -- Added for 0.18.34/1.1.4
--~ allow_decomposition = true, -- Added for 0.18.34/1.1.4
--~ },
--~ expensive = {
--~ energy_required = 6,
--~ enabled = false,
--~ ingredients = {
--~ {type="item", name="steel-plate", amount=48},
--~ {type="item", name="concrete", amount=48},
--~ {type="item", name="bi-wooden-chest-huge", amount=16}
--~ },
--~ main_product = "",
--~ result = "bi-wooden-chest-giga",
--~ result_count = 1,
--~ main_product = "",
--~ requester_paste_multiplier = 4,
--~ allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
--~ always_show_made_in = false, -- Added for 0.18.34/1.1.4
--~ allow_decomposition = true, -- Added for 0.18.34/1.1.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 = "storage",
--~ order = "a[items]-ac[wooden-chest]",
--~ },
})

View file

@ -1,88 +0,0 @@
local BioInd = require('common')('Bio_Industries')
--~ local ICONPATH = BioInd.modRoot .. "/graphics/icons/"
function find_ties (table_name, table, entity_type)
if not (type(table) == "table") then
return
end
-- only tables
if table_name == "ties" then
-- we have found ties
return true
end
for i, v in pairs (table) do
-- probably lower can be ties
local cash = find_ties(i, v, entity_type)
-- if we have found ties then
if cash then
local new_name = string.gsub(table_name, '_', '-') -- ohh! All names have '-' in the name
global[entity_type][#global[entity_type]+1] = {name = new_name, table = v}
end
end
end
------------------------------------
------------------------------------ rails
------------------------------------
function set_tint_to_rails (rails_entities, tint)
-- two tables:
-- first table is a list of elements
-- second is a tint
--local wood_tint = {r = 183/255, g = 125/255, b = 62/255, a = 1}
--local concrete_tint = {r = 183/255, g = 183/255, b = 183/255, a = 1}
--~ local tint = tint
local sheet_path_ties = "__Bio_Industries__/graphics/entities/wood_products/rails/ties/"
local rails_entities = rails_entities or -- or vanilla
{
data.raw["straight-rail"]["straight-rail"],
data.raw["curved-rail"]["curved-rail"]
}
global = global or {}
global["rails"] = {}
--BioInd.writeDebug("Start rails") ---------------------
for i, v in pairs (rails_entities) do
local r_table = serpent.block(find_ties(i, v, "rails"))
end
--BioInd.writeDebug("global table of rails is complete: %s", {#global.rails})
for i, handler in pairs (global.rails) do
--handler.name = "straight_rail_horizontal"
local was_filename = handler.table.filename
handler.table.filename = sheet_path_ties .. "hr-" .. handler.name .. "-ties.png"
BioInd.writeDebug('Replaced: %s ===>>> %s', {was_filename, handler.table.filename})
handler.table.tint = tint
end
--BioInd.writeDebug("End rails") ---------------------
end
------------------------------------
------------------------------------ remnants
------------------------------------
function set_tint_to_remnants(remnants_entities, tint) -- tha same function, actually
--~ local tint = tint
local sheet_path_ties = "__Bio_Industries__/graphics/entities/wood_products/rails/ties/"
local remnants_entities = remnants_entities or { -- or vanilla {
data.raw["rail-remnants"]["straight-rail-remnants"],
data.raw["rail-remnants"]["curved-rail-remnants"]
}
global = global or {}
global["remnants"] = {}
--BioInd.writeDebug("Start remnants") ---------------------
for i, v in pairs (remnants_entities) do
local r_table = serpent.block(find_ties(i, v, "remnants"))
end
--BioInd.writeDebug("global table of remnants is complete: %s", {#global.remnants})
for i, handler in pairs (global.remnants) do
--remnants.name = "straight_rail_horizontal"
local was_filename = handler.table.filename
handler.table.filename = sheet_path_ties .. "hr-" .. handler.name .. "-ties-remnants.png"
BioInd.writeDebug('Replaced: %s ===>>> %s', {was_filename, handler.table.filename})
handler.table.tint = tint
end
--BioInd.writeDebug("End remnants") ---------------------
end

View file

@ -1,52 +0,0 @@
local BioInd = require('common')('Bio_Industries')
local ICONPATH = BioInd.modRoot .. "/graphics/entities/wood_products/rails/"
local pix = {
"straight_rail_horizontal",
"straight_rail_vertical",
"straight_rail_diagonal_left_bottom", "straight_rail_diagonal_left_top",
"straight_rail_diagonal_right_bottom", "straight_rail_diagonal_right_top",
"curved_rail_horizontal_left_bottom", "curved_rail_horizontal_left_top",
"curved_rail_horizontal_right_bottom", "curved_rail_horizontal_right_top",
"curved_rail_vertical_left_bottom", "curved_rail_vertical_left_top",
"curved_rail_vertical_right_bottom", "curved_rail_vertical_right_top",
}
local PATH, FILE, HR_FILE
local rail_type, direction, img, proto
for p, pic in ipairs(pix) do
-- Extract rail_type and direction from the string and replace underscores with "-"
rail_type = pic:match("^([^_]+_rail)_.+$"):gsub("_", "-")
direction = pic:match("^.+_rail_(.+)$"):gsub("_", "-")
BioInd.show("rail_type", rail_type)
BioInd.show("direction", direction)
-- Rails
PATH = ICONPATH .. rail_type .. "-bridge"
FILE = PATH .. "/" .. rail_type .. "-" .. direction .. "-"
HR_FILE = PATH .. "/hr-" .. rail_type .. "-" .. direction .. "-"
img = data.raw[rail_type]["bi-" .. rail_type .. "-wood-bridge"].pictures[pic]
img.stone_path.filename = FILE .. "stone-path.png"
img.stone_path_background.filename = FILE.."stone-path-background.png"
-- Remnants
img = data.raw["rail-remnants"][rail_type .. "-remnants-wood-bridge"].pictures[pic]
img.stone_path.filename = ICONPATH .. "remnants/remnants.png"
img.stone_path_background.filename = ICONPATH .. "remnants/remnants.png"
end
-- Localize remnants!
local remnants
for f, form in ipairs({"straight", "curved"}) do
remnants = data.raw["rail-remnants"][form .. "-rail-remnants-wood-bridge"]
remnants.localised_name = {"entity-name.rail-remnants-wood-bridge"}
remnants.localised_description = {"entity-description.rail-remnants-wood-bridge"}
end

View file

@ -1,6 +1,5 @@
-- Add functions that are also used in other files (debugging output etc.)
local BioInd = require('common')('Bio_Industries')
--~ local ICONPATH = BioInd.modRoot .. "/graphics/icons/"
local BioInd = require('common')('Bio_Industries_2')
local ICONPATH = "__core__/graphics/"
local HIDDENPATH = BioInd.modRoot .. "/prototypes/compound_entities/"
@ -30,7 +29,6 @@ BI.hidden_entities.flags = {
"not-in-kill-statistics",
"not-on-map",
"not-repairable",
--~ "not-selectable-in-game",
"not-upgradable",
"placeable-off-grid",
}
@ -58,7 +56,6 @@ BI.hidden_entities.icons = {
}
}
BI.hidden_entities.picture = {
--~ filename = ICONPATH .. "blank.png",
filename = ICONPATH .. "empty.png",
priority = "low",
size = 1,
@ -89,24 +86,13 @@ BI.hidden_entities.misc = {
corpse = "",
created_effect = nil,
created_smoke = nil,
--~ damaged_trigger_effect = {
--~ {
--~ type = "damage",
--~ damage = {
--~ type = "fire",
--~ amount = 0
--~ }
--~ }
--~ },
damaged_trigger_effect = nil,
--~ dying_explosion = nil,
energy_source = {
render_no_network_icon = false,
render_no_power_icon = false,
},
fast_replaceable_group = "",
light = nil,
--~ minable = nil,
next_upgrade = "",
remove_decoratives = "false",
water_reflection = {pictures = BI.hidden_entities.picture},
@ -134,7 +120,6 @@ BI.set_common_properties = function(h_entity)
{
icon = h_entity.icon,
icon_size = h_entity.icon_size or 1,
--~ icon_mipmaps = h_entity.icon_mipmaps or 1
icon_mipmaps = h_entity.icon_mipmaps
}
}
@ -144,13 +129,11 @@ BI.set_common_properties = function(h_entity)
h_entity.picture = BioInd.is_debug and h_entity.picture or BI.hidden_entities.picture
h_entity.pictures = BioInd.is_debug and h_entity.pictures or BI.hidden_entities.picture
--~ h_entity.pictures = BI.hidden_entities.picture
h_entity.overlay = BioInd.is_debug and h_entity.overlay or BI.hidden_entities.overlay
h_entity.flags = BI.hidden_entities.flags
h_entity.selectable_in_game = BI.hidden_entities.selectable_in_game
h_entity.max_health = BI.hidden_entities.max_health
--~ h_entity.resistances = {{type = "fire", percent = 100}}
h_entity.collision_mask = BI.hidden_entities.collision_mask
h_entity.collision_box = BI.hidden_entities.collision_box
h_entity.selection_box = BI.hidden_entities.selection_box
@ -169,11 +152,8 @@ BI.make_hidden_entity_list = function(hidden_type)
local name, entity_locale
for c_name, c_data in pairs(BioInd.compound_entities) do
BioInd.writeDebug("Checking %s for hidden %ss", {c_name, hidden_type})
--~ BioInd.show("c_name", c_name)
--~ BioInd.show("c_data", c_data)
local h_type = c_data.hidden[hidden_type]
if h_type then
--~ name = c_data.tab:gsub("_table$", ""):gsub("_", "-") .. "-hidden-" .. hidden_type
name = h_type and h_type.name or c_data.base and c_data.base.name .. "-hidden-" .. hidden_type
-- Store the name of the compound entity -- we'll need it for the localization!
BI.hidden_entities.types[hidden_type] = BI.hidden_entities.types[hidden_type] or {}
@ -196,7 +176,6 @@ end
-- The hidden entities DO need to have images, so that they can be identified in the
-- production tab!
BI.add_layer = function(layers, data)
--~ BioInd.check_args(layers, "table", "layer")
BioInd.check_args(data, "table", "layer data")
layers = layers or {}
@ -207,8 +186,6 @@ BI.add_layer = function(layers, data)
local size = data.size
local shadow = data.shadow
--~ size = size or
--~ (height and width and height == width) and height
layers[#layers + 1] = {
filename = hr_name,
priority = priority or "low",
@ -223,8 +200,4 @@ end
require(HIDDENPATH .. "hidden_lamps")
require(HIDDENPATH .. "hidden_panels")
require(HIDDENPATH .. "hidden_poles")
require(HIDDENPATH .. "hidden_radars")
--~ BioInd.show("BI.hidden_entities.types", BI.hidden_entities.types)
--~ error("Break!")
require(HIDDENPATH .. "hidden_radars")

View file

@ -1,201 +0,0 @@
-- Add functions that are also used in other files (debugging output etc.)
local BioInd = require('common')('Bio_Industries')
BioInd.writeDebug("Entered prototypes.hidden_poles.lua of \"%s\".", {BioInd.modName})
local ICONPATH = BioInd.modRoot .. "/graphics/icons/"
------------------------------------------------------------------------------------
-- Create the main prototype for hidden poles. All others will be based on this! --
------------------------------------------------------------------------------------
--~ local h_type = "electric-pole"
--~ local h_entity = table.deepcopy(data.raw[h_type]["small-electric-pole"])
-- The short name of the hidden entity (e.g. "lamp" or "pole")
local h_key = "pole"
-- The actual prototype type, identified by h_key
local h_type = BioInd.HE_map[h_key]
local h_entity = table.deepcopy(data.raw[h_type]["small-electric-pole"])
BI.set_common_properties(h_entity)
------------------------------------------------------------------------------------
-- Pole specific attributes!
h_entity.draw_copper_wires = BioInd.is_debug
h_entity.draw_circuit_wires = BioInd.is_debug
h_entity.maximum_wire_distance = 10
h_entity.supply_area_distance = 5
--~ hidden_pole.resistances = {}
--~ for damage, d in pairs(data.raw["damage-type"]) do
--~ hidden_pole.resistances[#hidden_pole.resistances +1] = {
--~ type = damage,
--~ percent = 100
--~ }
--~ end
--~ BioInd.show("hidden_pole.resistances", hidden_pole.resistances)
h_entity.connection_points = BioInd.is_debug and
h_entity.connection_points or {
{
shadow = {},
wire = { copper_wire_tweak = {0, 0} }
}
}
--~ h_entity.connection_points = h_entity.connection_points
h_entity.radius_visualisation_picture = BioInd.is_debug and
h_entity.radius_visualisation_picture or
BI.hidden_entities.picture
h_entity.energy_source = {
type = "electric",
usage_priority = "solar"
}
------------------------------------------------------------------------------------
-- Make a copy of the hidden-entity prototype for each compound entity! --
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
-- Compile a list of the hidden entities we'll need
BI.make_hidden_entity_list(h_key)
-- Musk floor is not an entity, but a tile, so we don't have a compound-entity table
-- for it and must add it manually!
local Musk_name = "bi-musk-mat-hidden-pole"
BI.hidden_entities.types[h_key][Musk_name] = "bi-solar-mat"
-- We only have one "connector" at the moment. No need to add another file just for that,
-- so let's add this connector manually to the list!
BI.hidden_entities.types[h_key]["bi-bio-farm-hidden-connector_pole"] = "bi-bio-farm"
local function shift_picture(pole, offset)
if not BioInd.is_debug then
pole.pictures.shift = offset or {0, 0}
end
end
------------------------------------------------------------------------------------
-- Make the copies!
local tmp, pole
local c_entities = BioInd.compound_entities
BioInd.writeDebug("BI.hidden_entities.types[%s]: %s", {h_key, BI.hidden_entities.types[h_key]})
--~ for pole_name, locale_name in pairs(pole_list) do
for pole_name, locale_name in pairs(BI.hidden_entities.types[h_key]) do
BioInd.show("pole_name", pole_name)
BioInd.show("locale_name", locale_name)
--~ pole = table.deepcopy(data.raw["electric-pole"]["bi-hidden-power-pole"])
pole = table.deepcopy(h_entity)
pole.name = pole_name
pole.localised_name = {"entity-name." .. locale_name}
pole.localised_description = {"entity-description." .. locale_name}
pole.icon_size = BioInd.is_debug and pole.icon_size or 64
------------------------------------------------------------------------------------
-- Adjust properties for hidden biofarm poles
------------------------------------------------------------------------------------
--~ if c_entities["bi-bio-farm"] then
--~ -- We have connectors on the roof of Bio farms, so we want to display connections
--~ if c_entities["bi-bio-farm"].hidden["connector"] and
--~ pole_name == c_entities["bi-bio-farm"].hidden["connector"].name then
local biofarm_connector = c_entities["bi-bio-farm"].hidden["connector"] and
pole_name == c_entities["bi-bio-farm"].hidden["connector"].name
local biofarm_pole = (c_entities["bi-bio-farm"].hidden[h_key] and
pole_name == c_entities["bi-bio-farm"].hidden[h_key].name)
if c_entities["bi-bio-farm"] and biofarm_connector or biofarm_pole then
-- We have connectors on the roof of Bio farms, so we want to display connections
--~ if (c_entities["bi-bio-farm"].hidden["connector"] and
--~ pole_name == c_entities["bi-bio-farm"].hidden["connector"].name) then
if biofarm_connector then
pole.draw_copper_wires = true
local vanilla = table.deepcopy(data.raw[h_type]["small-electric-pole"])
local cp = vanilla.connection_points[1]
local offset_y = 2.7
for img, img_data in ipairs({"shadow", "wire"}) do
cp[img_data].green = nil
cp[img_data].red = nil
cp[img_data].copper[1] = cp[img_data].copper[1] + (offset_x or 0)
cp[img_data].copper[2] = cp[img_data].copper[2] + (offset_y or 0)
end
pole.connection_points = BioInd.is_debug and vanilla.connection_points or {cp}
pole.pictures = BioInd.is_debug and vanilla.pictures or pole.pictures
--~ pole.supply_area_distance = 1
pole.supply_area_distance = 5
pole.maximum_wire_distance = 5
shift_picture(pole)
BioInd.show("Adjusted properties of", pole_name)
-- Hidden center pole for supplying the area around the building
--~ elseif pole_name == c_entities["bi-bio-farm"].hidden[h_key].name then
--~ elseif (c_entities["bi-bio-farm"].hidden[h_key] and
--~ pole_name == c_entities["bi-bio-farm"].hidden[h_key].name) then
else
--~ pole.draw_copper_wires = true
pole.maximum_wire_distance = 2
pole.supply_area_distance = 5
--~ pole.selection_box = {{-.25, -.25}, {.25, .25}}
--~ pole.selectable_in_game = true
shift_picture(pole)
BioInd.show("Adjusted properties of", pole_name)
end
------------------------------------------------------------------------------------
-- Adjust properties for hidden power-rail pole
------------------------------------------------------------------------------------
elseif (c_entities["bi-straight-rail-power"] and
c_entities["bi-straight-rail-power"].hidden[h_key] and
pole_name == c_entities["bi-straight-rail-power"].hidden[h_key].name) or
(c_entities["bi-curved-rail-power"] and
c_entities["bi-curved-rail-power"].hidden[h_key] and
pole_name == c_entities["bi-curved-rail-power"].hidden[h_key].name) then
--~ elseif pole_name == c_entities["bi-straight-rail-power"].hidden[h_key].name then
--~ pole.localised_name = {"entity-name.bi-rail-power"}
--~ pole.localised_description = {"entity-description.bi-rail-power"}
pole.maximum_wire_distance = 9
pole.supply_area_distance = 2
shift_picture(pole)
BioInd.show("Adjusted properties of", pole_name)
------------------------------------------------------------------------------------
-- Adjust properties for hidden pole of bio gardens
------------------------------------------------------------------------------------
elseif c_entities["bi-bio-garden"] and
-- This pole may have been removed because "Easy Gardens" is disabled!
c_entities["bi-bio-garden"].hidden[h_key] and
pole_name == c_entities["bi-bio-garden"].hidden[h_key].name then
pole.maximum_wire_distance = 4
pole.supply_area_distance = 1
shift_picture(pole)
BioInd.show("Adjusted properties of", pole_name)
------------------------------------------------------------------------------------
-- Adjust properties for hidden pole of Musk floor
------------------------------------------------------------------------------------
elseif pole_name == Musk_name then
pole.icon = ICONPATH .. "solar-mat.png"
pole.icon_size = 64
pole.maximum_wire_distance = 1
pole.supply_area_distance = 3
BioInd.show("Adjusted properties of", pole_name)
end
data:extend({pole})
BioInd.show("Created", pole_name)
end
------------------------------------------------------------------------------------
--~ -- Testing
--~ for k, v in pairs(data.raw[h_entity.type]) do
--~ BioInd.writeDebug("%s: %s", {k, v})
--~ end

View file

@ -143,20 +143,6 @@ ret.compound_entities = {
},
}
},
["bi-straight-rail-power"] = {
tab = "bi_power_rail_table",
base = {
name = "bi-straight-rail-power",
type = "straight-rail",
},
hidden = {
pole = {
name = "bi-rail-power-hidden-pole",
localize_entity = "bi-rail-power"
-- type = ret.HE_map.pole,
},
}
},
-- Built from blueprint
["bi-arboretum"] = {
tab = "bi_arboretum_table",
@ -260,8 +246,6 @@ ret.get_HE_list = function(get_complete_list)
-- Some entities share almost the same data, so we can copy them
local make_copies = {
-- Rails
["bi-straight-rail-power"] = { name = "bi-curved-rail-power", type = "curved-rail" },
-- Overlay entities
["bi-arboretum"] = { name = "bi-arboretum-area", type = ret.HE_map.ammo_turret },
["bi-bio-cannon"] = { name = "bi-bio-cannon-area", type = ret.HE_map.ammo_turret },