-- Integration: Black Rubber Belts - Remastered (Factorio 2.0+ successor to DeadlockBlackRubberBelts).
-- The remastered mod has built-in compat for legacy fork IDs (AdvancedBeltsSA, AdvancedBeltsSA-VL),
-- but it looks for the old prototype names and mod IDs. Our bb-prefixed tiers are invisible to it,
-- so we register them ourselves the same way it handles vanilla belts internally.
if not mods["black-rubber-belts-remastered"] then return end
local IR2RB = require("__black-rubber-belts-remastered__.code.functions")
local tiers = require("tiers").list
local color = require("tiers").color
local rail_style = settings.startup["rail-style"].value -- ~ Re-sorted.
local alt_bases = (rail_style == "ir3-alt")
local arrow_glow = settings.startup["arrow-glow"].value
local arrow_style = (settings.startup["arrow-style"].value).."-"..(settings.startup["tier-style"].value == "tier-based" and beltdata.tier or settings.startup["tier-style"].value)
local rail_glow = settings.startup["rail-glow"].value
local stripe_style = settings.startup["stripe-style"].value -- + Added.
local stripe_glow = settings.startup["stripe-glow"].value -- + Added.
for _, t in ipairs(tiers) do
-- Convert our 0-255 colour to 0-1 floats expected by the remastered API.
local c = color[t.name]
local tint = {r = c.r / 255, g = c.g / 255, b = c.b / 255, a = (c.a or 255) / 255}
local base = alt_bases and "tungsten" or "steel"
-- Apply belt animation set
local belt = data.raw["transport-belt"][t.name .. "-belt"]
belt.belt_animation_set.animation_set = IR2RB.get_belt_animation_set(tint, base, arrow_style, stripe_style, arrow_glow, rail_glow, stripe_glow)
if string.find(arrow_style, "quadrupled") then
belt.belt_animation_set.alternate = true
else
belt.belt_animation_set.alternate = false
end -- Ported from BRBR Implementation
belt.corpse = "small-remnants"
-- Replace icons on the item, then mirror onto the entity
IR2RB.replace_item_icon(t.name .. "-belt", "rubber-belt-" .. base)
-- Add stripes to the belt icon if they're active
if (settings.startup["stripe-style"].value ~= "no-stripe") then
IR2RB.add_mask_to_item_icon(t.name .."-belt", "rubber-belt-mask-"..(settings.startup["stripe-style"].value), tint)
end
-- Add arrows to the belt icon if they're active
if (settings.startup["arrow-style"].value ~= "no-arrows") then
-- invert the arrow's tint for specific stripe styles
local invert_tint = (settings.startup["stripe-style"].value == "stripe-thick") or (settings.startup["stripe-style"].value == "full-paint") or false
IR2RB.add_mask_to_item_icon(t.name .."-belt", "rubber-belt-mask", (invert_tint and { r = 0.18, g = 0.18, b = 0.18, a = 1 } or tint))
end
-- Add colored rails to the icon if colored rails is on
if (settings.startup["rail-style"].value == "colored") then
IR2RB.add_mask_to_item_icon(t.name .."-belt", "rubber-rail-mask", tint) end
IR2RB.copy_item_icons_to_entity("transport-belt", t.name .. "-belt")
end
-- Propagate the new animation_set to splitters / undergrounds
-- (lane-splitters, when present via the lane-balancers integration, derive
-- their belt_animation_set from the splitter at integration time).
for _, t in ipairs(tiers) do
local belt_anim_set = data.raw["transport-belt"][t.name .. "-belt"].belt_animation_set.animation_set
data.raw["splitter"][t.name .. "-splitter"].belt_animation_set.animation_set = belt_anim_set
data.raw["underground-belt"][t.name .. "-underground"].belt_animation_set.animation_set = belt_anim_set
end